diff --git a/scripts/image/base.sh b/scripts/image/base.sh index fd5464a..eeb4370 100644 --- a/scripts/image/base.sh +++ b/scripts/image/base.sh @@ -44,12 +44,17 @@ make_working_folder(){ error } +set_root_variables(){ + info "Setting root variables..." && + root_partition_uuid=$(blkid "$root_partition_path" -s UUID -o value) && + root_mapper_name="arch-root-$root_partition_uuid" && + root_mapper_path="/dev/mapper/$root_mapper_name" || error +} + mount_partitions(){ if [ "$(blkid "$root_partition_path" -s TYPE -o value)" == "crypto_LUKS" ] then - root_partition_uuid=$(blkid "$root_partition_path" -s UUID -o value) && - root_mapper_name="arch-root-$root_partition_uuid" && - root_mapper_path="/dev/mapper/$root_mapper_name" && + set_root_variables && info "Decrypting of $root_partition_path is neccessary..." && sudo cryptsetup -v luksOpen "$root_partition_path" "$root_mapper_name" || error @@ -78,7 +83,7 @@ destructor(){ if [ "$(blkid "$root_partition_path" -s TYPE -o value)" == "crypto_LUKS" ] then info "Trying to close decrypted $root_mapper_name..." && - sudo cryptsetup -v luksClose $root_mapper_name || warning "Failed." + sudo cryptsetup -v luksClose "$root_mapper_name" || warning "Failed." fi } diff --git a/scripts/image/setup.sh b/scripts/image/setup.sh index bed03a9..7463046 100644 --- a/scripts/image/setup.sh +++ b/scripts/image/setup.sh @@ -243,8 +243,8 @@ if [ "$transfer_image" = "y" ] if [ "$encrypt_system" == "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" || - error + sudo cryptsetup -v luksFormat -c aes-xts-plain64 -s 512 -h sha512 --use-random -i 1000 "$root_partition_path" && + set_root_variables || error fi info "Format root partition..." &&