From e8fc366397092a249883d2a94c2b52ab2efeaf6b Mon Sep 17 00:00:00 2001 From: Kurt J. Bosch Date: Fri, 19 Mar 2010 17:57:52 +0100 Subject: [PATCH 2/2] Some corrections for shutdown fsck --- functions | 25 +++++++++++++------------ rc.shutdown | 2 +- rc.sysinit | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/functions b/functions index 270a4c7..b6a40d9 100644 --- a/functions +++ b/functions @@ -2,6 +2,9 @@ # initscripts functions # +# Local filesystem types used for fsck and mount +NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs" + # width: STAT_COL=80 @@ -164,31 +167,25 @@ in_array() { return 1 # Not Found } - +# Function for checking filesystems fsck_all() { - FORCEFSCK= - [ -f /forcefsck ] && FORCEFSCK="-- -f" - NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs" - + fsckret=0 if [ -x /sbin/fsck ]; then stat_busy "Checking Filesystems" FSCK_OUT=/dev/stdout FSCK_ERR=/dev/null FSCK_FD= - run_hook sysinit_prefsck + run_hook ${0##*rc.}_prefsck /sbin/fsck -A -T -C$FSCK_FD -a -t $NETFS $FORCEFSCK >$FSCK_OUT 2>$FSCK_ERR - ret=$? - if [ ${ret} -gt 1 ]; then + fsckret=$? + if [ ${fsckret} -gt 1 ]; then stat_fail else stat_done fi - return $ret - else - return 0 + run_hook ${0##*rc.}_postfsck fi } - # daemons: @@ -278,6 +275,10 @@ ck_status() { # shutdown_postkillall: after all processes have been killed in rc.shutdown # single_postkillall: after all processes have been killed in rc.single # shutdown_poweroff: directly before powering off in rc.shutdown +# sysinit_prefsck: directly before fsck -A is run in sysinit +# shutdown_prefsck: directly before fsck -A is run in shutdown +# sysinit_postfsck: after fsck -A was run in sysinit +# shutdown_postfsck after fsck -A was run in shutdown # # Make sure to never override the add_hook and run_hook functions via functions.d diff --git a/rc.shutdown b/rc.shutdown index 7afe8a5..efa781b 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -107,8 +107,8 @@ stat_busy "Remounting Root Filesystem Read-only" stat_done if [ "$SHUTDOWN_FSCK" = "yes" -o "$SHUTDOWN_FSCK" = "YES" ]; then + FORCEFSCK= fsck_all - fsckret=$? if [ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ]; then echo echo "***************** FILESYSTEM CHECK FAILED ****************" diff --git a/rc.sysinit b/rc.sysinit index a9ca4b7..bab5db9 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -220,9 +220,9 @@ fsck_reboot() { exit 0 } +FORCEFSCK= +[ -f /forcefsck ] && FORCEFSCK="-- -f" fsck_all -fsckret=$? -run_hook sysinit_postfsck if [ $((${fsckret}&2)) -eq 2 ]; then echo echo "********************** REBOOT REQUIRED *********************" -- 1.7.0.2