From b9f81365d2730f2965c22cf42a322f16c8dc3385 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 28 Feb 2008 19:13:36 +0000 Subject: Only reboot when starting in the boot runlevel. --- init.d/fsck | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'init.d/fsck') diff --git a/init.d/fsck b/init.d/fsck index 212d313c..bd40faea 100644 --- a/init.d/fsck +++ b/init.d/fsck @@ -13,10 +13,18 @@ depend() } _abort() { - exec rc-abort; + rc-abort; return 1; } +# We should only reboot when first booting +_reboot() { + if [ "${RC_SOFTLEVEL}" = "${RC_BOOTLEVEL}" ]; then + reboot "$@"; + _abort || return 1;; + fi +} + start() { local reboot_opts= fsck_opts= p= @@ -49,7 +57,7 @@ start() 0) eend 0; return 0;; 1) ewend 1 "Filesystems repaired"; return 0;; 2|3|4) ewend 1 "Filesystems repaired, but reboot needed" - reboot ${reboot_opts}; _abort || return 1;; + _reboot ${reboot_opts} || return 1;; 8) ewend 1 "Operational error"; return 0;; 12) ewend 1 "fsck interupted"; return 1;; *) eend 2 "Filesystems couldn't be fixed" @@ -59,7 +67,9 @@ start() stop() { - _abort() { return 0; } # Fake function so we always shutdown correctly. + # Fake function so we always shutdown correctly. + _abort() { return 0; } + _reboot() { return 0; } yesno "${fsck_shutdown}" && start return 0 -- cgit v1.2.3