From 3b87e3f2bb66b0f4970428fc6f0715562f199072 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 Nov 2023 22:23:00 +0000 Subject: [PATCH] Add swap to webtop install script --- webtop_installers/full_setup.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webtop_installers/full_setup.sh b/webtop_installers/full_setup.sh index 948f3d7..e2588ce 100755 --- a/webtop_installers/full_setup.sh +++ b/webtop_installers/full_setup.sh @@ -10,6 +10,18 @@ read -p "Enter the username: " username read -sp "Enter the password: " password echo +# Ask if a swap file is needed +read -p "Do you want to add a swap file? (y/n): " add_swap +if [[ "$add_swap" == "y" ]]; then + read -p "Enter the size of the swap file (e.g., 1G, 512M): " swap_size + sudo fallocate -l "$swap_size" /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab + echo "Swap file of size $swap_size created." +fi + # Create the user with the given password sudo useradd -m "$username" -p "$(openssl passwd -1 "$password")"