This commit is contained in:
Neil Gerring 2025-05-03 20:57:36 +00:00 committed by GitHub
commit c82b8fcd9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,7 +114,6 @@ done
## if a condition failed:
### Required? exit 1
### Else? exit 0
if [ "$ENCRYPT" == "true" ]; then
SWAPDEV=/dev/mapper/swapfile
else
@ -142,7 +141,11 @@ if [ ! -f $path ] || ! [ $(stat -c "%s" $path) == $count ]; then
cryptsetup open --type plain --key-file /dev/urandom --key-size=256 --cipher=aes-cbc-essiv:sha256 --offset=0 ${path} swapfile
fi
/sbin/mkswap $SWAPDEV
elif [ "$ENCRYPT" == "true" ]; then
## Ensure the encrypted swap is created as it won't persist on a reboot
cryptsetup open --type plain --key-file /dev/urandom --key-size=256 --cipher=aes-cbc-essiv:sha256 --offset=0 ${path} swapfile
/sbin/mkswap $SWAPDEV
fi
/sbin/swapon $SWAPDEV
/sbin/swapon $SWAPDEV