mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-21 22:51:05 +01:00
Optimized root variables
This commit is contained in:
parent
131d677bb8
commit
b60b0c0d2b
@ -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
|
||||
}
|
||||
|
||||
|
@ -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..." &&
|
||||
|
Loading…
Reference in New Issue
Block a user