X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=src%2Finitscripts%2Finit.d%2Fcheckfstab;h=ea845458f826424e0e7340a7487ded7644413851;hp=2fe80bf31db1599c39fa1a913fe7a8f775bc3682;hb=42dbdb2088b7877ad1626d19db47089e07996b37;hpb=3834d135ecb9383995f305cfe4fa18e9c7511495 diff --git a/src/initscripts/init.d/checkfstab b/src/initscripts/init.d/checkfstab index 2fe80bf31..ea845458f 100644 --- a/src/initscripts/init.d/checkfstab +++ b/src/initscripts/init.d/checkfstab @@ -18,14 +18,15 @@ case "${1}" in start) #Skip if root is set by UUID - if (grep "root=UUID=" /proc/cmdline); then + if (grep "root=UUID=" /proc/cmdline > /dev/null); then exit 0; fi boot_mesg "Checking fstab bootdevice ..." read CMDLINE < /proc/cmdline - ROOTPOS=`expr index "$CMDLINE" root=` + ROOTPOS=${CMDLINE%%root=*} + ROOTPOS=${#ROOTPOS} NEWROOT=`echo ${CMDLINE:$ROOTPOS} | cut -d"=" -f2 | cut -d" " -f1`; - OLDBOOT=`cat /etc/fstab | grep -m1 "/boot" | cut -d" " -f1 | cut -f1`; + OLDBOOT=`cat /etc/fstab | grep -m1 " / " | cut -d" " -f1 | cut -f1`; OLDDRV=${OLDBOOT::`expr length $OLDBOOT`-1} NEWDRV=${NEWROOT::`expr length $NEWROOT`-1} if [ "$OLDDRV" == "$NEWDRV" ]; then @@ -38,6 +39,15 @@ case "${1}" in boot_mesg "Bootdrive: $NEWDRV" boot_mesg "fstab-entry: $OLDDRV" boot_mesg + if [ "${OLDDRV:0:4}" == "UUID" ]; then + #Short sleep because the kernel has not finished hardware detections + #and made many messages here and the password question is not readable + sleep 3 + boot_mesg "${FAILURE}Error OLD Bootdrive is already a UUID. Can't fix." + boot_mesg "${NORMAL}" + sulogin + reboot -f + fi boot_mesg "Attempt to repair it ..." mount -o remount,rw / sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc/fstab