]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame_incremental - src/initscripts/init.d/checkfstab
Load libata prior udev at installer because some SATA doesnt autoload it
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / checkfstab
... / ...
CommitLineData
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/checkfstab
4#
5# Description : Check and repair fstab if the drivename has changed
6#
7# Authors : Arne Fitzenreiter - arne_f@ipfire.org
8#
9# Version : 00.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
18case "${1}" in
19 start)
20 boot_mesg "Checking fstab rootdevice entry ..."
21 ROOTPOS=`expr index "$CMDLINE" root=`
22 NEWROOT=`echo ${CMDLINE:$ROOTPOS} | cut -d"=" -f2 | cut -d" " -f1`;
23 OLDROOT=`cat /etc/fstab | grep -m1 " / " | cut -d" " -f1`;
24 OLDDRV=${OLDROOT::`expr length $OLDROOT`-1}
25 NEWDRV=${NEWROOT::`expr length $NEWROOT`-1}
26 if [ "$OLDROOT" == "$NEWROOT" ]; then
27 echo_ok;
28 exit 0;
29 fi
30 echo_failure;
31 boot_mesg "Warning! Rootdevice not match with fstab entry!"
32 boot_mesg
33 boot_mesg "Rootdevice: $NEWROOT"
34 boot_mesg "fstab-entry: $OLDROOT"
35 boot_mesg
36 boot_mesg "Attempt to repair it ..."
37 mount -o remount,rw /
38 sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc/fstab
39 mount /boot
40 sed -i -e "s|$OLDDRV|$NEWDRV|g" /boot/grub/grub.conf
41 umount /boot
42 echo_ok;
43 exit 0;
44 ;;
45 *)
46 echo "Usage: ${0} {start}"
47 exit 1
48 ;;
49esac
50
51# End $rc_base/init.d/checkfstab