218 cd $local_dot
219 rm -rf $1
220 }
221
222 #
223 # Create a directory if it doesn't already exist.
224 # mkdir will provide an error message, so don't provide an additional
225 # message.
226 #
227
228 function tstmkdir {
229 [ -d $1 ] || mkdir -p $1 || fail
230 }
231
232 #
233 # Patch up target directories for glommed kernel.
234 # usage: fixglom listfile glomname
235 #
236
237 function fixglom {
238 nawk \
239 -v glomname=$2 \
240 -v karch=$KARCH '
241 $1 == "MOD" || $1 == "SYMLINK" {
242 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $4)
243 sub(/^kernel/, "platform/" karch "/" glomname, $4)
244 sub(/^usr.kernel/, "platform/" karch "/" glomname, $4)
245 print
246 }
247 $1 == "LINK" {
248 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $3)
249 sub(/^kernel/, "platform/" karch "/" glomname, $3)
250 sub(/^usr.kernel/, "platform/" karch "/" glomname, $3)
251 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $5)
252 sub(/^kernel/, "platform/" karch "/" glomname, $5)
253 sub(/^usr.kernel/, "platform/" karch "/" glomname, $5)
254 print
255 }
256 $1 == "CONF" {
257 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $3)
258 sub(/^kernel/, "platform/" karch "/" glomname, $3)
259 sub(/^usr.kernel/, "platform/" karch "/" glomname, $3)
260 print
261 }
262 ' $1 > $1.new
263 mv $1.new $1
264 }
265
266 #
267 # Filter out implementation-specific modules, unless that
268 # implementation was requested by the user.
269 # usage: filtimpl listfile implname
270 #
271
272 function filtimpl {
273 nawk \
274 -v impl=$2 '
275 $1 == "MOD" || $1 == "SYMLINK" {
276 if ($6 == "all" || $6 == impl)
277 print
278 }
279 $1 == "CONF" {
280 if ($5 == "all" || $5 == impl)
281 print
282 }
283 $1 == "LINK" {
284 if ($7 == "all" || $7 == impl)
285 print
286 }
287 ' $1 > $1.new
288 mv $1.new $1
289 }
290
291 #
292 # Filter the module list to match the user's request.
293 # Usage: filtmod listfile modules
294 #
295 function filtmod {
296 nawk -v reqstring="$2" '
297 function modmatch(modname) {
298 if (reqstring == "All") {
299 return (1)
300 } else if (reqstring == "Modules") {
301 if (modname != "unix" && modname != "genunix")
302 return (1)
303 } else {
304 if (modname in reqmods)
305 return (1)
306 }
307 return (0)
308 }
309 BEGIN {
310 #
311 # The split call creates indexes 1, 2, 3, ... We want
312 # the module names as indexes.
313 #
314 split(reqstring, tmpmods)
315 for (i in tmpmods)
316 reqmods[tmpmods[i]] = 1
436 target=$targdir/$6
437 rm -f $target
438 verbose "ln $INSTALL_FILES/$3/$4 $target"
439 ln $INSTALL_FILES/$3/$4 $target || fail "can't create $target"
440 ;;
441 CONF)
442 target=$INSTALL_FILES/$3
443 tstmkdir `dirname $target`
444 conffile=`basename $3`
445 verbose "$INSTALL_CP $4/$conffile $target"
446 $INSTALL_CP $4/$conffile $target
447 ;;
448 *)
449 fail "unrecognized modlist entry: $*"
450 ;;
451 esac
452 }
453
454 # Sanity-check the given module list.
455 function check_modlist {
456 nawk '
457 BEGIN {
458 nfields["MOD"] = 6
459 nfields["CONF"] = 6
460 nfields["LINK"] = 7
461 nfields["SYMLINK"] = 7
462 }
463 {
464 # This also catches unknown tags.
465 if (nfields[$1] != NF) {
466 print "error: invalid modlist record:"
467 print $0
468 print "expected", nfields[$1], "fields, found", NF
469 status=1
470 }
471 }
472 END {
473 exit status
474 }
475 ' $1 || fail "Errors in kernel module list"
476 }
939 v) V="v"; SHV="x";;
940 V) V="v"; SHV="x"; set -x;;
941 q) V=""; SHV="";;
942 esac
943
944 #
945 # Create temp directory for Install's files
946 #
947
948 tstmkdir $INSTALL_DIR
949
950 TARFILE=$INSTALL_DIR/Install.${KARCH}.tar
951 INSTALL_FILES=$INSTALL_DIR/$KARCH
952
953 #
954 # Extract the target machine and target directory from a target of the
955 # form [user@]machine:/dir .
956 #
957
958 if [ "$IMODE" != "n" ]; then
959 eval `echo $TARGET | nawk -F':' '{
960 if (NF != 2 || !length($1) || !length($2))
961 print "usage \"Invalid target\""
962 m = $1; d = $2
963 if ($1 ~ /@/) {
964 k = split($1, f, "@");
965 if (k != 2 || !length(f[1]) || !length (f[2]))
966 print "usage \"Invalid target\""
967 u = f[1]; m = f[2]
968 }
969 print "TARGET_USER=" u ";"
970 print "TARGET_MACHINE=" m ";"
971 print "TARGET_DIR=" d ";"
972 }'`
973 if [ -z "$TARGET_USER" ]; then
974 TARGET_USER=$LOGNAME
975 fi
976 fi
977
978 #
979 # Allow the use of library source or target for the install
|
218 cd $local_dot
219 rm -rf $1
220 }
221
222 #
223 # Create a directory if it doesn't already exist.
224 # mkdir will provide an error message, so don't provide an additional
225 # message.
226 #
227
228 function tstmkdir {
229 [ -d $1 ] || mkdir -p $1 || fail
230 }
231
232 #
233 # Patch up target directories for glommed kernel.
234 # usage: fixglom listfile glomname
235 #
236
237 function fixglom {
238 /usr/xpg4/bin/awk \
239 -v glomname=$2 \
240 -v karch=$KARCH '
241 $1 == "MOD" || $1 == "SYMLINK" {
242 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $4)
243 sub(/^kernel/, "platform/" karch "/" glomname, $4)
244 sub(/^usr.kernel/, "platform/" karch "/" glomname, $4)
245 print
246 }
247 $1 == "LINK" {
248 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $3)
249 sub(/^kernel/, "platform/" karch "/" glomname, $3)
250 sub(/^usr.kernel/, "platform/" karch "/" glomname, $3)
251 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $5)
252 sub(/^kernel/, "platform/" karch "/" glomname, $5)
253 sub(/^usr.kernel/, "platform/" karch "/" glomname, $5)
254 print
255 }
256 $1 == "CONF" {
257 sub(/^platform.*kernel/, "platform/" karch "/" glomname, $3)
258 sub(/^kernel/, "platform/" karch "/" glomname, $3)
259 sub(/^usr.kernel/, "platform/" karch "/" glomname, $3)
260 print
261 }
262 ' $1 > $1.new
263 mv $1.new $1
264 }
265
266 #
267 # Filter out implementation-specific modules, unless that
268 # implementation was requested by the user.
269 # usage: filtimpl listfile implname
270 #
271
272 function filtimpl {
273 /usr/xpg4/bin/awk \
274 -v impl=$2 '
275 $1 == "MOD" || $1 == "SYMLINK" {
276 if ($6 == "all" || $6 == impl)
277 print
278 }
279 $1 == "CONF" {
280 if ($5 == "all" || $5 == impl)
281 print
282 }
283 $1 == "LINK" {
284 if ($7 == "all" || $7 == impl)
285 print
286 }
287 ' $1 > $1.new
288 mv $1.new $1
289 }
290
291 #
292 # Filter the module list to match the user's request.
293 # Usage: filtmod listfile modules
294 #
295 function filtmod {
296 /usr/xpg4/bin/awk -v reqstring="$2" '
297 function modmatch(modname) {
298 if (reqstring == "All") {
299 return (1)
300 } else if (reqstring == "Modules") {
301 if (modname != "unix" && modname != "genunix")
302 return (1)
303 } else {
304 if (modname in reqmods)
305 return (1)
306 }
307 return (0)
308 }
309 BEGIN {
310 #
311 # The split call creates indexes 1, 2, 3, ... We want
312 # the module names as indexes.
313 #
314 split(reqstring, tmpmods)
315 for (i in tmpmods)
316 reqmods[tmpmods[i]] = 1
436 target=$targdir/$6
437 rm -f $target
438 verbose "ln $INSTALL_FILES/$3/$4 $target"
439 ln $INSTALL_FILES/$3/$4 $target || fail "can't create $target"
440 ;;
441 CONF)
442 target=$INSTALL_FILES/$3
443 tstmkdir `dirname $target`
444 conffile=`basename $3`
445 verbose "$INSTALL_CP $4/$conffile $target"
446 $INSTALL_CP $4/$conffile $target
447 ;;
448 *)
449 fail "unrecognized modlist entry: $*"
450 ;;
451 esac
452 }
453
454 # Sanity-check the given module list.
455 function check_modlist {
456 /usr/xpg4/bin/awk '
457 BEGIN {
458 nfields["MOD"] = 6
459 nfields["CONF"] = 6
460 nfields["LINK"] = 7
461 nfields["SYMLINK"] = 7
462 }
463 {
464 # This also catches unknown tags.
465 if (nfields[$1] != NF) {
466 print "error: invalid modlist record:"
467 print $0
468 print "expected", nfields[$1], "fields, found", NF
469 status=1
470 }
471 }
472 END {
473 exit status
474 }
475 ' $1 || fail "Errors in kernel module list"
476 }
939 v) V="v"; SHV="x";;
940 V) V="v"; SHV="x"; set -x;;
941 q) V=""; SHV="";;
942 esac
943
944 #
945 # Create temp directory for Install's files
946 #
947
948 tstmkdir $INSTALL_DIR
949
950 TARFILE=$INSTALL_DIR/Install.${KARCH}.tar
951 INSTALL_FILES=$INSTALL_DIR/$KARCH
952
953 #
954 # Extract the target machine and target directory from a target of the
955 # form [user@]machine:/dir .
956 #
957
958 if [ "$IMODE" != "n" ]; then
959 eval `echo $TARGET | /usr/xpg4/bin/awk -F':' '{
960 if (NF != 2 || !length($1) || !length($2))
961 print "usage \"Invalid target\""
962 m = $1; d = $2
963 if ($1 ~ /@/) {
964 k = split($1, f, "@");
965 if (k != 2 || !length(f[1]) || !length (f[2]))
966 print "usage \"Invalid target\""
967 u = f[1]; m = f[2]
968 }
969 print "TARGET_USER=" u ";"
970 print "TARGET_MACHINE=" m ";"
971 print "TARGET_DIR=" d ";"
972 }'`
973 if [ -z "$TARGET_USER" ]; then
974 TARGET_USER=$LOGNAME
975 fi
976 fi
977
978 #
979 # Allow the use of library source or target for the install
|