summaryrefslogtreecommitdiff
blob: dbdfd0ac53414a8ea1050f02bb485bacb3ef09bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need checkroot modules
}

start() {
	local retval=0

	# Start RAID/LVM/EVMS/DM volumes for /usr, /var, etc.
	# NOTE: this should be done *before* mounting anything
	[[ -z ${CDBOOT} ]] && start_volumes

	# Setup dm-crypt mappings if any
	start_addon dm-crypt

	if [[ -f /fastboot ]] || [[ -n ${CDBOOT} ]] ; then
		rm -f /fastboot
	else
		ebegin "Checking all filesystems"
		if [[ -f /forcefsck ]] ; then
			ewarn "A full fsck has been forced"
			fsck -C -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 -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