checkroot and checkfs now use more friendly generic options, #116016

This commit is contained in:
Roy Marples 2007-04-26 13:07:57 +00:00
parent cf9aa106c6
commit ea2158fe94
3 changed files with 33 additions and 44 deletions

View File

@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts # ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
26 Apr 2007; Roy Marples <uberlord@gentoo.org>:
checkroot and checkfs now use more friendly generic options, #116016.
25 Apr 2007; Roy Marples <uberlord@gentoo.org>: 25 Apr 2007; Roy Marples <uberlord@gentoo.org>:
We now have an alternative to buffering stdout and stderr. We now have an alternative to buffering stdout and stderr.

View File

@ -4,29 +4,30 @@
depend() { depend() {
need checkroot need checkroot
use volumes
after modules after modules
} }
do_checkfs() { do_checkfs() {
local retval=0 local retval=0 mode="-p" opts= parts=
ebegin "Checking all filesystems" ebegin "Checking all filesystems"
if [ "${RC_UNAME}" = "Linux" ] ; then
if get_bootparam "forcefsck" ; then
ewarn "A full fsck has been forced" if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
fsck -C0 -T -R -A -a -f ewarn "A full fsck has been forced"
else mode="-f"
fsck -C0 -T -R -A -a
fi
retval=$?
else
local parts="$(fstabinfo --passno ">1")"
if [ -n "${parts}" ] ; then
fsck -p ${parts}
retval=$?
fi
fi fi
if [ "${RC_UNAME}" = "Linux" ] ; then
opts="-A -C0 -R -T"
else
parts="$(fstabinfo --passno ">1")"
[ -z "${parts}" ] && return 0
fi
fsck ${opts} ${mode} ${parts}
retval=$?
if [ ${retval} -eq 0 ] ; then if [ ${retval} -eq 0 ] ; then
eend 0 eend 0
elif [ ${retval} -eq 1 ] ; then elif [ ${retval} -eq 1 ] ; then
@ -40,13 +41,9 @@ do_checkfs() {
else else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
eend 2 "Fsck could not correct all errors, rerunning" eend 2 "Fsck could not correct all errors, rerunning"
if [ "${RC_UNAME}" = "Linux" ] ; then fsck ${opts} -y ${parts}
fsck -C0 -T -R -A -y
else
fsck -y
fi
retval=$? retval=$?
eend $? eend ${retval}
fi fi
if [ ${retval} -gt 3 ] ; then if [ ${retval} -gt 3 ] ; then
@ -54,7 +51,9 @@ do_checkfs() {
exec rc-abort || exit 1 exec rc-abort || exit 1
fi fi
fi fi
[ ${retval} = 0 -a -e /forcefsck ] && rm /forcefsck
return ${retval} return ${retval}
} }

View File

@ -32,7 +32,8 @@ do_mtab() {
} }
start() { start() {
local retval=0 local retval=0 opts="-F"
[ "${RC_UNAME}" = "Linux" ] && opts="-T -C0"
# Don't bother doing a fsck on these # Don't bother doing a fsck on these
if [ -n "${CDBOOT}" ] || is_net_fs / || is_union_fs / ; then if [ -n "${CDBOOT}" ] || is_net_fs / || is_union_fs / ; then
@ -45,29 +46,18 @@ start() {
return 0 return 0
fi fi
if get_bootparam "forcefsck" ; then if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
ebegin "Checking root filesystem (full fsck forced)" ebegin "Checking root filesystem (full fsck forced)"
if [ "${RC_UNAME}" = "Linux" ] ; then fsck ${opts} -f /
fsck -C -a -f /
else
fsck -F /
fi
# /forcefsck isn't deleted because checkfs needs it. # /forcefsck isn't deleted because checkfs needs it.
# it'll be deleted in that script. # it'll be deleted in that script.
retval=$? retval=$?
else else
# Obey the fs_passno setting for / (see fstab(5)) # 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 /) local pass=$(fstabinfo --passno /)
if [ ${pass:-0} != "0" ] ; then if [ ${pass:-0} != "0" ] ; then
ebegin "Checking root filesystem" ebegin "Checking root filesystem"
if [ "${RC_UNAME}" = "Linux" ] ; then fsck ${opts} -p /
fsck -C -T -a /
else
fsck -p -F /
fi
retval=$? retval=$?
else else
ebegin "Skipping root filesystem check" "(fstab's passno == 0)" ebegin "Skipping root filesystem check" "(fstab's passno == 0)"
@ -92,15 +82,11 @@ start() {
sleep 10 sleep 10
fi fi
einfo "Rebooting" einfo "Rebooting"
/sbin/reboot -f reboot -f
else else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
eend 2 "Rerunning fsck in force mode" eend 2 "Rerunning fsck in force mode"
if [ "${RC_UNAME}" = "Linux" ] ; then fsck ${opts} -y /
fsck -y -C -T /
else
fsck -y /
fi
retval=$? retval=$?
else else
eend 2 "Filesystem couldn't be fixed :(" eend 2 "Filesystem couldn't be fixed :("