diff -Nur init.d/checkfs.sh init.d.new/checkfs.sh --- init.d/checkfs.sh 2008-08-12 14:50:47.000000000 +0200 +++ init.d.new/checkfs.sh 2009-04-01 23:03:41.000000000 +0200 @@ -19,6 +19,8 @@ . /lib/lsb/init-functions . /lib/init/splash-functions-base +CHECK_ON_HALT=yes + do_start () { # See if we're on AC Power. If not, we're not gonna run our # check. If on_ac_power (in /usr/) is unavailable, behave as @@ -77,14 +79,19 @@ if [ "$VERBOSE" = no ] then log_action_begin_msg "Checking file systems" - logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT - FSCKCODE=$? - if [ "$FSCKCODE" -gt 1 ] + if [ "$CHECK_ON_HALT" = "yes" ] then - log_action_end_msg 1 "code $FSCKCODE" - handle_failed_fsck + echo "fsck $spinner -R -A $fix $force $FSCKTYPES_OPT" >/fsck_halt else - log_action_end_msg 0 + logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT + FSCKCODE=$? + if [ "$FSCKCODE" -gt 1 ] + then + log_action_end_msg 1 "code $FSCKCODE" + handle_failed_fsck + else + log_action_end_msg 0 + fi fi else if [ "$FSCKTYPES" ] @@ -93,14 +100,19 @@ else log_action_msg "Will now check all file systems" fi - logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT - FSCKCODE=$? - if [ "$FSCKCODE" -gt 1 ] + if [ "$CHECK_ON_HALT" = "yes" ] then - handle_failed_fsck + echo "fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT" > /fsck_halt else - log_success_msg "Done checking file systems. -A log is being saved in ${FSCK_LOGFILE} if that location is writable." + logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT + FSCKCODE=$? + if [ "$FSCKCODE" -gt 1 ] + then + handle_failed_fsck + else + log_success_msg "Done checking file systems. + A log is being saved in ${FSCK_LOGFILE} if that location is writable." + fi fi fi splash_stop_indefinite diff -Nur init.d/checkroot.sh init.d.new/checkroot.sh --- init.d/checkroot.sh 2007-12-30 16:45:44.000000000 +0100 +++ init.d.new/checkroot.sh 2009-04-01 23:02:48.000000000 +0200 @@ -22,6 +22,8 @@ . /lib/init/mount-functions.sh . /lib/init/splash-functions-base +CHECK_ON_HALT=yes + do_start () { # # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to @@ -206,7 +208,7 @@ # See if we want to check the root file system. # FSCKCODE=0 - if [ -f /fastboot ] + if [ -f /fastboot -o "$CHECK_ON_HALT" = "yes" ] then [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check." rootcheck=no @@ -380,7 +382,7 @@ # # Remove /lib/init/rw/rootdev if we created it. # - rm -f /lib/init/rw/rootdev + rm -f /lib/init/rw/rootdev /fsck_halt } case "$1" in diff -Nur init.d/chkfshalt.sh init.d.new/chkfshalt.sh --- init.d/chkfshalt.sh 1970-01-01 01:00:00.000000000 +0100 +++ init.d.new/chkfshalt.sh 2009-04-01 23:17:03.000000000 +0200 @@ -0,0 +1,51 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: checkfshalt +# Required-Start: +# Required-Stop: umountroot +# Should-Start: +# Default-Start: S +# Default-Stop: +# Short-Description: Check all filesystems on halt. +### END INIT INFO + +# Include /usr/bin in path to find on_ac_power if /usr/ is on the root +# partition. +PATH=/sbin:/bin:/usr/bin +FSCK_LOGFILE=/var/log/fsck/checkfs +[ "$FSCKFIX" ] || FSCKFIX=no +. /lib/init/vars.sh + +. /lib/lsb/init-functions +. /lib/init/splash-functions-base + +CHECK_ON_HALT=yes + +do_stop () { + if [ -f /fsck_halt ] + then + echo "Checking Filesystem" + . /fsck_halt + echo "Done checking" + read + fi +} + +case "$1" in + start|"") + # No-op + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop) + do_stop + ;; + *) + echo "Usage: checkfs.sh [start|stop]" >&2 + exit 3 + ;; +esac + +: