diff options
| author | Blake Romero <blake@blkrom.com> | 2023-05-24 15:05:36 +0100 |
|---|---|---|
| committer | Blake Romero <blake@blkrom.com> | 2023-05-24 15:05:36 +0100 |
| commit | 694f1188ec6f52df33864ce47671ddcec05fd363 (patch) | |
| tree | 931f68de3aa19a92d8289efff2f6c3e0c2b14130 | |
| parent | 58e034c26e492f38c28ce05a684056fe20559c81 (diff) | |
Fix syntax error in echo & bc commands
| -rwxr-xr-x | install-artix.sh | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/install-artix.sh b/install-artix.sh index 40d2774..b453f2e 100755 --- a/install-artix.sh +++ b/install-artix.sh @@ -75,20 +75,18 @@ while true; do read -rp "Press ENTER to try again..."; done -# Use RAM size to calculate SWAP size -# Note: if swap_size was set, that value will be used instead -if [[ -z $swap_size ]]; then - pacman --needed --noconfirm -Sy bc - ram_kB=$(awk 'FNR==1 {print $2}' /proc/meminfo) - ram_gb=$(bc <<< "${ram_kB} / 1000^2") - swap_size="$(bc <<< "sqrt(${ram_gb})) * 4")G" -fi +# Get system RAM size +pacman --needed --noconfirm -Sy bc +ram_kB=$(awk 'FNR==1 {print $2}' /proc/meminfo) +ram_gb=$(bc <<< "${ram_kB} / 1000^2") + +# Check there is at least 1GB RAM for swap +[[ $ram_gb < 1 ]] && { echo "Not enough ram for SWAP"; exit; } -# Check at least 1GB of swap -[ "${ram_gb}" -lt 1 ] && { echo "ERR: not enough ram for SWAP"; exit; } +# Calculate SWAP size +[[ -z $swap_size ]] && swap_size="$(bc <<< "sqrt(${ram_gb}) * 4")G" -# Set default boot size if unset -# Note: if boot_size was set, that value will be used instead +# Set BOOT size [[ -z $boot_size ]] && boot_size=512M # Set boot type @@ -106,7 +104,7 @@ ROOT Partition: ${root}, Size: MAX !!! CAUTION: all data from ${drive} will be erased !!! ------------------------------------------------------ " -secho "Are you sure you want install?" +echo "Are you sure you want install?" unset input read -rp "Type YES (in uppercase letters) to begin installation: " input [[ "${input}" != "YES" ]] && exit |
