diff options
author | Roy Marples <roy@marples.name> | 2008-02-28 19:13:36 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-02-28 19:13:36 +0000 |
commit | b9f81365d2730f2965c22cf42a322f16c8dc3385 (patch) | |
tree | c51d5f20c2487d92ad1c331bdfe91a45e92236df | |
parent | 063563bd4e670622f0a747eeb6cb887487a3d73c (diff) |
Only reboot when starting in the boot runlevel.
-rw-r--r-- | init.d/fsck | 16 |
1 files changed, 13 insertions, 3 deletions
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 |