summaryrefslogtreecommitdiff
path: root/sys-boot/myinitramfs/files/init.enc
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2020-02-25 17:47:58 +0100
committerKarel Kočí <karel.koci@nic.cz>2020-02-25 17:52:55 +0100
commitd6205d3a165e01d6c427e9160f36b51cfdc4e2b4 (patch)
treece631e293026850429049457aecdef226310fc06 /sys-boot/myinitramfs/files/init.enc
parent67320a1307feada9e25a3f08e8aba7179004d85c (diff)
downloadgentoo-personal-overlay-d6205d3a165e01d6c427e9160f36b51cfdc4e2b4.tar.gz
gentoo-personal-overlay-d6205d3a165e01d6c427e9160f36b51cfdc4e2b4.tar.bz2
gentoo-personal-overlay-d6205d3a165e01d6c427e9160f36b51cfdc4e2b4.zip
sys-boot/myinitramfs: extend to optionally autounlock
Diffstat (limited to 'sys-boot/myinitramfs/files/init.enc')
-rwxr-xr-xsys-boot/myinitramfs/files/init.enc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys-boot/myinitramfs/files/init.enc b/sys-boot/myinitramfs/files/init.enc
index b1cd3a2..0514508 100755
--- a/sys-boot/myinitramfs/files/init.enc
+++ b/sys-boot/myinitramfs/files/init.enc
@@ -83,7 +83,11 @@ root="$(blkid | awk -v uuid="UUID=\"$uuid\"" '$2 == uuid { gsub(/:$/,"",$1); pri
[ -e "$root" ] || fail "Root not located!"
echo -e "${C_GREEN}Unlocking root...${C_NO}"
-cryptsetup open "$root" encroot || fail "Unlocking root failed! /proc/cmdline=$(cat /proc/cmdline)"
+if command -v initramfs_password >/dev/null; then
+ initramfs_password | cryptsetup open --key-file=- "$root" encroot
+else
+ cryptsetup open "$root" encroot
+fi || fail "Unlocking root failed! /proc/cmdline=$(cat /proc/cmdline)"
echo -e "${C_GREEN}Mounting root...${C_NO}"
mount -t btrfs -o "$rootflags" /dev/mapper/encroot /mnt/root \