]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/checkfstab
691050ef036ac13ed43b0fdcc9ccef2e46e347f1
2 ########################################################################
3 # Begin $rc_base/init.d/checkfstab
5 # Description : Check and repair fstab if the drivename has changed
7 # Authors : Arne Fitzenreiter - arne_f@ipfire.org
13 ########################################################################
20 #Skip if root is set by UUID
21 if (grep "root=UUID=" /proc
/cmdline
); then
24 boot_mesg
"Checking fstab bootdevice ..."
25 read CMDLINE
< /proc
/cmdline
26 ROOTPOS
=`expr index "$CMDLINE" root=`
27 NEWROOT
=`echo ${CMDLINE:$ROOTPOS} | cut -d"=" -f2 | cut -d" " -f1`;
28 OLDBOOT
=`cat /etc/fstab | grep -m1 " / " | cut -d" " -f1 | cut -f1`;
29 OLDDRV
=${OLDBOOT::`expr length $OLDBOOT`-1}
30 NEWDRV
=${NEWROOT::`expr length $NEWROOT`-1}
31 if [ "$OLDDRV" == "$NEWDRV" ]; then
36 boot_mesg
"Warning! Bootdrive not match with fstab!"
38 boot_mesg
"Bootdrive: $NEWDRV"
39 boot_mesg
"fstab-entry: $OLDDRV"
41 if [ "${OLDDRV:0:4}" == "UUID" ]; then
42 #Short sleep because the kernel has not finished hardware detections
43 #and made many messages here and the password question is not readable
45 boot_mesg
"${FAILURE}Error OLD Bootdrive is already a UUID. Can't fix."
50 boot_mesg
"Attempt to repair it ..."
52 sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc
/fstab
54 sed -i -e "s|$OLDDRV|$NEWDRV|g" /boot
/grub
/grub.conf
60 echo "Usage: ${0} {start}"
65 # End $rc_base/init.d/checkfstab