aboutsummaryrefslogtreecommitdiff
path: root/init.d/checkfs
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-31 13:19:04 +0000
committerRoy Marples <roy@marples.name>2008-01-31 13:19:04 +0000
commitb6b88d3a07a921de7450a529769a02f0b86cb7db (patch)
treea8866139c77115d9b7a121559548ad1f8559e96e /init.d/checkfs
parent9300fa240d40b563034752f34860e418f044e738 (diff)
fsck -A isn't all that portable, so just use one codepath.
Diffstat (limited to 'init.d/checkfs')
-rwxr-xr-xinit.d/checkfs30
1 files changed, 17 insertions, 13 deletions
diff --git a/init.d/checkfs b/init.d/checkfs
index 31982c88..4f8004db 100755
--- a/init.d/checkfs
+++ b/init.d/checkfs
@@ -5,6 +5,10 @@
description="Check filesystems according to /etc/fstab for errors and \
optionally repair them."
+# Hard return to parse fstabinfo output
+_IFS="
+"
+
depend()
{
need checkroot
@@ -14,23 +18,23 @@ depend()
do_checkfs()
{
- local retval=0 mode="-p" opts= parts=
-
+ local retval=0 opts=
+ [ "${RC_UNAME}" = "Linux" ] && opts="-C0 -T"
+
ebegin "Checking all filesystems"
- if [ "${RC_UNAME}" = "Linux" ]; then
- opts="-A -C0 -R -T"
- else
- parts="$(fstabinfo --passno ">1")"
- if [ -z "${parts}" ]; then
- eend 0
- return 0
- fi
+ # Load our partitions into $@
+ local IFS="$_IFS"
+ set -- $(fstabinfo --passno ">1")
+ unset IFS
+ if [ $# = 0 ]; then
+ eend 0
+ return 0
fi
- fsck ${opts} ${mode} ${parts}
+ fsck -p ${opts} "$@"
retval=$?
-
+
if [ ${retval} -eq 0 ]; then
eend 0
elif [ ${retval} -eq 1 ]; then
@@ -44,7 +48,7 @@ do_checkfs()
else
if yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
eend 2 "Fsck could not correct all errors, rerunning"
- fsck ${opts} -y ${parts}
+ fsck -y ${opts} "$@"
retval=$?
eend ${retval}
fi