summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-26 13:07:57 +0000
committerRoy Marples <roy@marples.name>2007-04-26 13:07:57 +0000
commitea2158fe9417015978fb91304ced04810afa9afd (patch)
treeaa5ce5e33a622f0a45b431966154318f9e1e9891 /init.d
parentcf9aa106c615211abc642fc596c98a39d072dd5b (diff)
downloadopenrc-ea2158fe9417015978fb91304ced04810afa9afd.tar.gz
openrc-ea2158fe9417015978fb91304ced04810afa9afd.tar.bz2
openrc-ea2158fe9417015978fb91304ced04810afa9afd.tar.xz
checkroot and checkfs now use more friendly generic options, #116016
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/checkfs41
-rwxr-xr-xinit.d/checkroot28
2 files changed, 27 insertions, 42 deletions
diff --git a/init.d/checkfs b/init.d/checkfs
index 7531ab7..4548493 100755
--- a/init.d/checkfs
+++ b/init.d/checkfs
@@ -4,29 +4,30 @@
depend() {
need checkroot
- use volumes
after modules
}
do_checkfs() {
- local retval=0
+ local retval=0 mode="-p" opts= parts=
ebegin "Checking all filesystems"
+
+
+ if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
+ ewarn "A full fsck has been forced"
+ mode="-f"
+ fi
+
if [ "${RC_UNAME}" = "Linux" ] ; then
- if get_bootparam "forcefsck" ; then
- ewarn "A full fsck has been forced"
- fsck -C0 -T -R -A -a -f
- else
- fsck -C0 -T -R -A -a
- fi
- retval=$?
+ opts="-A -C0 -R -T"
else
- local parts="$(fstabinfo --passno ">1")"
- if [ -n "${parts}" ] ; then
- fsck -p ${parts}
- retval=$?
- fi
+ parts="$(fstabinfo --passno ">1")"
+ [ -z "${parts}" ] && return 0
fi
+
+ fsck ${opts} ${mode} ${parts}
+ retval=$?
+
if [ ${retval} -eq 0 ] ; then
eend 0
elif [ ${retval} -eq 1 ] ; then
@@ -40,13 +41,9 @@ do_checkfs() {
else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
eend 2 "Fsck could not correct all errors, rerunning"
- if [ "${RC_UNAME}" = "Linux" ] ; then
- fsck -C0 -T -R -A -y
- else
- fsck -y
- fi
+ fsck ${opts} -y ${parts}
retval=$?
- eend $?
+ eend ${retval}
fi
if [ ${retval} -gt 3 ] ; then
@@ -54,7 +51,9 @@ do_checkfs() {
exec rc-abort || exit 1
fi
fi
-
+
+ [ ${retval} = 0 -a -e /forcefsck ] && rm /forcefsck
+
return ${retval}
}
diff --git a/init.d/checkroot b/init.d/checkroot
index 2b3c0de..a369fe5 100755
--- a/init.d/checkroot
+++ b/init.d/checkroot
@@ -32,7 +32,8 @@ do_mtab() {
}
start() {
- local retval=0
+ local retval=0 opts="-F"
+ [ "${RC_UNAME}" = "Linux" ] && opts="-T -C0"
# Don't bother doing a fsck on these
if [ -n "${CDBOOT}" ] || is_net_fs / || is_union_fs / ; then
@@ -45,29 +46,18 @@ start() {
return 0
fi
- if get_bootparam "forcefsck" ; then
+ if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
ebegin "Checking root filesystem (full fsck forced)"
- if [ "${RC_UNAME}" = "Linux" ] ; then
- fsck -C -a -f /
- else
- fsck -F /
- fi
+ fsck ${opts} -f /
# /forcefsck isn't deleted because checkfs needs it.
# it'll be deleted in that script.
retval=$?
else
# Obey the fs_passno setting for / (see fstab(5))
- # - find the / entry
- # - make sure we have 6 fields
- # - see if fs_passno is something other than 0
local pass=$(fstabinfo --passno /)
if [ ${pass:-0} != "0" ] ; then
ebegin "Checking root filesystem"
- if [ "${RC_UNAME}" = "Linux" ] ; then
- fsck -C -T -a /
- else
- fsck -p -F /
- fi
+ fsck ${opts} -p /
retval=$?
else
ebegin "Skipping root filesystem check" "(fstab's passno == 0)"
@@ -92,15 +82,11 @@ start() {
sleep 10
fi
einfo "Rebooting"
- /sbin/reboot -f
+ reboot -f
else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
eend 2 "Rerunning fsck in force mode"
- if [ "${RC_UNAME}" = "Linux" ] ; then
- fsck -y -C -T /
- else
- fsck -y /
- fi
+ fsck ${opts} -y /
retval=$?
else
eend 2 "Filesystem couldn't be fixed :("