diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 1dfe36ebc..c11dd19a0 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -6,7 +6,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://forgejo.org/ -APP="Forgejo Runner" +APP="Forgejo-Runner" var_tags="${var_tags:-ci}" var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" diff --git a/misc/build.func b/misc/build.func index cdcb7f2cc..7c431dc99 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3461,6 +3461,10 @@ build_container() { export DEV_MODE_LOGS="${DEV_MODE_LOGS:-false}" export DEV_MODE_DRYRUN="${DEV_MODE_DRYRUN:-false}" + # MODE export for unattended detection in install scripts + # This tells install scripts whether to prompt for input or use defaults + export MODE="${METHOD:-default}" + # Build PCT_OPTIONS as multi-line string PCT_OPTIONS_STRING=" -hostname $HN" diff --git a/misc/core.func b/misc/core.func index 10e40a501..1aa910c1c 100644 --- a/misc/core.func +++ b/misc/core.func @@ -813,15 +813,60 @@ is_verbose_mode() { # ------------------------------------------------------------------------------ # is_unattended() # -# - Detects if script is running in unattended/silent mode -# - Checks PHS_SILENT, var_unattended, and UNATTENDED variables +# - Detects if script is running in unattended/non-interactive mode +# - Checks MODE variable first (primary method) +# - Falls back to legacy flags (PHS_SILENT, var_unattended) # - Returns 0 (true) if unattended, 1 (false) otherwise # - Used by prompt functions to auto-apply defaults +# +# Modes that are unattended: +# - default (1) : Use script defaults, no prompts +# - mydefaults (3) : Use user's default.vars, no prompts +# - appdefaults (4) : Use app-specific defaults, no prompts +# +# Modes that are interactive: +# - advanced (2) : Full wizard with all options +# +# Note: Even in advanced mode, install scripts run unattended because +# all values are already collected during the wizard phase. # ------------------------------------------------------------------------------ is_unattended() { + # Primary: Check MODE variable (case-insensitive) + local mode="${MODE:-${mode:-}}" + mode="${mode,,}" # lowercase + + case "$mode" in + default|1) + return 0 + ;; + mydefaults|userdefaults|3) + return 0 + ;; + appdefaults|4) + return 0 + ;; + advanced|2) + # Advanced mode is interactive ONLY during wizard + # Inside container (install scripts), it should be unattended + # Check if we're inside a container (no pveversion command) + if ! command -v pveversion &>/dev/null; then + # We're inside the container - all values already collected + return 0 + fi + # On host during wizard - interactive + return 1 + ;; + esac + + # Legacy fallbacks for compatibility [[ "${PHS_SILENT:-0}" == "1" ]] && return 0 [[ "${var_unattended:-}" =~ ^(yes|true|1)$ ]] && return 0 [[ "${UNATTENDED:-}" =~ ^(yes|true|1)$ ]] && return 0 + + # No TTY available = unattended + [[ ! -t 0 ]] && return 0 + + # Default: interactive return 1 }