improves input validation in create_hardware_config function

This commit is contained in:
Menno van Leeuwen 2024-11-08 14:07:54 +01:00
parent 36cb9bbb42
commit 7ba5ab2067
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -56,12 +56,16 @@ create_hardware_config() {
echo "Is this a server or workstation? (s/w)"
tput sgr0
read systemType
while [[ $systemType != "s" && $systemType != "w" ]]; do
echo "Invalid input. Please enter 's' for server or 'w' for workstation:"
read systemType
while true; do
read -p "(s/w): " systemType
if [[ $systemType == "s" || $systemType == "w" ]]; then
break
fi
echo "Invalid input. Please enter 's' for server or 'w' for workstation."
done
if [ $systemType == "s" ]; then
isServer="true"
isWorkstation="false"