From cd9b73392ac5be3e478778436fd49a43940f48a8 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 31 Mar 2025 10:28:16 +0200 Subject: [PATCH] switch ssh_check to dialog --- misc/build.func | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/misc/build.func b/misc/build.func index 066f232..5c62247 100644 --- a/misc/build.func +++ b/misc/build.func @@ -330,14 +330,24 @@ header_info() { # This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit. 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 + if [[ -n "${SSH_CLIENT:+x}" ]]; then + dialog --backtitle "[dev] Proxmox VE Helper Scripts" \ + --title "SSH DETECTED" \ + --yesno "It's advisable to utilize the Proxmox shell rather than SSH,\nas there may be potential complications with variable retrieval.\n\nProceed using SSH?" 12 72 \ + --ok-label "Yes" --cancel-label "No" + + case $? in + 0) + dialog --backtitle "[dev] Proxmox VE Helper Scripts" \ + --title "Proceed using SSH" \ + --msgbox "You've chosen to proceed using SSH.\n\nIf any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72 + ;; + 1 | 255) clear - echo "Exiting due to SSH usage. Please consider using the Proxmox shell." + printf "%s\n" "Exiting due to SSH usage. Please consider using the Proxmox shell." exit - fi + ;; + esac fi }