/[baselayout]/trunk/init.d/checkfs
Gentoo

Contents of /trunk/init.d/checkfs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2763 - (show annotations) (download)
Tue Jul 10 19:09:41 2007 UTC (7 years, 5 months ago) by uberlord
File size: 1493 byte(s)
init scripts and their extra options can now have descriptions, #184327.
1 #!/sbin/runscript
2 # Copyright 1999-2007 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 description="Check filesystems according to /etc/fstab for errors and \
6 optionally repair them."
7
8 depend() {
9 need checkroot
10 after modules
11 }
12
13 do_checkfs() {
14 local retval=0 mode="-p" opts= parts=
15
16 ebegin "Checking all filesystems"
17
18
19 if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
20 ewarn "A full fsck has been forced"
21 mode="-f -n"
22 fi
23
24 if [ "${RC_UNAME}" = "Linux" ] ; then
25 opts="-A -C0 -R -T"
26 else
27 parts="$(fstabinfo --passno ">1")"
28 [ -z "${parts}" ] && return 0
29 fi
30
31 fsck ${opts} ${mode} ${parts}
32 retval=$?
33
34 if [ ${retval} -eq 0 ] ; then
35 eend 0
36 elif [ ${retval} -eq 1 ] ; then
37 ewend 1 "Filesystem errors corrected."
38 retval=0
39 elif [ ${retval} -eq 2 ] ; then
40 ewend 1 "System should be rebooted"
41 elif [ ${retval} -eq 8 ] ; then
42 ewend 1 "Operational error, continuing"
43 retval=0
44 else
45 if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
46 eend 2 "Fsck could not correct all errors, rerunning"
47 fsck ${opts} -y ${parts}
48 retval=$?
49 eend ${retval}
50 fi
51
52 if [ ${retval} -gt 3 ] ; then
53 eend 2 "Fsck could not correct all errors, manual repair needed"
54 exec rc-abort || exit 1
55 fi
56 fi
57
58 [ ${retval} = 0 -a -e /forcefsck ] && rm /forcefsck
59
60 return ${retval}
61 }
62
63 start() {
64 do_checkfs
65 }
66
67 stop() {
68 # fsck on shutdown if we need to
69 [ "${FSCK_SHUTDOWN}" = "yes" -a ! -f /forcefsck ] && do_checkfs
70 return 0
71 }
72
73 # vim: set ts=4 :

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20