Change swapfile creation

This commit is contained in:
natemaia 2020-06-24 20:44:28 -07:00
parent c848e2c446
commit 903b757f57

View File

@ -6,7 +6,7 @@
# AIF, Calamares, and the Arch Wiki.. Credit where credit is due
# shellcheck disable=SC2086,SC2046,SC2254,SC2164
VER=2.1.60
VER=2.1.61
# default values {
@ -1152,11 +1152,16 @@ part_find()
part_swap()
{
local swp="$1"
local size=0
if [[ $swp == "$MNT/swapfile" && $SWAP_S ]]; then
msg "Swap Setup" "\nActivating $SWAP_S swapfile at /swapfile\n" 1
fallocate -l $SWAP_S "$swp" 2> "$ERR"
errshow 0 "fallocate -l '$SWAP_S' '$swp'"
case "${SWAP_S: -1}" in
G) size=$(( ${SWAP_S:0:-1} * 1024 )) ;;
M) size=${SWAP_S:0:-1} ;;
esac
dd if=/dev/zero of="$swp" bs=1M count=$size
errshow 0 "dd if=/dev/zero of='$swp' bs=1M count=$size"
chmod 600 "$swp" 2> "$ERR"
errshow 0 "chmod 600 '$swp'"
else