From 67a76814b03ac32cc0fca179b0f1d075db75878f Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 1 Oct 2020 21:16:08 +0200 Subject: [PATCH] Updated decryption process --- scripts/image/base.sh | 5 ++++- scripts/image/chroot.sh | 2 ++ scripts/image/setup.sh | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/image/base.sh b/scripts/image/base.sh index eeb4370..1257892 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -51,7 +51,7 @@ set_root_variables(){ root_mapper_path="/dev/mapper/$root_mapper_name" || error } -mount_partitions(){ +decrypt_root(){ if [ "$(blkid "$root_partition_path" -s TYPE -o value)" == "crypto_LUKS" ] then set_root_variables && @@ -59,6 +59,9 @@ mount_partitions(){ sudo cryptsetup -v luksOpen "$root_partition_path" "$root_mapper_name" || error fi +} + +mount_partitions(){ info "Mount boot and root partition..." && mount -v "$boot_partition_path" "$boot_mount_path" && mount -v "$root_mapper_path" "$root_mount_path" && diff --git a/scripts/image/chroot.sh b/scripts/image/chroot.sh index a968ae7..e0c6f59 100644 --- a/scripts/image/chroot.sh +++ b/scripts/image/chroot.sh @@ -14,6 +14,8 @@ make_mount_folders set_partition_paths +decrypt_root + mount_partitions mount_chroot_binds diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index 7463046..b576256 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -244,7 +244,7 @@ if [ "$transfer_image" = "y" ] then info "Formating $root_partition_path with LUKS..." && sudo cryptsetup -v luksFormat -c aes-xts-plain64 -s 512 -h sha512 --use-random -i 1000 "$root_partition_path" && - set_root_variables || error + decrypt_root || error fi info "Format root partition..." && @@ -293,6 +293,7 @@ if mount | grep -q "$boot_partition_path" then info "$root_mapper_path is allready mounted..." else + decrypt_root mount_partitions fi fi