Optimized root variables

This commit is contained in:
Kevin Veen-Birkenbach 2020-10-01 21:01:06 +02:00
parent 131d677bb8
commit b60b0c0d2b
2 changed files with 11 additions and 6 deletions

View File

@ -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
}

View File

@ -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..." &&