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

Collapse All | Expand All

(-)genkernel-3.4.4.org/generic/initrd.scripts (-21 / +59 lines)
Lines 549-583 Link Here
549
	fi
549
	fi
550
}
550
}
551
551
552
startLUKS() {
552
# Open a LUKS device
553
	if [ -n "${LUKS_ROOT}" ]
553
# $1 LUKS device
554
	then
554
# $2 LUKS name
555
		if [ -e /sbin/cryptsetup ]
555
openLUKS() {
556
		then
556
	LUKS_DEVICE="$1"
557
			if cryptsetup isLuks ${LUKS_ROOT}
557
	LUKS_NAME="$2"
558
	if [ -e /sbin/cryptsetup ]
559
	then
560
		while [ 1 ]
561
		do
562
			if [ "${LUKS_DEVICE}" = '' ]
558
			then
563
			then
559
				good_msg "Opening LUKS device ${LUKS_ROOT}"
564
				# LUKS device could not be opened. Prompt user for device.
560
565
				bad_msg "The LUKS ${LUKS_NAME} block device is not detected."
561
				cryptsetup luksOpen ${LUKS_ROOT} root
566
				echo "   Please specify a ${LUKS_NAME} LUKS device to open, "q" to skip, or "shell" for a shell..."
562
				if [ ! "$?" -eq '0' ]
567
				echo -n "LUKS ${LUKS_NAME}() :: "
563
				then
568
				read LUKS_DEVICE
564
					bad_msg "Failed open LUKS device ${LUKS_ROOT}"
569
				continue
565
				fi
570
			elif [ "${LUKS_DEVICE}" = 'shell' ]
566
571
			then
567
				if [ -n "${REAL_ROOT}" ]
572
				run_shell
573
				
574
				LUKS_DEVICE=''
575
				continue
576
			elif [ "${LUKS_DEVICE}" = 'q' ]
577
			then
578
				break
579
			else
580
				if cryptsetup isLuks ${LUKS_DEVICE}
568
				then
581
				then
569
					# Rescan volumes
582
					good_msg "Opening LUKS device ${LUKS_DEVICE}"
570
					startVolumes
583
					
584
					cryptsetup luksOpen ${LUKS_DEVICE} ${LUKS_NAME}
585
					if [ ! "$?" -eq '0' ]
586
					then
587
						bad_msg "Failed open LUKS device ${LUKS_DEVICE}"
588
					else
589
						break
590
					fi
571
				else
591
				else
572
					REAL_ROOT="/dev/mapper/root"
592
					bad_msg "The LUKS device ${LUKS_DEVICE} does not contain a LUKS header"
573
				fi
593
				fi
574
			else
575
				bad_msg "The LUKS device ${LUKS_ROOT} does not contain a LUKS hearder"
576
			fi
594
			fi
595
			LUKS_DEVICE=''
596
		done
597
	else
598
		bad_msg "The initrd does not support LUKS"
599
	fi
600
}
601
602
startLUKS() {
603
	if [ -n "${LUKS_ROOT}" ]
604
	then
605
		openLUKS "${LUKS_ROOT}" "root" 
606
		if [ -n "${REAL_ROOT}" ]
607
		then
608
			# Rescan volumes
609
			startVolumes
577
		else
610
		else
578
			bad_msg "The initrd does not support LUKS"
611
			REAL_ROOT="/dev/mapper/root"
579
		fi
612
		fi
580
	fi
613
	fi
614
	if [ -n "${LUKS_SWAP}" ]
615
	then
616
		openLUKS "${LUKS_SWAP}" "swap" 
617
		break
618
	fi
581
}
619
}
582
620
583
sdelay() {
621
sdelay() {
(-)genkernel-3.4.4.org/generic/linuxrc (-1 / +4 lines)
Lines 175-180 Link Here
175
		crypt_root\=*)
175
		crypt_root\=*)
176
			LUKS_ROOT=`parse_opt "${x}"`
176
			LUKS_ROOT=`parse_opt "${x}"`
177
		;;
177
		;;
178
		crypt_swap\=*)
179
			LUKS_SWAP=`parse_opt "${x}"`
180
		;;
178
	esac
181
	esac
179
done
182
done
180
183
Lines 226-232 Link Here
226
# Scan volumes
229
# Scan volumes
227
startVolumes
230
startVolumes
228
231
229
# Iinitialize LUKS root device
232
# Initialize LUKS root device
230
startLUKS
233
startLUKS
231
234
232
# Set up unionfs
235
# Set up unionfs

Return to bug 152441