diff options
Diffstat (limited to 'init.d/checkfs')
-rwxr-xr-x | init.d/checkfs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/init.d/checkfs b/init.d/checkfs new file mode 100755 index 0000000..b5b442c --- /dev/null +++ b/init.d/checkfs @@ -0,0 +1,50 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need checkroot modules +} + +start() { + local retval=0 + + # Setup dm-crypt mappings if any + start_addon dm-crypt + + if [[ -f /fastboot ]] || [[ -n ${CDBOOT} ]] || is_vps_sys ; then + rm -f /fastboot + else + ebegin "Checking all filesystems" + if [[ -f /forcefsck ]] ; then + ewarn "A full fsck has been forced" + fsck -C -T -R -A -a -f + retval=$? + rm -f /forcefsck + else + fsck -C -T -R -A -a + retval=$? + fi + if [[ ${retval} -eq 0 ]] ; then + eend 0 + elif [[ ${retval} -ge 1 && ${retval} -le 3 ]] ; then + ewend 1 "Filesystem errors corrected." + # Everything should be ok, so return a pass + return 0 + else + if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then + eend 2 "Fsck could not correct all errors, rerunning" + fsck -C -T -R -A -y + retval=$? + fi + + if [[ ${retval} -gt 3 ]] ; then + eend 2 "Fsck could not correct all errors, manual repair needed" + /sbin/sulogin ${CONSOLE} + fi + fi + fi +} + + +# vim:ts=4 |