Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 23437 | Differences between
and this patch

Collapse All | Expand All

(-)/etc/init.d/checkfs.orig (-6 / +61 lines)
Lines 31-48 Link Here
31
	fi
31
	fi
32
32
33
	# Start software raid.
33
	# Start software raid.
34
	# Sadly this is based on Mandrake's startup scripts, as nobody seems
34
	# You need a properly configured /etc/raidtab for raidtools usage or a
35
	# to want to fix our old one, and I do not use (or able to at present) raid ....
35
	# properly configured /etc/mdadm.conf for mdadm usage. Devices in
36
	# NOTE:  You need a properly setup /etc/raidtab, and until sombody come up
36
	# /etc/mdadm.conf are initialized first, so any duplicate devices in
37
	#        with a *working* one, that is tested to work for all setups!
37
	# /etc/raidtab will not get initialized.
38
	if [ -f /proc/mdstat -a -f /etc/raidtab ]
38
	if [ -f /proc/mdstat ]
39
	then
39
	then
40
		local mdadm_devices=""
41
		local raidtools_devices=""
42
		# If /etc/mdadm.conf exists, grab all the RAID devices from it
43
		if [ -f /etc/mdadm.conf ]
44
		then
45
			mdadm_devices=$(awk '/^[[:space:]]*ARRAY/ { print $2 }' /etc/mdadm.conf)
46
		fi
47
		# If /etc/raidtab exists, grab all the RAID devices from it
48
		if [ -f /etc/raidtab ]
49
		then
50
			raidtools_devices=$(awk '/^[[:space:]]*raiddev/ { print $2 }' /etc/raidtab)
51
		fi
40
		ebegin "Starting up RAID devices: " 
52
		ebegin "Starting up RAID devices: " 
41
53
42
		local rc=0
54
		local rc=0
43
		local retval=0
55
		local retval=0
56
57
		for i in $mdadm_devices
58
		do
59
			local raiddev="${i##*/}"
60
			local raidstat="$(egrep "^${raiddev} : active" /proc/mdstat)"
61
			
62
			if [ -z "${raidstat}" ]
63
			then
64
				# First scan the /etc/fstab for the "noauto"-flag
65
				# for this device. If found, skip the initialization
66
				# for it to avoid dropping to a shell on errors.
67
				# If not, try raidstart...if that fails then
68
				# fall back to raidadd, raidrun.  If that
69
				# also fails, then we drop to a shell
70
				local retval=1
71
				local noauto="$(egrep "^${i}" /etc/fstab | grep -c 'noauto')"
72
73
				einfon "  Trying ${raiddev}..."
74
75
				raiddev=""
76
				
77
				if [ "${noauto}" -gt 0 ]
78
				then
79
					retval=0
80
					raiddev=" (skipped)"
81
				fi
82
				if [ "${retval}" -gt 0 -a -x /sbin/mdadm ]
83
				then
84
					/sbin/mdadm -As "${i}" &>/dev/null
85
					retval=$?
86
				fi
87
88
				echo "${raiddev}"
89
				
90
				if [ "${retval}" -gt 0 ]
91
				then
92
					rc=1
93
					eend ${retval}
94
				else
95
					ewend ${retval}
96
				fi
97
			fi
98
		done
44
        
99
        
45
		for i in $(awk '/^[[:space:]]*raiddev/ { print $2 }' /etc/raidtab)
100
		for i in $raidtools_devices
46
		do
101
		do
47
			local raiddev="${i##*/}"
102
			local raiddev="${i##*/}"
48
			local raidstat="$(egrep "^${raiddev} : active" /proc/mdstat)"
103
			local raidstat="$(egrep "^${raiddev} : active" /proc/mdstat)"

Return to bug 23437