Fixing RootPart for Encryption
This commit is contained in:
parent
95e09bcb32
commit
28d30d3700
1 changed files with 20 additions and 6 deletions
|
@ -94,12 +94,18 @@ function create_subvolumes() {
|
|||
|
||||
subvols+=(${!SUBVOLS_DEFAULT[@]})
|
||||
|
||||
${cmd} mount "$RootPart" /mnt
|
||||
if [[ "$ENCRYPTION" ]]; then
|
||||
${cmd} mount "/dev/mapper/luksvol"
|
||||
else
|
||||
${cmd} mount "$RootPart" /mnt
|
||||
fi
|
||||
|
||||
for subvol in "${subvols[@]}"
|
||||
do
|
||||
${cmd} btrfs subvolume create /mnt/"$subvol"
|
||||
done
|
||||
${cmd} umount "$RootPart" /mnt
|
||||
|
||||
${cmd} mount /mnt
|
||||
}
|
||||
|
||||
function get_hibernate_size() {
|
||||
|
@ -108,6 +114,7 @@ function get_hibernate_size() {
|
|||
|
||||
function prepare_target() {
|
||||
local subvol
|
||||
local rootmount
|
||||
|
||||
if [[ "$DEBUG" ]]; then
|
||||
local cmd="echo"
|
||||
|
@ -118,7 +125,14 @@ function prepare_target() {
|
|||
fi
|
||||
|
||||
${cmd} mkdir /target
|
||||
${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@ "$RootPart" /target
|
||||
|
||||
if [[ "$ENCRYPTION" ]]; then
|
||||
rootmount="/dev/mapper/luksvol"
|
||||
else
|
||||
rootmount="$RootPart"
|
||||
fi
|
||||
|
||||
${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@ "$rootmount" /target
|
||||
|
||||
for subvol in "${!SUBVOLS_DEFAULT[@]}"
|
||||
do
|
||||
|
@ -129,14 +143,14 @@ function prepare_target() {
|
|||
#${cmd} mkdir -p /target/{var/cache,var/log,var/spool,var/tmp,var/www}
|
||||
|
||||
if [[ "$BootPart" == "@boot" ]]; then
|
||||
${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@boot "$RootPart" /target/boot
|
||||
${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@boot "$rootmount" /target/boot
|
||||
else
|
||||
${cmd} mount "$BootPart" /target/boot
|
||||
fi
|
||||
|
||||
for subvol in "${!SUBVOLS_DEFAULT[@]}"
|
||||
do
|
||||
${cmd} mount -o noatime,space_cache=v2,ssd,subvol="$subvol" "$RootPart" /target/"${SUBVOLS_DEFAULT[$subvol]}"
|
||||
${cmd} mount -o noatime,space_cache=v2,ssd,subvol="$subvol" "$rootmount" /target/"${SUBVOLS_DEFAULT[$subvol]}"
|
||||
done
|
||||
|
||||
${cmd} mkdir -p /target/boot/efi
|
||||
|
@ -144,7 +158,7 @@ function prepare_target() {
|
|||
|
||||
if [[ "$SWAP" ]]; then
|
||||
${cmd} mkdir -p /target/swap
|
||||
${cmd} mount -o noatime,ssd,subvol=@swap "$RootPart" /target/swap
|
||||
${cmd} mount -o noatime,ssd,subvol=@swap "$rootmount" /target/swap
|
||||
${cmd} btrfs filesystem mkswapfile --size "$(get_hibernate_size)g" --uuid clear /target/swap/hibernate.swp
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue