From d6205d3a165e01d6c427e9160f36b51cfdc4e2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 25 Feb 2020 17:47:58 +0100 Subject: sys-boot/myinitramfs: extend to optionally autounlock --- sys-boot/myinitramfs/files/init.enc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys-boot/myinitramfs/files/init.enc') 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 \ -- cgit v1.2.3