You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: misc/build.func
+50-31Lines changed: 50 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -370,7 +370,7 @@ base_settings() {
370
370
write_config() {
371
371
mkdir -p /opt/community-scripts
372
372
# This function writes the configuration to a file.
373
-
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "Write configfile" --yesno "Do you want to write the selections to a config file?" 10 60; then
373
+
if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "Write configfile" --yesno "Do you want to write the selections to a config file?" 10 60; then
374
374
FILEPATH="/opt/community-scripts/${NSAPP}.conf"
375
375
if [[ ! -f $FILEPATH ]]; then
376
376
cat <<EOF >"$FILEPATH"
@@ -403,7 +403,7 @@ EOF
403
403
echo -e "${INFO}${BOLD}${GN}Writing configuration to ${FILEPATH}${CL}"
404
404
else
405
405
echo -e "${INFO}${BOLD}${RD}Configuration file already exists at ${FILEPATH}${CL}"
406
-
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "Overwrite configfile" --yesno "Do you want to overwrite the existing config file?" 10 60; then
406
+
if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "Overwrite configfile" --yesno "Do you want to overwrite the existing config file?" 10 60; then
407
407
rm -f "$FILEPATH"
408
408
cat <<EOF >"$FILEPATH"
409
409
# ${NSAPP} Configuration File
@@ -558,53 +558,72 @@ advanced_settings() {
558
558
exit_script
559
559
fi
560
560
561
-
if CT_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 "$NSAPP" --title "HOSTNAME" 3>&1 1>&2 2>&3); then
562
-
if [ -z "$CT_NAME" ]; then
563
-
HN="$NSAPP"
561
+
while true; do
562
+
if CT_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 "$NSAPP" --title "HOSTNAME" 3>&1 1>&2 2>&3); then
563
+
if [ -z "$CT_NAME" ]; then
564
+
HN="$NSAPP"
565
+
else
566
+
HN=$(echo "${CT_NAME,,}" | tr -d ' ')
567
+
fi
568
+
569
+
if [[ "$HN" =~ ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ]]; then
whiptail --backtitle "Proxmox VE Helper Scripts" \
574
+
--msgbox "❌ Invalid hostname: '$HN'\n\nOnly lowercase letters, digits and hyphens (-) are allowed.\nUnderscores (_) or other characters are not permitted!" 10 70
DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GB" 8 58 "$var_disk" --title "DISK SIZE" 3>&1 1>&2 2>&3) || exit_script
571
583
572
-
if DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GB" 8 58 "$var_disk" --title "DISK SIZE" 3>&1 1>&2 2>&3); then
0 commit comments