|
From: Serge L. <sma...@us...> - 2005-11-10 10:43:31
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18171/scripts/scripts Modified Files: save-config Log Message: - added attempt to mount a configuration media with custom fs type if "-t auto" failed Index: save-config =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/save-config,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- save-config 6 Sep 2004 20:31:34 -0000 1.30 +++ save-config 10 Nov 2005 10:43:15 -0000 1.31 @@ -11,6 +11,7 @@ #include functions source /etc/init.d/functions +source /etc/sysconfig/config QUIET="" DL_CONFIG_SOURCE="" @@ -109,7 +110,36 @@ for CFG_SRC in $CONFIG_SRC_LIST do echo -e "Checking $CFG_SRC" - if mount -n -o ro,noatime -t auto $CFG_SRC $CONFIG_MOUNT >/dev/null 2>&1 ; then + if mount -n -o ro,noatime -t auto $CFG_SRC $CONFIG_MOUNT > /dev/null 2>&1 ; then + + if [ -e "$CONFIG_MOUNT/$DL_CONFIG_FILE" ] ; then + umount $CONFIG_MOUNT + $SUCCESS + echo -e "Found configuration on $CFG_SRC" + $NORMAL + if [ -z "$QUIET" ]; then + echo -n "Do you want to use this device?" + if ask_yes_no ; then + DL_CONFIG_SOURCE=$CFG_SRC + continue 2 + fi + else + DL_CONFIG_SOURCE=$CFG_SRC + continue 2 + fi + else + beep; + umount $CONFIG_MOUNT + $SUCCESS + echo -e "\n*** Found empty media $CFG_SRC . ***\n" + $NORMAL + echo -n "Do you want to save your configuration to this device?" + if ask_yes_no ; then + DL_CONFIG_SOURCE=$CFG_SRC + continue 2 + fi + fi + elif mount -n -o ro,noatime -t $FS_TYPE $CFG_SRC $CONFIG_MOUNT > /dev/null 2>&1 ; then if [ -e "$CONFIG_MOUNT/$DL_CONFIG_FILE" ] ; then umount $CONFIG_MOUNT @@ -156,7 +186,23 @@ until [ -e $CONFIG_MOUNT/$DL_CONFIG_FILE ] ; do # if mount $DL_CONFIG_SOURCE $CONFIG_MOUNT 2>&1 >/dev/null ; then - if mount -o ro,noatime $DL_CONFIG_SOURCE $CONFIG_MOUNT ; then + if mount -o ro,noatime $DL_CONFIG_SOURCE $CONFIG_MOUNT > /dev/null 2>&1; then + if [ -e $CONFIG_MOUNT/$DL_CONFIG_FILE ] ; then + $YELLOW + echo "Updating file on device..." + $NORMAL + break + else + # why should we require it exist? If the user + # wants it elsewhere let them say so. + # maybe the wanted to make a copy of a tesy config + # on a new diskette? + $YELLOW + echo "Creating new file on device..." + $NORMAL + break + fi + elif mount -o ro,noatime -t $FS_TYPE $DL_CONFIG_SOURCE $CONFIG_MOUNT > /dev/null 2>&1 ; then if [ -e $CONFIG_MOUNT/$DL_CONFIG_FILE ] ; then $YELLOW echo "Updating file on device..." @@ -201,8 +247,11 @@ umount $CONFIG_MOUNT &> /dev/null # mount RO at first to avoid mount error if config is on same device as ISO -mount -o ro,noatime -t auto $DL_CONFIG_SOURCE $CONFIG_MOUNT -mount -o remount,rw,noatime $CONFIG_MOUNT +if mount -o ro,noatime -t auto $DL_CONFIG_SOURCE $CONFIG_MOUNT > /dev/null 2>&1; then + mount -o remount,rw,noatime $CONFIG_MOUNT +elif mount -o ro,noatime -t $FS_TYPE $DL_CONFIG_SOURCE $CONFIG_MOUNT > /dev/null 2>&1; then + mount -o remount,rw,noatime $CONFIG_MOUNT +fi $SUCCESS echo "Saving current configuration" |