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)" echo "Is this a server or workstation? (s/w)"
tput sgr0 tput sgr0
read systemType while true; do
while [[ $systemType != "s" && $systemType != "w" ]]; do read -p "(s/w): " systemType
echo "Invalid input. Please enter 's' for server or 'w' for workstation:" if [[ $systemType == "s" || $systemType == "w" ]]; then
read systemType break
fi
echo "Invalid input. Please enter 's' for server or 'w' for workstation."
done done
if [ $systemType == "s" ]; then if [ $systemType == "s" ]; then
isServer="true" isServer="true"
isWorkstation="false" isWorkstation="false"