Skip to content

Commit ab65711

Browse files
committed
Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
1 parent b670426 commit ab65711

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

misc/build.func

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ maybe_offer_save_app_defaults() {
903903

904904
# 1) if no file → offer to create
905905
if [[ ! -f "$app_vars_path" ]]; then
906-
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
906+
if whiptail --backtitle "Proxmox VE Helper Scripts" \
907907
--yesno "Save these advanced settings as defaults for ${APP}?\n\nThis will create:\n${app_vars_path}" 12 72; then
908908
mkdir -p "$(dirname "$app_vars_path")"
909909
install -m 0644 "$new_tmp" "$app_vars_path"
@@ -928,7 +928,7 @@ maybe_offer_save_app_defaults() {
928928

929929
while true; do
930930
local sel
931-
sel="$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
931+
sel="$(whiptail --backtitle "Proxmox VE Helper Scripts" \
932932
--title "APP DEFAULTS – ${APP}" \
933933
--menu "Differences detected. What do you want to do?" 20 78 10 \
934934
"Update Defaults" "Write new values to ${app_vars_file}" \
@@ -949,7 +949,7 @@ maybe_offer_save_app_defaults() {
949949
break
950950
;;
951951
"View Diff")
952-
whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
952+
whiptail --backtitle "Proxmox VE Helper Scripts" \
953953
--title "Diff – ${APP}" \
954954
--scrolltext --textbox "$diff_tmp" 25 100
955955
;;
@@ -1639,7 +1639,7 @@ diagnostics_check() {
16391639
fi
16401640

16411641
if ! [ -f "/usr/local/community-scripts/diagnostics" ]; then
1642-
if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send Diagnostics of LXC Installation?\n\n(This only transmits data without user data, just RAM, CPU, LXC name, ...)" 10 58); then
1642+
if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send Diagnostics of LXC Installation?\n\n(This only transmits data without user data, just RAM, CPU, LXC name, ...)" 10 58); then
16431643
cat <<EOF >/usr/local/community-scripts/diagnostics
16441644
DIAGNOSTICS=yes
16451645
@@ -1698,7 +1698,7 @@ EOF
16981698

16991699
diagnostics_menu() {
17001700
if [ "${DIAGNOSTICS:-no}" = "yes" ]; then
1701-
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
1701+
if whiptail --backtitle "Proxmox VE Helper Scripts" \
17021702
--title "DIAGNOSTIC SETTINGS" \
17031703
--yesno "Send Diagnostics?\n\nCurrent: ${DIAGNOSTICS}" 10 58 \
17041704
--yes-button "No" --no-button "Back"; then
@@ -1707,7 +1707,7 @@ diagnostics_menu() {
17071707
whiptail --msgbox "Diagnostics set to ${DIAGNOSTICS}." 8 58
17081708
fi
17091709
else
1710-
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
1710+
if whiptail --backtitle "Proxmox VE Helper Scripts" \
17111711
--title "DIAGNOSTIC SETTINGS" \
17121712
--yesno "Send Diagnostics?\n\nCurrent: ${DIAGNOSTICS}" 10 58 \
17131713
--yes-button "Yes" --no-button "Back"; then
@@ -2086,14 +2086,14 @@ configure_ssh_settings() {
20862086

20872087
local ssh_key_mode
20882088
if [[ "$default_key_count" -gt 0 ]]; then
2089-
ssh_key_mode=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SSH KEY SOURCE" --menu \
2089+
ssh_key_mode=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SSH KEY SOURCE" --menu \
20902090
"Provision SSH keys for root:" 14 72 4 \
20912091
"found" "Select from detected keys (${default_key_count})" \
20922092
"manual" "Paste a single public key" \
20932093
"folder" "Scan another folder (path or glob)" \
20942094
"none" "No keys" 3>&1 1>&2 2>&3) || exit_script
20952095
else
2096-
ssh_key_mode=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SSH KEY SOURCE" --menu \
2096+
ssh_key_mode=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SSH KEY SOURCE" --menu \
20972097
"No host keys detected; choose manual/none:" 12 72 2 \
20982098
"manual" "Paste a single public key" \
20992099
"none" "No keys" 3>&1 1>&2 2>&3) || exit_script
@@ -2102,7 +2102,7 @@ configure_ssh_settings() {
21022102
case "$ssh_key_mode" in
21032103
found)
21042104
local selection
2105-
selection=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SELECT HOST KEYS" \
2105+
selection=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT HOST KEYS" \
21062106
--checklist "Select one or more keys to import:" 20 140 10 "${CHOICES[@]}" 3>&1 1>&2 2>&3) || exit_script
21072107
for tag in $selection; do
21082108
tag="${tag%\"}"
@@ -2113,13 +2113,13 @@ configure_ssh_settings() {
21132113
done
21142114
;;
21152115
manual)
2116-
SSH_AUTHORIZED_KEY="$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
2116+
SSH_AUTHORIZED_KEY="$(whiptail --backtitle "Proxmox VE Helper Scripts" \
21172117
--inputbox "Paste one SSH public key line (ssh-ed25519/ssh-rsa/...)" 10 72 --title "SSH Public Key" 3>&1 1>&2 2>&3)"
21182118
[[ -n "$SSH_AUTHORIZED_KEY" ]] && printf '%s\n' "$SSH_AUTHORIZED_KEY" >>"$SSH_KEYS_FILE"
21192119
;;
21202120
folder)
21212121
local glob_path
2122-
glob_path=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
2122+
glob_path=$(whiptail --backtitle "Proxmox VE Helper Scripts" \
21232123
--inputbox "Enter a folder or glob to scan (e.g. /root/.ssh/*.pub)" 10 72 --title "Scan Folder/Glob" 3>&1 1>&2 2>&3)
21242124
if [[ -n "$glob_path" ]]; then
21252125
shopt -s nullglob
@@ -2129,7 +2129,7 @@ configure_ssh_settings() {
21292129
ssh_build_choices_from_files "${_scan_files[@]}"
21302130
if [[ "$COUNT" -gt 0 ]]; then
21312131
local folder_selection
2132-
folder_selection=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SELECT FOLDER KEYS" \
2132+
folder_selection=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT FOLDER KEYS" \
21332133
--checklist "Select key(s) to import:" 20 78 10 "${CHOICES[@]}" 3>&1 1>&2 2>&3) || exit_script
21342134
for tag in $folder_selection; do
21352135
tag="${tag%\"}"
@@ -2139,10 +2139,10 @@ configure_ssh_settings() {
21392139
[[ -n "$line" ]] && printf '%s\n' "$line" >>"$SSH_KEYS_FILE"
21402140
done
21412141
else
2142-
whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "No keys found in: $glob_path" 8 60
2142+
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "No keys found in: $glob_path" 8 60
21432143
fi
21442144
else
2145-
whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "Path/glob returned no files." 8 60
2145+
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "Path/glob returned no files." 8 60
21462146
fi
21472147
fi
21482148
;;
@@ -2157,7 +2157,7 @@ configure_ssh_settings() {
21572157
fi
21582158

21592159
if [[ -s "$SSH_KEYS_FILE" || "$PW" == -password* ]]; then
2160-
if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable root SSH access?" 10 58); then
2160+
if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable root SSH access?" 10 58); then
21612161
SSH="yes"
21622162
else
21632163
SSH="no"
@@ -2185,7 +2185,7 @@ start() {
21852185
set_std_mode
21862186
update_script
21872187
else
2188-
CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "${APP} LXC Update/Setting" --menu \
2188+
CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "${APP} LXC Update/Setting" --menu \
21892189
"Support/Update functions for ${APP} LXC. Choose an option:" \
21902190
12 60 3 \
21912191
"1" "YES (Silent Mode)" \
@@ -3029,7 +3029,7 @@ select_storage() {
30293029
local WIDTH=$((COL_WIDTH + 42))
30303030
while true; do
30313031
local DISPLAY_SELECTED
3032-
DISPLAY_SELECTED=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
3032+
DISPLAY_SELECTED=$(whiptail --backtitle "Proxmox VE Helper Scripts" \
30333033
--title "Storage Pools" \
30343034
--radiolist "Which storage pool for ${CONTENT_LABEL,,}?\n(Spacebar to select)" \
30353035
16 "$WIDTH" 6 "${MENU[@]}" 3>&1 1>&2 2>&3) || { exit_script; }
@@ -3229,7 +3229,7 @@ create_lxc_container() {
32293229
msg_info "Checking cluster quorum"
32303230
if ! pvecm status | awk -F':' '/^Quorate/ { exit ($2 ~ /Yes/) ? 0 : 1 }'; then
32313231
msg_error "Cluster is not quorate. Start all nodes or configure quorum device (QDevice)."
3232-
exit 210
3232+
exit 201
32333233
fi
32343234
msg_ok "Cluster is quorate"
32353235
fi
@@ -3549,7 +3549,7 @@ create_lxc_container() {
35493549
}
35503550
flock -w 60 9 || {
35513551
msg_error "Timeout while waiting for template lock."
3552-
exit 211
3552+
exit 202
35533553
}
35543554

35553555
LOGFILE="/tmp/pct_create_${CTID}_$(date +%Y%m%d_%H%M%S)_${SESSION_ID}.log"
@@ -3599,11 +3599,11 @@ create_lxc_container() {
35993599
2)
36003600
echo "Upgrade was declined. Please update and re-run:
36013601
apt update && apt install --only-upgrade pve-container lxc-pve"
3602-
exit 231
3602+
exit 213
36033603
;;
36043604
3)
36053605
echo "Upgrade and/or retry failed. Please inspect: $LOGFILE"
3606-
exit 231
3606+
exit 213
36073607
;;
36083608
esac
36093609
else
@@ -3631,11 +3631,11 @@ create_lxc_container() {
36313631
2)
36323632
echo "Upgrade was declined. Please update and re-run:
36333633
apt update && apt install --only-upgrade pve-container lxc-pve"
3634-
exit 231
3634+
exit 213
36353635
;;
36363636
3)
36373637
echo "Upgrade and/or retry failed. Please inspect: $LOGFILE"
3638-
exit 231
3638+
exit 213
36393639
;;
36403640
esac
36413641
else

misc/error_handler.func

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
# * Node.js/npm errors (243-249, 254)
3535
# * Python/pip/uv errors (210-212)
3636
# * PostgreSQL errors (231-234)
37-
# * MySQL/MariaDB errors (241-244)
38-
# * MongoDB errors (251-254)
39-
# * Proxmox custom codes (200-231)
37+
# * MySQL/MariaDB errors (260-263)
38+
# * MongoDB errors (251-253)
39+
# * Proxmox custom codes (200-209, 213-223, 225)
4040
# - Returns description string for given exit code
4141
# ------------------------------------------------------------------------------
4242
explain_exit_code() {
@@ -79,28 +79,28 @@ explain_exit_code() {
7979
234) echo "PostgreSQL: Fatal error in query / syntax" ;;
8080

8181
# --- MySQL / MariaDB ---
82-
241) echo "MySQL/MariaDB: Connection failed (server not running / wrong socket)" ;;
83-
242) echo "MySQL/MariaDB: Authentication failed (bad user/password)" ;;
84-
243) echo "MySQL/MariaDB: Database does not exist" ;;
85-
244) echo "MySQL/MariaDB: Fatal error in query / syntax" ;;
82+
260) echo "MySQL/MariaDB: Connection failed (server not running / wrong socket)" ;;
83+
261) echo "MySQL/MariaDB: Authentication failed (bad user/password)" ;;
84+
262) echo "MySQL/MariaDB: Database does not exist" ;;
85+
263) echo "MySQL/MariaDB: Fatal error in query / syntax" ;;
8686

8787
# --- MongoDB ---
8888
251) echo "MongoDB: Connection failed (server not running)" ;;
8989
252) echo "MongoDB: Authentication failed (bad user/password)" ;;
9090
253) echo "MongoDB: Database not found" ;;
91-
254) echo "MongoDB: Fatal query error" ;;
9291

9392
# --- Proxmox Custom Codes ---
9493
200) echo "Custom: Failed to create lock file" ;;
94+
201) echo "Custom: Cluster not quorate" ;;
95+
202) echo "Custom: Timeout waiting for template lock (concurrent download in progress)" ;;
9596
203) echo "Custom: Missing CTID variable" ;;
9697
204) echo "Custom: Missing PCT_OSTYPE variable" ;;
9798
205) echo "Custom: Invalid CTID (<100)" ;;
9899
206) echo "Custom: CTID already in use (check 'pct list' and /etc/pve/lxc/)" ;;
99100
207) echo "Custom: Password contains unescaped special characters (-, /, \\, *, etc.)" ;;
100101
208) echo "Custom: Invalid configuration (DNS/MAC/Network format error)" ;;
101102
209) echo "Custom: Container creation failed (check logs for pct create output)" ;;
102-
210) echo "Custom: Cluster not quorate" ;;
103-
211) echo "Custom: Timeout waiting for template lock (concurrent download in progress)" ;;
103+
213) echo "Custom: LXC stack upgrade/retry failed (outdated pve-container - check https://github.com/community-scripts/ProxmoxVE/discussions/8126)" ;;
104104
214) echo "Custom: Not enough storage space" ;;
105105
215) echo "Custom: Container created but not listed (ghost state - check /etc/pve/lxc/)" ;;
106106
216) echo "Custom: RootFS entry missing in config (incomplete creation)" ;;
@@ -111,7 +111,6 @@ explain_exit_code() {
111111
222) echo "Custom: Template download failed after 3 attempts (network/storage issue)" ;;
112112
223) echo "Custom: Template not available after download (storage sync issue)" ;;
113113
225) echo "Custom: No template available for OS/Version (check 'pveam available')" ;;
114-
231) echo "Custom: LXC stack upgrade/retry failed (outdated pve-container - check https://github.com/community-scripts/ProxmoxVE/discussions/8126)" ;;
115114

116115
# --- Default ---
117116
*) echo "Unknown error" ;;

0 commit comments

Comments
 (0)