Update build.func

passwords cannot start with a hyphen
This commit is contained in:
tteckster 2023-12-29 09:46:07 -05:00 committed by GitHub
parent a9b44432c4
commit 6f3b33550e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -200,17 +200,22 @@ advanced_settings() {
fi
done
if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3); then
if [ -z $PW1 ]; then
PW1="Automatic Login"
PW=""
while true; do
if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3); then
if [ -z "$PW1" ]; then
PW1="Automatic Login"
PW=""
elif [[ $PW1 == -* ]]; then
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Invalid Password" "Passwords cannot start with a hyphen. Please try again." 8 59
else
PW="-password $PW1"
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
break
fi
else
PW="-password $PW1"
exit-script
fi
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
else
exit-script
fi
done
if CT_ID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then
if [ -z "$CT_ID" ]; then