Optimized root variables

This commit is contained in:
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
}