Broke swap related stuff into seperate script

This commit is contained in:
2025-12-31 23:36:02 -05:00
parent 2b1a2f29ee
commit df9a67caea
2 changed files with 30 additions and 18 deletions

View File

@@ -29,15 +29,6 @@ source \
source \ source \
"${baseDir}/system.conf" "${baseDir}/system.conf"
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then
part2='p2'
else
part2='2'
fi
else
part2='-part2'
fi
if [[ ! -f "/etc/mtab" ]]; then if [[ ! -f "/etc/mtab" ]]; then
"${baseDir}/mtab.sh" "${baseDir}/mtab.sh"
@@ -137,15 +128,7 @@ passwd
printf \ printf \
'\033[?47l' '\033[?47l'
if [[ "${enableSwap}" == "yes" ]]; then "${baseDir}/swap.sh"
printf \
"swap\t${disk}${part2}\t/dev/random\tswap,cipher=aes-xts-plain64,size=512\n" | \
tee /etc/crypttab &> /dev/null
printf \
'dev/mapper/swap\tnone\tswap\tsw\t0\t0\n' | \
tee --append /etc/fstab &> /dev/null
fi
if [[ "${ID}" == 'debian' ]]; then if [[ "${ID}" == 'debian' ]]; then
"${baseDir}/debian.sh" --network-manager "${baseDir}/debian.sh" --network-manager

29
swap.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
baseDir="$(realpath "$(dirname "${0}")")"
source \
"${baseDir}/system.conf"
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then
part2='p2'
else
part2='2'
fi
else
part2='-part2'
fi
if [[ "${enableSwap}" == "yes" ]]; then
printf \
"swap\t${disk}${part2}\t/dev/random\tswap,cipher=aes-xts-plain64,size=512\n" | \
tee /etc/crypttab &> /dev/null
printf \
'dev/mapper/swap\tnone\tswap\tsw\t0\t0\n' | \
tee --append /etc/fstab &> /dev/null
fi