mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 11:05:54 +02:00
Add checkfstab (repair fstab and grup.conf if the rootdevice has changed)
This commit is contained in:
@@ -9,6 +9,7 @@ etc/rc.d/init.d/apache
|
||||
#etc/rc.d/init.d/applejuice
|
||||
etc/rc.d/init.d/beep
|
||||
etc/rc.d/init.d/checkfs
|
||||
etc/rc.d/init.d/checkfstab
|
||||
#etc/rc.d/init.d/clamav
|
||||
etc/rc.d/init.d/cleanfs
|
||||
etc/rc.d/init.d/connectd
|
||||
@@ -123,6 +124,7 @@ etc/rc.d/rc6.d/S99reboot
|
||||
etc/rc.d/rcsysinit.d/S00mountkernfs
|
||||
etc/rc.d/rcsysinit.d/S05modules
|
||||
etc/rc.d/rcsysinit.d/S10udev
|
||||
etc/rc.d/rcsysinit.d/S19checkfstab
|
||||
etc/rc.d/rcsysinit.d/S20swap
|
||||
etc/rc.d/rcsysinit.d/S30checkfs
|
||||
etc/rc.d/rcsysinit.d/S40mountfs
|
||||
|
||||
@@ -19,3 +19,5 @@ bin/ntfs-3g
|
||||
lib/libntfs-3g.so
|
||||
lib/libntfs-3g.so.31
|
||||
lib/libntfs-3g.so.31.0.0
|
||||
etc/rc.d/init.d/checkfstab
|
||||
etc/rc.d/rcsysinit.d/S19checkfstab
|
||||
|
||||
@@ -126,6 +126,7 @@ $(TARGET) :
|
||||
ln -sf ../init.d/mountkernfs /etc/rc.d/rcsysinit.d/S00mountkernfs
|
||||
ln -sf ../init.d/modules /etc/rc.d/rcsysinit.d/S05modules
|
||||
ln -sf ../init.d/udev /etc/rc.d/rcsysinit.d/S10udev
|
||||
ln -sf ../init.d/checkfstab /etc/rc.d/rcsysinit.d/S19checkfstab
|
||||
ln -sf ../init.d/swap /etc/rc.d/rcsysinit.d/S20swap
|
||||
ln -sf ../init.d/checkfs /etc/rc.d/rcsysinit.d/S30checkfs
|
||||
ln -sf ../init.d/mountfs /etc/rc.d/rcsysinit.d/S40mountfs
|
||||
|
||||
50
src/initscripts/init.d/checkfstab
Normal file
50
src/initscripts/init.d/checkfstab
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/checkfstab
|
||||
#
|
||||
# Description : Check and repair fstab if the drivename has changed
|
||||
#
|
||||
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
|
||||
#
|
||||
# Version : 00.00
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
boot_mesg "Checking fstab rootdevice entry ..."
|
||||
OLDROOT=`cat /etc/fstab | grep " / " | cut -d" " -f1`;
|
||||
NEWROOT=`df | grep " /$" -m1 | cut -d" " -f1`;
|
||||
OLDDRV=${OLDROOT::`expr length $OLDROOT`-1}
|
||||
NEWDRV=${NEWROOT::`expr length $NEWROOT`-1}
|
||||
if [ "$OLDROOT" == "$NEWROOT" ]; then
|
||||
echo_ok;
|
||||
exit 0;
|
||||
fi
|
||||
echo_failure;
|
||||
boot_mesg "Warning! Rootdevice not match with fstab entry!"
|
||||
boot_mesg
|
||||
boot_mesg "Rootdevice: $NEWROOT"
|
||||
boot_mesg "fstab-entry: $OLDROOT"
|
||||
boot_mesg
|
||||
boot_mesg "Attempt to repair it ..."
|
||||
mount -o remount,rw /
|
||||
sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc/fstab
|
||||
mount /boot
|
||||
sed -i -e "s|$OLDDRV|$NEWDRV|g" /boot/grub/grub.conf
|
||||
umount /boot
|
||||
echo_ok;
|
||||
exit 0;
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ${0} {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/checkfstab
|
||||
Reference in New Issue
Block a user