]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/checkfstab
c9fa2bc75130f344c0af16d96740e62eab77b8bd
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 boot_mesg
"Checking fstab bootdevice ..."
21 read CMDLINE
< /proc
/cmdline
22 ROOTPOS
=`expr index "$CMDLINE" root=`
23 NEWROOT
=`echo ${CMDLINE:$ROOTPOS} | cut -d"=" -f2 | cut -d" " -f1`;
24 OLDBOOT
=`cat /etc/fstab | grep -m1 "/boot" | cut -d" " -f1 | cut -f1`;
25 OLDDRV
=${OLDBOOT::`expr length $OLDBOOT`-1}
26 NEWDRV
=${NEWROOT::`expr length $NEWROOT`-1}
27 if [ "$OLDDRV" == "$NEWDRV" ]; then
32 boot_mesg
"Warning! Bootdrive not match with fstab!"
34 boot_mesg
"Bootdrive: $NEWDRV"
35 boot_mesg
"fstab-entry: $OLDDRV"
37 boot_mesg
"Attempt to repair it ..."
39 sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc
/fstab
41 sed -i -e "s|$OLDDRV|$NEWDRV|g" /boot
/grub
/grub.conf
47 echo "Usage: ${0} {start}"
52 # End $rc_base/init.d/checkfstab