Update proxmox-zfs-postinstall.sh, fix if queries

This commit is contained in:
Simon Hoffmann 2023-10-14 09:55:19 +02:00 committed by GitHub
parent 4105a6b2d3
commit 31be2d6e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,19 +99,19 @@ fi
echo -e "######## Configure Swapfile ########\n" echo -e "######## Configure Swapfile ########\n"
read -p "With the default PVE-root on ZFS installation, no swap is created. Do you want to create a swapfile/zfs swap volume dataset? (y/n)" swapfile_userinput_bool read -p "With the default PVE-root on ZFS installation, no swap is created. Do you want to create a swapfile/zfs swap volume dataset? (y/n)" swapfile_userinput_bool
if [ $swapfile_userinput_bool -eq "y" ]; then if [ $swapfile_userinput_bool == "y" ]; then
read -p "Name for the swap dataset? Leave empty to use default 'swap'" swapfile_userinput_name read -p "Name for the swap dataset? Leave empty to use default 'swap'" swapfile_userinput_name
if [ x$swapfile_userinput_name -eq "x" ]; then if [ x$swapfile_userinput_name == "x" ]; then
swapfile_name = "swap"; swapfile_name="swap";
else else
swapfile_name = $swapfile_userinput_name; swapfile_name=$swapfile_userinput_name;
fi fi
read -p "Size for the swap volume in G, only numbers" swapfile_userinput_size read -p "Size for the swap volume in G, only numbers" swapfile_userinput_size
if echo "$swapfile_userinput_size" | grep -qE '^[0-9]+$'; then if echo "$swapfile_userinput_size" | grep -qE '^[0-9]+$'; then
swapfile_size = $swapfile_userinput_size; swapfile_size=$swapfile_userinput_size;
else else
echo "No valid input detected, falling back to 20G Swap Size"; echo "No valid input detected, falling back to 20G Swap Size";
swapfile_size = "20"; swapfile_size="20";
fi fi
else else
echo "No swapfile will be created" echo "No swapfile will be created"