From 2fa9ae03a15ba61ceed6a7dab45d6ce8d7582cdd Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Fri, 22 May 2026 09:08:13 +0200 Subject: [PATCH] core: suppress MOTD for non-interactive shells (#14638) --- misc/alpine-install.func | 3 ++- misc/build.func | 2 +- misc/core.func | 6 ++++-- misc/install.func | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/misc/alpine-install.func b/misc/alpine-install.func index 47935947f..874558e2f 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -183,7 +183,8 @@ motd_ssh() { PROFILE_FILE="/etc/profile.d/00_lxc-details.sh" - echo "echo -e \"\"" >"$PROFILE_FILE" + echo "[ -t 1 ] || return 0" >"$PROFILE_FILE" + echo "echo -e \"\"" >>"$PROFILE_FILE" echo -e "echo -e \"${BOLD}${APPLICATION} LXC Container${CL}"\" >>"$PROFILE_FILE" echo -e "echo -e \"${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >>"$PROFILE_FILE" echo "echo \"\"" >>"$PROFILE_FILE" diff --git a/misc/build.func b/misc/build.func index 890f6974c..39e41ef89 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3643,7 +3643,7 @@ start() { run_addon_updates update_motd_ip cleanup_lxc - elif ! command -v whiptail &>/dev/null || ! [ -t 0 ]; then + elif ! command -v whiptail &>/dev/null || ! [ -t 0 ] || [[ "$TERM" == "dumb" ]]; then msg_info "No interactive terminal detected – defaulting to silent update mode" VERBOSE="no" set_std_mode diff --git a/misc/core.func b/misc/core.func index d574a16b4..e209ae1fe 100644 --- a/misc/core.func +++ b/misc/core.func @@ -140,10 +140,12 @@ ensure_profile_loaded() { [[ -n "${_PROFILE_LOADED:-}" ]] && return command -v pveversion &>/dev/null && return - # Source all profile.d scripts to ensure PATH is complete + # Source all profile.d scripts to ensure PATH is complete. + # Redirect stdout to suppress banner/MOTD output (e.g. 00_lxc-details.sh) + # while still allowing env/PATH exports to take effect. if [[ -d /etc/profile.d ]]; then for script in /etc/profile.d/*.sh; do - [[ -r "$script" ]] && source "$script" || true + [[ -r "$script" ]] && source "$script" >/dev/null || true done fi diff --git a/misc/install.func b/misc/install.func index baeac2d76..abb245dd9 100644 --- a/misc/install.func +++ b/misc/install.func @@ -456,7 +456,8 @@ motd_ssh() { PROFILE_FILE="/etc/profile.d/00_lxc-details.sh" - echo "echo -e \"\"" >"$PROFILE_FILE" + echo "[ -t 1 ] || return 0" >"$PROFILE_FILE" + echo "echo -e \"\"" >>"$PROFILE_FILE" echo -e "echo -e \"${BOLD}${APPLICATION} LXC Container${CL}"\" >>"$PROFILE_FILE" echo -e "echo -e \"${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >>"$PROFILE_FILE" echo "echo \"\"" >>"$PROFILE_FILE"