checkfstab: Fix "root=" parsing.
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 25 Nov 2010 13:15:25 +0000 (14:15 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 25 Nov 2010 13:15:25 +0000 (14:15 +0100)
src/initscripts/init.d/checkfstab

index 691050ef036ac13ed43b0fdcc9ccef2e46e347f1..ea845458f826424e0e7340a7487ded7644413851 100644 (file)
 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 "    /       " | cut -d" " -f1 | cut -f1`;
                OLDDRV=${OLDBOOT::`expr length $OLDBOOT`-1}