From 11acd8db754db96c9088762e2deff9c16f0a35f7 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:30:57 +0100 Subject: [PATCH] Keep host tools running when clear does not know the terminal (#18412) clear exits 1 for a TERM the host has no terminfo entry for, such as xterm-ghostty or xterm-kitty over SSH, and when TERM is unset under cron. The tools that run under errexit died on it in header_info within a second, before showing anything, which telemetry counts as "exit_code=1 | General error" with no step for update-lxcs, update-repo, fstrim, clean-lxcs, execute and storage-share-helper. Fall back to the escape sequence the engine's _cs_clear uses. --- tools/pve/clean-lxcs.sh | 2 +- tools/pve/cron-update-lxcs.sh | 2 +- tools/pve/execute.sh | 2 +- tools/pve/fstrim.sh | 2 +- tools/pve/guest-delete.sh | 2 +- tools/pve/hw-acceleration.sh | 2 +- tools/pve/pbs3-upgrade.sh | 4 ++-- tools/pve/pbs4-upgrade.sh | 4 ++-- tools/pve/post-pbs-install.sh | 4 ++-- tools/pve/post-pdm-install.sh | 4 ++-- tools/pve/post-pmg-install.sh | 4 ++-- tools/pve/post-pve-install.sh | 4 ++-- tools/pve/pve8-upgrade.sh | 4 ++-- tools/pve/scaling-governor.sh | 6 +++--- tools/pve/storage-share-helper.sh | 2 +- tools/pve/update-lxcs.sh | 2 +- tools/pve/update-repo.sh | 2 +- 17 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/pve/clean-lxcs.sh b/tools/pve/clean-lxcs.sh index e54a307a9..177feea9d 100644 --- a/tools/pve/clean-lxcs.sh +++ b/tools/pve/clean-lxcs.sh @@ -5,7 +5,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE function header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ________ __ _ ________ / ____/ /__ ____ _____ / / | |/ / ____/ diff --git a/tools/pve/cron-update-lxcs.sh b/tools/pve/cron-update-lxcs.sh index 437c7e472..d3429458d 100644 --- a/tools/pve/cron-update-lxcs.sh +++ b/tools/pve/cron-update-lxcs.sh @@ -19,7 +19,7 @@ CONF_FILE="/etc/update-lxcs.conf" LOG_FILE="/var/log/update-lxcs-cron.log" CRON_ENTRY="0 0 * * 0 ${LOCAL_SCRIPT} >>${LOG_FILE} 2>&1" -clear +clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ______ __ __ __ __ __ _ ________ / ____/________ ____ / / / /___ ____/ /___ _/ /____ / / | |/ / ____/____ diff --git a/tools/pve/execute.sh b/tools/pve/execute.sh index 69ea75453..8d7a2400c 100644 --- a/tools/pve/execute.sh +++ b/tools/pve/execute.sh @@ -6,7 +6,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE function header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ______ __ __ _ ________ / ____/ _____ _______ __/ /____ / / | |/ / ____/ diff --git a/tools/pve/fstrim.sh b/tools/pve/fstrim.sh index baf8daf36..f2b300206 100644 --- a/tools/pve/fstrim.sh +++ b/tools/pve/fstrim.sh @@ -3,7 +3,7 @@ set -eEuo pipefail function header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" _______ __ __ ______ _ / ____(_) /__ _______ _______/ /____ ____ ___ /_ __/____(_)___ ___ diff --git a/tools/pve/guest-delete.sh b/tools/pve/guest-delete.sh index 139f1e6f6..2c6d94610 100644 --- a/tools/pve/guest-delete.sh +++ b/tools/pve/guest-delete.sh @@ -5,7 +5,7 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE function header_info { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ ______ __ ____ __ __ / __ \_________ _ ______ ___ ____ _ __ / ____/_ _____ _____/ /_ / __ \___ / /__ / /____ diff --git a/tools/pve/hw-acceleration.sh b/tools/pve/hw-acceleration.sh index 950a44028..e6fbf863e 100644 --- a/tools/pve/hw-acceleration.sh +++ b/tools/pve/hw-acceleration.sh @@ -9,7 +9,7 @@ set -e function header_info { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" __ ___ __ ___ __ __ _ diff --git a/tools/pve/pbs3-upgrade.sh b/tools/pve/pbs3-upgrade.sh index dc9bce827..76a64cf7f 100644 --- a/tools/pve/pbs3-upgrade.sh +++ b/tools/pve/pbs3-upgrade.sh @@ -6,7 +6,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ ____ __________ __ ______ __________ ___ ____ ______ / __ \/ __ ) ___/__ / / / / / __ \/ ____/ __ \/ | / __ \/ ____/ @@ -168,7 +168,7 @@ while true; do case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/pbs4-upgrade.sh b/tools/pve/pbs4-upgrade.sh index f8f466cc4..d46400092 100644 --- a/tools/pve/pbs4-upgrade.sh +++ b/tools/pve/pbs4-upgrade.sh @@ -5,7 +5,7 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ ____ _____ __ __ __ __ __ / __ \/ __ ) ___// // / / / / /___ ____ __________ _____/ /__ @@ -192,7 +192,7 @@ while true; do case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/post-pbs-install.sh b/tools/pve/post-pbs-install.sh index 397c75991..a841170dc 100644 --- a/tools/pve/post-pbs-install.sh +++ b/tools/pve/post-pbs-install.sh @@ -5,7 +5,7 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ ____ _____ ____ __ ____ __ ____ / __ \/ __ ) ___/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / / @@ -89,7 +89,7 @@ main() { case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/post-pdm-install.sh b/tools/pve/post-pdm-install.sh index 373c174d4..22a860da4 100644 --- a/tools/pve/post-pdm-install.sh +++ b/tools/pve/post-pdm-install.sh @@ -5,7 +5,7 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ ____ __ ___ ____ __ ____ __ ____ / __ \/ __ \/ |/ / / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / / @@ -412,7 +412,7 @@ while true; do case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/post-pmg-install.sh b/tools/pve/post-pmg-install.sh index 4f68cb339..28adbf40e 100644 --- a/tools/pve/post-pmg-install.sh +++ b/tools/pve/post-pmg-install.sh @@ -5,7 +5,7 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ __ _________ ____ __ ____ __ ____ / __ \/ |/ / ____/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / / @@ -410,7 +410,7 @@ while true; do case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/post-pve-install.sh b/tools/pve/post-pve-install.sh index e2f4ba753..fface2c51 100644 --- a/tools/pve/post-pve-install.sh +++ b/tools/pve/post-pve-install.sh @@ -6,7 +6,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ _ ________ ____ __ ____ __ ____ / __ \ | / / ____/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / / @@ -81,7 +81,7 @@ main() { case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/pve8-upgrade.sh b/tools/pve/pve8-upgrade.sh index 6312302be..69bd1b89b 100644 --- a/tools/pve/pve8-upgrade.sh +++ b/tools/pve/pve8-upgrade.sh @@ -6,7 +6,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" ____ _ ____________ __ ______ __________ ___ ____ ______ / __ \ | / / ____( __ ) / / / / __ \/ ____/ __ \/ | / __ \/ ____/ @@ -118,7 +118,7 @@ while true; do case $yn in [Yy]*) break ;; [Nn]*) - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit ;; *) echo "Please answer yes or no." ;; diff --git a/tools/pve/scaling-governor.sh b/tools/pve/scaling-governor.sh index 79622844c..49ab7189d 100644 --- a/tools/pve/scaling-governor.sh +++ b/tools/pve/scaling-governor.sh @@ -11,7 +11,7 @@ source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "scaling-governor" "pve" header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat </dev/null || printf '\033[H\033[2J\033[3J' exit 0 fi @@ -42,7 +42,7 @@ done < <(tr ' ' '\n' <"$GOV_BASE/scaling_available_governors" | sed '/^$/d' | gr scaling_governor=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current CPU Scaling Governor is set to $current_governor" --radiolist "\nSelect the Scaling Governor to use:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${GOVERNORS_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') [ -z "$scaling_governor" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No CPU Scaling Governor Selected" --msgbox "It appears that no CPU Scaling Governor was selected" 10 68 - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' exit } echo "${scaling_governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null diff --git a/tools/pve/storage-share-helper.sh b/tools/pve/storage-share-helper.sh index 36f04f8ac..d04ba0f9f 100644 --- a/tools/pve/storage-share-helper.sh +++ b/tools/pve/storage-share-helper.sh @@ -11,7 +11,7 @@ declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "storage-share set -eEuo pipefail function header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" _____ __ ___ _________ / ___// /_____ _________ _____ ____ / | / _/ __ \ diff --git a/tools/pve/update-lxcs.sh b/tools/pve/update-lxcs.sh index ec3dd34f2..252972051 100644 --- a/tools/pve/update-lxcs.sh +++ b/tools/pve/update-lxcs.sh @@ -6,7 +6,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE function header_info() { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" __ __ __ __ __ _ ________ / / / /___ ____/ /___ _/ /____ / / | |/ / ____/ diff --git a/tools/pve/update-repo.sh b/tools/pve/update-repo.sh index c84a3530f..7293a7c8e 100644 --- a/tools/pve/update-repo.sh +++ b/tools/pve/update-repo.sh @@ -6,7 +6,7 @@ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE function header_info { - clear + clear 2>/dev/null || printf '\033[H\033[2J\033[3J' cat <<"EOF" __ __ __ __ ____ / / / /___ ____/ /___ _/ /____ / __ \___ ____ ____