aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorPetar Bogdanovic <petar@smokva.net>2009-02-10 08:27:07 -0800
committerAaron Griffin <aaronmgriffin@gmail.com>2009-02-10 08:27:07 -0800
commite932c3406acf105c99e159ca0610768fbfb49b1a (patch)
tree7c83e7eea1ed7dcabc9d4b738a1cf0afb91a2a7d /rc.sysinit
parent2c5e306be0bcc8d91662176bfcfb55ec95777bc3 (diff)
downloadinitscripts-e932c3406acf105c99e159ca0610768fbfb49b1a.tar.xz
Allow the user to cancel an fsck
Don't fail and force a reboot if the user cancels an fsck on boot. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit69
1 files changed, 39 insertions, 30 deletions
diff --git a/rc.sysinit b/rc.sysinit
index e7eed68..7f22e88 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -242,44 +242,53 @@ FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk"
+fsck_reboot() {
+ echo "Automatic reboot in progress..."
+ /bin/umount -a
+ /bin/mount -n -o remount,ro /
+ /sbin/reboot -f
+ exit 0
+}
+
if [ -x /sbin/fsck ]; then
stat_busy "Checking Filesystems"
if /bin/grep -qw quiet /proc/cmdline; then
- /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK >/dev/null 2>&1
+ FSCK_OUT=/dev/null
+ FSCK_ERR=/dev/null
else
- /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK 2>/dev/null
+ FSCK_OUT=/dev/stdout
+ FSCK_ERR=/dev/null
fi
+ /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK >$FSCK_OUT 2>$FSCK_ERR
fsckret=$?
if [ ${fsckret} -gt 1 ]; then
stat_fail
- if [ $((${fsckret}&2)) -eq 2 ]; then
- echo
- echo "********************** REBOOT REQUIRED *********************"
- echo "* *"
- echo "* The system will be rebooted automatically in 15 seconds. *"
- echo "* *"
- echo "************************************************************"
- echo
- /bin/sleep 15
- else
- echo
- echo "***************** FILESYSTEM CHECK FAILED ****************"
- echo "* *"
- echo "* Please repair manually and reboot. Note that the root *"
- echo "* file system is currently mounted read-only. To remount *"
- echo "* it read-write type: mount -n -o remount,rw / *"
- echo "* When you exit the maintenance shell the system will *"
- echo "* reboot automatically. *"
- echo "* *"
- echo "************************************************************"
- echo
- /sbin/sulogin -p
- fi
- echo "Automatic reboot in progress..."
- /bin/umount -a
- /bin/mount -n -o remount,ro /
- /sbin/reboot -f
- exit 0
+ fi
+ if [ $((${fsckret}&2)) -eq 2 ]; then
+ echo
+ echo "********************** REBOOT REQUIRED *********************"
+ echo "* *"
+ echo "* The system will be rebooted automatically in 15 seconds. *"
+ echo "* *"
+ echo "************************************************************"
+ echo
+ /bin/sleep 15
+ fsck_reboot
+ fi
+ if [ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ]; then
+ echo
+ echo "***************** FILESYSTEM CHECK FAILED ****************"
+ echo "* *"
+ echo "* Please repair manually and reboot. Note that the root *"
+ echo "* file system is currently mounted read-only. To remount *"
+ echo "* it read-write type: mount -n -o remount,rw / *"
+ echo "* When you exit the maintenance shell the system will *"
+ echo "* reboot automatically. *"
+ echo "* *"
+ echo "************************************************************"
+ echo
+ /sbin/sulogin -p
+ fsck_reboot
fi
stat_done
fi