Update create-linux-swapfile.sh

Added size parameter
This commit is contained in:
Kevin Veen-Birkenbach 2022-08-18 18:00:44 +02:00 committed by GitHub
parent 2133eaa94d
commit d68cc2c18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,9 +6,9 @@ if grep -q "$FSTAB_SWAP_ENTRY" "$FSTAB_FILE"; then
echo "Skipping creation of swap partion because entry allready exists in \"$FSTAB_FILE\"!" echo "Skipping creation of swap partion because entry allready exists in \"$FSTAB_FILE\"!"
else else
echo "Creating swap partition..." && echo "Creating swap partition..." &&
sudo fallocate -l 16G "$SWAP_FILE" && sudo fallocate -l "$1" "$SWAP_FILE" &&
sudo chmod 600 "$SWAP_FILE" && sudo chmod 600 "$SWAP_FILE" &&
sudo mkswap "$SWAP_FILE" && sudo mkswap "$SWAP_FILE" &&
sudo swapon "$SWAP_FILE" && sudo swapon "$SWAP_FILE" &&
sudo sh -c "echo \"$FSTAB_SWAP_ENTRY\">>\"$FSTAB_FILE\"" sudo sh -c "echo \"$FSTAB_SWAP_ENTRY\">>\"$FSTAB_FILE\"" || exit 1
fi fi