View | Details | Raw Unified | Return to bug 4997
Collapse All | Expand All

(-)/sbin/mkinitrd (-3 / +56 lines)
Lines 15-20 Link Here
15
#	Keith Owens <kaos@ocs.com.au>
15
#	Keith Owens <kaos@ocs.com.au>
16
#
16
#
17
# Rewritten by Dmitry V. Levin <ldv@altlinux.org>
17
# Rewritten by Dmitry V. Levin <ldv@altlinux.org>
18
#
19
# Contributors:
20
#	 Nick S. Grechukh <gns@altlinux.ru>:
21
#		Aug 15, 2004 improved raid support:
22
#			- using LVM over raid
23
#			- arrays created with mdadm (without /etc/raidtab)
24
#			- loading raid support to initrd can be forced (for autodetect at bootstrap)
25
#			bugs: raid-over-raid (level 10) will not working this way. however, formerly it wasn't working at all.
18
26
19
PROG=mkinitrd
27
PROG=mkinitrd
20
VERSION=2.9.1
28
VERSION=2.9.1
Lines 137-142 Link Here
137
MODULES_CONF=
145
MODULES_CONF=
138
HAVE_RAID=
146
HAVE_RAID=
139
147
148
PVSCAN=/sbin/pvscan
149
MDADM=/usr/sbin/mdadm
150
FORCE_RAID=
151
140
FSTAB_FILE=/etc/fstab
152
FSTAB_FILE=/etc/fstab
141
153
142
BIN_SPLASH=/bin/splash
154
BIN_SPLASH=/bin/splash
Lines 292-301 Link Here
292
{
304
{
293
	[ -z "$noraid" ] || return
305
	[ -z "$noraid" ] || return
294
306
295
	if egrep -s '^/dev/md/?[0-9]+[ 	]' "$FSTAB_FILE" |
307
	if egrep -s '^/dev/md/?[0-9]+[ 	]' "$FSTAB_FILE" | fgrep -qsv noauto \
296
		fgrep -qsv noauto; then
308
	    || [ -x $PVSCAN ] && $PVSCAN grep ACTIVE | egrep -q '"/dev/md/?[0-9]"' \
309
	    || [ -n "$FORCE_RAID" ]; then 
310
#### detects indirect using of raid arrays (e.g. via LVM) 
311
297
		HAVE_RAID=1
312
		HAVE_RAID=1
298
		FindModule -md
313
		FindModule -md
314
		if [ -f /etc/raidtab ]; then
299
		for number in $(grep '^[ 	]*raid-level' /etc/raidtab |
315
		for number in $(grep '^[ 	]*raid-level' /etc/raidtab |
300
			  awk '{print $2}' |LC_COLLATE=C sort -u); do
316
			  awk '{print $2}' |LC_COLLATE=C sort -u); do
301
			case "$number" in
317
			case "$number" in
Lines 313-318 Link Here
313
					;;
329
					;;
314
			esac
330
			esac
315
		done
331
		done
332
		fi
333
334
#### detects arrays _without_ raidtab (e.g. created with mdadm). maybe rewrite to /proc/mdstat, heh?
335
#### of cource, it will detect only running arrays
336
		if [ -x $MDADM ]; then
337
			for raidmod in `$MDADM --detail --scan|awk '{print $3}'|awk -F '=' '{print $2}'`; do
338
				case "$raidmod" in 
339
					linear|raid[015])
340
						FindModule "$raidmod"
341
						;;
342
					*)
343
						echo "raid level $raidmod (in output of mdadm) not recognized" >&2
344
						;;
345
				esac
346
			done
347
		fi
348
349
#### and just for perfection: allow to _manually_ specify raid level, even if it is not running now.
350
		case "$FORCE_RAID" in
351
			[015])
352
				FindModule "raid$FORCE_RAID"
353
				;;
354
			4)
355
				FindModule "raid5"
356
				;;
357
			-1|linear)
358
				FindModule "linear"
359
				;;
360
			*)
361
				echo "raid level $FORCE_RAID (in --force-raid) not recognized" >&2
362
				;;
363
		esac
316
	fi
364
	fi
317
365
318
	if grep -s '^/dev/ataraid' "$FSTAB_FILE" |fgrep -qsv noauto; then
366
	if grep -s '^/dev/ataraid' "$FSTAB_FILE" |fgrep -qsv noauto; then
Lines 589-601 Link Here
589
	[ -n "$1" ] && Exit "$1" || Exit
637
	[ -n "$1" ] && Exit "$1" || Exit
590
}
638
}
591
639
592
TEMP=`getopt -n "$PROG" -o fhvd -l help,version,verbose,debug,force,ifneeded,omit-scsi-modules,omit-ide-modules,omit-raid-modules,pause,image-version,nocompress,nobootsplash,strict,fstab:,before:,preload:,with:,after: -- "$@"` || Usage 1
640
TEMP=`getopt -n "$PROG" -o fhvd -l help,version,verbose,debug,force,ifneeded,omit-scsi-modules,omit-ide-modules,omit-raid-modules,pause,image-version,nocompress,nobootsplash,strict,fstab:,before:,preload:,with:,after:,force-raid: -- "$@"` || Usage 1
593
eval set -- "$TEMP"
641
eval set -- "$TEMP"
594
642
595
img_vers=
643
img_vers=
596
force=
644
force=
597
while :; do
645
while :; do
598
	case "$1" in
646
	case "$1" in
647
		--force-raid)
648
			shift
649
			FORCE_RAID=$1
650
			shift
651
			;;
599
		--fstab)
652
		--fstab)
600
			shift
653
			shift
601
			FSTAB_FILE=$1
654
			FSTAB_FILE=$1

Return to bug 4997