From 2c6b8367f0f526c6a12b91b85f2f7f3ef35b5559 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Fri, 5 May 2006 15:45:27 +0000 Subject: replace_root changes for encryption - edits the existing cmdline for the /dev/mapper root device after applying decryption git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@66 880c04e9-e011-0410-abf7-b926e227c9cd --- hooks/encrypt | 13 +++++++++++++ init | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hooks/encrypt b/hooks/encrypt index 30dfc12..9ae2d45 100644 --- a/hooks/encrypt +++ b/hooks/encrypt @@ -3,6 +3,17 @@ # encryption schemes run_hook () { + replace_root () + { + newcmdline="" + for cmd in $CMDLINE; do + case "$cmd" in + root=*) newcmdline="${newcmdline} root=${1}" ;; + *) newcmdline="${newcmdline} ${cmd}" ;; + esac + done + export CMDLINE="${newcmdline}" + } mkdevice () { /bin/mknod "/dev/mapper/control" c ${1} ${2}; } /bin/modprobe -a -q dm-crypt >/dev/null 2>&1 @@ -22,6 +33,7 @@ run_hook () done if [ -e "/dev/mapper/root" ]; then export root="/dev/mapper/root" + replace_root ${root} else err "Password succeeded, but root creation failed, aborting..." exit 1 @@ -57,6 +69,7 @@ run_hook () else if [ -e "/dev/mapper/root" ]; then export root="/dev/mapper/root" + replace_root ${root} else err "Password succeeded, but root creation failed, aborting..." exit 1 diff --git a/init b/init index e1c6ac4..f2d6361 100644 --- a/init +++ b/init @@ -8,7 +8,8 @@ msg ":: Loading Initramfs" /bin/mount -t sysfs none /sys /bin/mount -t proc none /proc -CMDLINE=$(/bin/cat /proc/cmdline) +read CMDLINE