Move and improve ssh_check and shell_check functions

The ssh_check function was moved from build.func to core.func and enhanced to allow an override and to skip warnings for localhost connections. The shell_check function was simplified to directly check for Bash and provide clearer messaging. These changes centralize environment checks and improve user experience.
This commit is contained in:
CanbiZ
2025-09-23 14:39:39 +02:00
parent 435890eee2
commit d0f6818386
2 changed files with 36 additions and 26 deletions

View File

@@ -239,25 +239,6 @@ update_motd_ip() {
fi
}
# ------------------------------------------------------------------------------
# ssh_check()
#
# - Detects if script is running over SSH
# - Warns user and recommends using Proxmox shell
# - User can choose to continue or abort
# ------------------------------------------------------------------------------
ssh_check() {
if [ -n "${SSH_CLIENT:+x}" ]; then
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's advisable to utilize the Proxmox shell rather than SSH, as there may be potential complications with variable retrieval. Proceed using SSH?" 10 72; then
whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Proceed using SSH" "You've chosen to proceed using SSH. If any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72
else
clear
echo "Exiting due to SSH usage. Please consider using the Proxmox shell."
exit
fi
fi
}
# ------------------------------------------------------------------------------
# install_ssh_keys_into_ct()
#