From: <smi...@us...> - 2003-12-23 16:05:36
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv2081/scripts/scripts Modified Files: save-config Log Message: - save-config now uses devices from devfs (more dynamic) - better handling of subdirectories & links in jail script (fl) - initrd script now uses devfs for finding the floppy drives (this was broken in older kernels) - initrd script now searches scsi partitions first for etc.tar.bz2 Index: save-config =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/save-config,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- save-config 18 Sep 2003 19:01:27 -0000 1.23 +++ save-config 23 Dec 2003 16:05:33 -0000 1.24 @@ -18,39 +18,63 @@ QUIET="yes" fi -CONFIG_SRC_LIST="/dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1 /dev/fd0" +# generate the device list we need to search for the configuration information +PARTITIONS_IDE=`find /dev/ide/ -name "part*" 2> /dev/null` +PARTITIONS_SCSI=`find /dev/scsi/ -name "part*" 2> /dev/null` +FLOPPIES=`find /dev/floppy/ -name "?" 2> /dev/null` +CONFIG_SRC_LIST="$PARTITIONS_SCSI $PARTITIONS_IDE $FLOPPIES" + CONFIG_MOUNT=/var/adm/mount -DL_CONFIG_SOURCE="/dev/fd0" +DL_CONFIG_SOURCE="" mkdir -p $CONFIG_MOUNT || exit 1 -# check usb devices -for USB_DEV in $(allAttachedScsiUsb) +$GREEN +echo -e "searching for configuration media" +$NORMAL + +until [ -e $CONFIG_MOUNT/etc.tar.bz2 ] ; do - CFG_SRC=$(scsiDevFromScsiUsb $USB_DEV) - if mount -t auto $CFG_SRC $CONFIG_MOUNT >/dev/null 2>&1 ; then + for CFG_SRC in $CONFIG_SRC_LIST + do + echo -e "Checking $CFG_SRC" + if mount -n -t auto $CFG_SRC $CONFIG_MOUNT >/dev/null 2>&1 ; then - if [ -e $CONFIG_MOUNT/etc.tar.bz2 ] ; then - $SUCCESS - echo "Found configuration on $CFG_SRC" - $NORMAL - DL_CONFIG_SOURCE=$CFG_SRC - continue 2 - else - beep; - umount $CONFIG_MOUNT # in case user swaps floppy when we are accepting input - $SUCCESS - echo -e "\n*** Found empty media $CFG_SRC . ***\n" - $NORMAL - echo -n "Should I copy default configuration to it?" - if ask_yes_no ; then - mount -t auto $CFG_SRC $CONFIG_MOUNT >/dev/null 2>&1 - cp -i /cdrom/config/etc.tar.bz2 $CONFIG_MOUNT/ + if [ -e $CONFIG_MOUNT/etc.tar.bz2 ] ; then + $SUCCESS + echo -e "Found configuration on $CFG_SRC" + $NORMAL DL_CONFIG_SOURCE=$CFG_SRC - continue 2 + if [ -z "$QUIET" ]; then + echo -n "Do you want to use this device?" + if ask_yes_no ; then + continue 2 + else + umount $CONFIG_MOUNT + fi + fi + else + beep; + umount $CONFIG_MOUNT + $SUCCESS + echo -e "\n*** Found empty media $CFG_SRC . ***\n" + $NORMAL + echo -n "Should I copy default configuration to it?" + if ask_yes_no ; then + mount -t auto $CFG_SRC $CONFIG_MOUNT >/dev/null 2>&1 + cp -i /cdrom/config/etc.tar.bz2 $CONFIG_MOUNT/ + DL_CONFIG_SOURCE=$CFG_SRC + continue 2 + fi fi fi - fi + done + beep; sleep 1; beep; sleep 1; beep; + $ERROR + echo -e "Please insert Configuration Media and press 'ENTER'" + $NORMAL + read ANS + echo done umount $CONFIG_MOUNT &> /dev/null @@ -79,7 +103,7 @@ ( cd / ; tar -djf $CONFIG_MOUNT/etc.tar.bz2 etc ) umount $CONFIG_MOUNT - + $FAILURE echo "press the 'anykey' to save the configuration or CTRL+C to quit" $NORMAL |