aboutsummaryrefslogtreecommitdiff
path: root/init.d/fsck
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-31 16:10:18 +0000
committerRoy Marples <roy@marples.name>2008-01-31 16:10:18 +0000
commite687cc1e79f95c3fb69ed895e5666e434c1a3519 (patch)
tree18d356cdeadf6ca0a1511eebf744c158cc95c935 /init.d/fsck
parentb6b88d3a07a921de7450a529769a02f0b86cb7db (diff)
Remove the over-engineered checkfs and checkroot scripts and replace with simple fsck, root and mtab scripts. Update dependencies accordingly.
Diffstat (limited to 'init.d/fsck')
-rw-r--r--init.d/fsck37
1 files changed, 37 insertions, 0 deletions
diff --git a/init.d/fsck b/init.d/fsck
new file mode 100644
index 00000000..01c92a69
--- /dev/null
+++ b/init.d/fsck
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# Copyright 2007-2008 Roy Marples <roy@marples.name>
+# All rights reserved. Released under the 2-clause BSD license.
+
+description="Check and repair filesystems according to /etc/fstab"
+
+depend()
+{
+ need swap
+ after clock modules
+ keywords notimeout
+}
+
+start()
+{
+ local retval=0 opts= root=
+ if [ "${RC_UNAME}" = "Linux" ]; then
+ opts="${opts} -A -C0 -T"
+ if echo 2>/dev/null >/.test.$$; then
+ rm -f /.test.$$
+ opts="${opts} -R"
+ fi
+ fi
+
+ ebegin "Checking local filesystems"
+ fsck -p ${opts}
+ case $? in
+ 0) eend 0; return 0;;
+ 1) ewend 1 "Filesystems repaired"; return 0;;
+ 2|4) ewend 1 "Filesystems repaired, but reboot needed"
+ reboot; exec rc-abort; return 1;;
+ 8) ewend 1 "Operational error"; return 0;;
+ 12) ewend 1 "fsck interupted"; return 1;;
+ *) eend 2 "Filesystems couldn't be fixed"
+ exec rc-abort; return 1;;
+ esac
+}