Change hardcoded ROOT_FS to $ROOT_LBL where its used. This preps to change the root-label to VOYAGE_FS, which provides some certainty that the correct right device and partition are identified. This certainty allows safer automation of partition formatting, unmounting before formatting etc, possibly with less "Are you SURE ?" questions.
This patch requires that $ROOT_LBL is set, but doesnt set it (yet), testing it gives some assurance that errors are detected and problems are avoided: Ready to go .... Fatal Error: ROOT_LBL not set, in /home/jimc/projects/voyage/voyage-current/usr/local/sbin/format-cf.sh, quitting Fatal Error: ROOT_LBL not set, in /home/jimc/projects/voyage/voyage-current/usr/local/sbin/copyfiles.sh, quitting The 3rd patchsite (setboot.sh) is not testable ATM, since the above 2 terminate the installer before its reached. The next patch adds ROOT_LBL=VOYAGE_FS in a single place. Signed-off-by: Jim Cromie <[email protected]> --- usr/local/sbin/copyfiles.sh | 8 ++++++-- usr/local/sbin/format-cf.sh | 6 +++++- usr/local/sbin/setboot.sh | 10 +++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/usr/local/sbin/copyfiles.sh b/usr/local/sbin/copyfiles.sh index 1eab990..b8e73b7 100755 --- a/usr/local/sbin/copyfiles.sh +++ b/usr/local/sbin/copyfiles.sh @@ -32,6 +32,10 @@ fi source $EXECDIR/update-config.sh +if [ -z $ROOT_LBL ] ; then + err_quit "ROOT_LBL not set, in $0, quitting" +fi + # We assume that none of the target files are currently mounted. Just to # make sure, we check and force the user to restart if this isn't true. exitflag=0 @@ -57,8 +61,8 @@ fi mount $TARGET_DISK$TARGET_PART $TARGET_MOUNT || \ err_quit "Failed to mount $TARGET_DISK$TARGET_PART on $TARGET_MOUNT. " -# Mount Ok - Parition correct now set label to ROOT_FS -e2label $TARGET_DISK$TARGET_PART ROOT_FS +# Mount Ok - Partition correct, now set ext2 label to VOYAGE_FS +e2label $TARGET_DISK$TARGET_PART $ROOT_LBL # We are going to use rsync to copy files from the distribution to the # target. In order to minimise any flash writing, we first figure out diff --git a/usr/local/sbin/format-cf.sh b/usr/local/sbin/format-cf.sh index f94812c..2fa9f0c 100755 --- a/usr/local/sbin/format-cf.sh +++ b/usr/local/sbin/format-cf.sh @@ -5,6 +5,10 @@ TARGET_PART="" SYSTEM_BOOT="1" DONT_ASK="0" +if [ -z $ROOT_LBL ] ; then + err_quit "ROOT_LBL not set, in $0, quitting" +fi + # no here-document here. # this may be called from a read-only (live) file system # where the mandatory tmp file for here-douments can't be @@ -90,5 +94,5 @@ esac sleep 1 [ -b "$TARGET_PART" ] && { mkfs.ext2 $TARGET_PART - tune2fs -i 0 -c 0 $TARGET_PART -L ROOT_FS + tune2fs -i 0 -c 0 $TARGET_PART -L $ROOT_LBL } diff --git a/usr/local/sbin/setboot.sh b/usr/local/sbin/setboot.sh index 328e999..a3ca0f0 100755 --- a/usr/local/sbin/setboot.sh +++ b/usr/local/sbin/setboot.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [ -z $ROOT_LBL ] ; then + err_quit "ROOT_LBL not set, in $0, quitting" +fi + if [ ! "${HAVESCRIPTUTILS:+present}" ]; then echo "This script must be run under voyage.update" >&2 exit @@ -50,13 +54,13 @@ image=/vmlinuz label=Linux $version initrd=/initrd.img read-only - append="root=LABEL=ROOT_FS ${serapp}reboot=bios" ${BOOTARGS}" + append="root=LABEL=$ROOT_LBL ${serapp}reboot=bios" ${BOOTARGS}" image=/vmlinuz.old label=LinuxOLD initrd=/initrd.img.old read-only - append="root=LABEL=ROOT_FS ${serapp}reboot=bios" ${BOOTARGS}" + append="root=LABEL=$ROOT_LBL ${serapp}reboot=bios" ${BOOTARGS}" optional EOM sed -e "/disk =/d;/bios =/d" -e "s#${TARGET_DISK}#/dev/hda#" \ @@ -197,7 +201,7 @@ EOM title Voyage Linux $version root (hd0,$(($TARGET_PART-1))) -kernel /vmlinuz root=LABEL=ROOT_FS ${console} ${BOOTARGS} +kernel /vmlinuz root=LABEL=$ROOT_LBL ${console} ${BOOTARGS} ${VOYAGE_INITRD} EOM -- 1.7.11.4 _______________________________________________ Voyage-linux mailing list [email protected] http://list.voyage.hk/mailman/listinfo/voyage-linux
