Cleanup code

This commit is contained in:
Eric Renfro 2024-07-02 16:24:58 -04:00
parent 8b43529790
commit 0c48b19393
Signed by: psi-jack
SSH key fingerprint: SHA256:1TKB8Z257L8EHK8GWNxKgMhD8a+FAR+f+j3nnlcuNVM

View file

@ -92,15 +92,13 @@ function prepare_target() {
for subvol in "${!SUBVOLS_DEFAULT[@]}" for subvol in "${!SUBVOLS_DEFAULT[@]}"
do do
${cmd} mkdir -p /target/"${SUBVOLS_DEFAULT[$subvol]}" if [[ ! -d "/target/${SUBVOLS_DEFAULT[$subvol]}" || "$DEBUG" ]]; then
${cmd} mkdir -p /target/"${SUBVOLS_DEFAULT[$subvol]}"
fi
done done
#${cmd} mkdir -p /target/boot #${cmd} mkdir -p /target/boot
if [[ "$BootPart" == "@boot" ]]; then if [[ "$BootPart" == "@boot" ]]; then
${cmd} mkdir /mnt/boot
${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@boot "$rootmount" /mnt/boot
${cmd} rsync -avhHi --delete-after /target/boot/ /mnt/boot/
${cmd} umount /mnt/boot
${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@boot "$rootmount" /target/boot ${cmd} mount -o noatime,space_cache=v2,ssd,subvol=@boot "$rootmount" /target/boot
else else
${cmd} mount "$BootPart" /target/boot ${cmd} mount "$BootPart" /target/boot
@ -115,7 +113,9 @@ function prepare_target() {
${cmd} mount "$EFIPart" /target/boot/efi ${cmd} mount "$EFIPart" /target/boot/efi
if [[ "$SWAP" ]]; then if [[ "$SWAP" ]]; then
${cmd} mkdir -p /target/swap if [[ ! -d "/target/swap" ]]; then
${cmd} mkdir -p /target/swap
fi
${cmd} mount -o noatime,ssd,subvol=@swap "$rootmount" /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 ${cmd} btrfs filesystem mkswapfile --size "$(get_hibernate_size)g" --uuid clear /target/swap/hibernate.swp
fi fi
@ -135,19 +135,14 @@ function expert_step() {
if [[ "$DEBUG" ]]; then if [[ "$DEBUG" ]]; then
echo "genfstab -U /target >> /target/etc/fstab" echo "genfstab -U /target >> /target/etc/fstab"
echo "==== genfstab result : begin ===="
genfstab -U /target
echo "==== genfstab result : end ===="
echo
else else
genfstab -U /target >> /target/etc/fstab genfstab -U /target >> /target/etc/fstab
fi fi
if [[ "$ENCRYPTION" ]]; then
eval "$(blkid -p --output export "$RootPart" | grep UUID)"
if [[ "$DEBUG" ]]; then
echo "echo \"luksvol UUID=$UUID none luks\" >> /target/etc/crypttab"
else
echo "luksvol UUID=$UUID none luks" >> /target/etc/crypttab
fi
fi
if [[ "$SWAP" ]]; then if [[ "$SWAP" ]]; then
if [[ "$DEBUG" ]]; then if [[ "$DEBUG" ]]; then
echo "echo \"/swap/hibernate.swp none swap defaults 0 0\" >> /target/etc/fstab" echo "echo \"/swap/hibernate.swp none swap defaults 0 0\" >> /target/etc/fstab"