Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
#!/usr/bin/env bash
|
2026-01-06 13:28:12 +01:00
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/LICENSE
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# CORE FUNCTIONS - LXC CONTAINER UTILITIES
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
#
|
|
|
|
|
|
# This file provides core utility functions for LXC container management
|
|
|
|
|
|
# including colors, formatting, validation checks, message output, and
|
|
|
|
|
|
# execution helpers used throughout the Community-Scripts ecosystem.
|
|
|
|
|
|
#
|
|
|
|
|
|
# Usage:
|
|
|
|
|
|
# source <(curl -fsSL https://git.community-scripts.org/.../core.func)
|
|
|
|
|
|
# load_functions
|
|
|
|
|
|
#
|
|
|
|
|
|
# ==============================================================================
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
|
|
|
|
|
[[ -n "${_CORE_FUNC_LOADED:-}" ]] && return
|
|
|
|
|
|
_CORE_FUNC_LOADED=1
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SECTION 1: INITIALIZATION & SETUP
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# load_functions()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Initializes all core utility groups (colors, formatting, icons, defaults)
|
|
|
|
|
|
# - Ensures functions are loaded only once via __FUNCTIONS_LOADED flag
|
|
|
|
|
|
# - Must be called at start of any script using these utilities
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
load_functions() {
|
|
|
|
|
|
[[ -n "${__FUNCTIONS_LOADED:-}" ]] && return
|
|
|
|
|
|
__FUNCTIONS_LOADED=1
|
|
|
|
|
|
color
|
|
|
|
|
|
formatting
|
|
|
|
|
|
icons
|
|
|
|
|
|
default_vars
|
|
|
|
|
|
set_std_mode
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# color()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Sets ANSI color codes for styled terminal output
|
|
|
|
|
|
# - Variables: YW (yellow), YWB (yellow bright), BL (blue), RD (red)
|
|
|
|
|
|
# GN (green), DGN (dark green), BGN (background green), CL (clear)
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
color() {
|
|
|
|
|
|
YW=$(echo "\033[33m")
|
|
|
|
|
|
YWB=$'\e[93m'
|
|
|
|
|
|
BL=$(echo "\033[36m")
|
|
|
|
|
|
RD=$(echo "\033[01;31m")
|
|
|
|
|
|
BGN=$(echo "\033[4;92m")
|
|
|
|
|
|
GN=$(echo "\033[1;92m")
|
|
|
|
|
|
DGN=$(echo "\033[32m")
|
|
|
|
|
|
CL=$(echo "\033[m")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# color_spinner()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Sets ANSI color codes specifically for spinner animation
|
|
|
|
|
|
# - Variables: CS_YW (spinner yellow), CS_YWB (spinner yellow bright),
|
|
|
|
|
|
# CS_CL (spinner clear)
|
|
|
|
|
|
# - Used by spinner() function to avoid color conflicts
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-07-04 21:22:50 +02:00
|
|
|
|
color_spinner() {
|
|
|
|
|
|
CS_YW=$'\033[33m'
|
|
|
|
|
|
CS_YWB=$'\033[93m'
|
|
|
|
|
|
CS_CL=$'\033[m'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# formatting()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Defines formatting helpers for terminal output
|
|
|
|
|
|
# - BFR: Backspace and clear line sequence
|
|
|
|
|
|
# - BOLD: Bold text escape code
|
|
|
|
|
|
# - TAB/TAB3: Indentation spacing
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
formatting() {
|
|
|
|
|
|
BFR="\\r\\033[K"
|
|
|
|
|
|
BOLD=$(echo "\033[1m")
|
|
|
|
|
|
HOLD=" "
|
|
|
|
|
|
TAB=" "
|
|
|
|
|
|
TAB3=" "
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# icons()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Sets symbolic emoji icons used throughout user feedback
|
|
|
|
|
|
# - Provides consistent visual indicators for success, error, info, etc.
|
|
|
|
|
|
# - Icons: CM (checkmark), CROSS (error), INFO (info), HOURGLASS (wait), etc.
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
icons() {
|
|
|
|
|
|
CM="${TAB}✔️${TAB}"
|
|
|
|
|
|
CROSS="${TAB}✖️${TAB}"
|
|
|
|
|
|
DNSOK="✔️ "
|
|
|
|
|
|
DNSFAIL="${TAB}✖️${TAB}"
|
|
|
|
|
|
INFO="${TAB}💡${TAB}${CL}"
|
|
|
|
|
|
OS="${TAB}🖥️${TAB}${CL}"
|
|
|
|
|
|
OSVERSION="${TAB}🌟${TAB}${CL}"
|
|
|
|
|
|
CONTAINERTYPE="${TAB}📦${TAB}${CL}"
|
|
|
|
|
|
DISKSIZE="${TAB}💾${TAB}${CL}"
|
|
|
|
|
|
CPUCORE="${TAB}🧠${TAB}${CL}"
|
|
|
|
|
|
RAMSIZE="${TAB}🛠️${TAB}${CL}"
|
|
|
|
|
|
SEARCH="${TAB}🔍${TAB}${CL}"
|
|
|
|
|
|
VERBOSE_CROPPED="🔍${TAB}"
|
|
|
|
|
|
VERIFYPW="${TAB}🔐${TAB}${CL}"
|
|
|
|
|
|
CONTAINERID="${TAB}🆔${TAB}${CL}"
|
|
|
|
|
|
HOSTNAME="${TAB}🏠${TAB}${CL}"
|
|
|
|
|
|
BRIDGE="${TAB}🌉${TAB}${CL}"
|
|
|
|
|
|
NETWORK="${TAB}📡${TAB}${CL}"
|
|
|
|
|
|
GATEWAY="${TAB}🌐${TAB}${CL}"
|
|
|
|
|
|
DISABLEIPV6="${TAB}🚫${TAB}${CL}"
|
|
|
|
|
|
DEFAULT="${TAB}⚙️${TAB}${CL}"
|
|
|
|
|
|
MACADDRESS="${TAB}🔗${TAB}${CL}"
|
|
|
|
|
|
VLANTAG="${TAB}🏷️${TAB}${CL}"
|
|
|
|
|
|
ROOTSSH="${TAB}🔑${TAB}${CL}"
|
|
|
|
|
|
CREATING="${TAB}🚀${TAB}${CL}"
|
|
|
|
|
|
ADVANCED="${TAB}🧩${TAB}${CL}"
|
|
|
|
|
|
FUSE="${TAB}🗂️${TAB}${CL}"
|
feat: Add var_gpu flag for GPU passthrough configuration (#9764)
* feat: Add var_gpu flag for GPU passthrough configuration
Changes:
- Add var_gpu variable to CT scripts for explicit GPU control
- Remove hardcoded GPU_APPS list - GPU detection now uses var_gpu flag
- Add var_gpu to VAR_WHITELIST for persistence in default.vars and app.vars
- Add GPU Passthrough option (Step 19) to advanced_settings wizard (now 20 steps)
- Update documentation
Apps with var_gpu=yes (GPU enabled by default):
- Media: jellyfin, plex, emby, channels, ersatztv, tunarr
- Transcoding: tdarr, unmanic, fileflows
- AI/ML: ollama, openwebui
- NVR: frigate, immich
Usage:
- Disable GPU: var_gpu=no bash -c '$(curl -fsSL ...jellyfin.sh)'
- Enable GPU: var_gpu=yes bash -c '$(curl -fsSL ...debian.sh)'
- Via default.vars: echo 'var_gpu=yes' >> /usr/local/community-scripts/default.vars
- Via advanced settings wizard (Step 19)
* fix: tput rmcup timing, GPU line indentation, echo_default GPU display
* style: add GPU icon variable for consistent formatting
2025-12-08 13:52:30 +01:00
|
|
|
|
GPU="${TAB}🎮${TAB}${CL}"
|
2025-06-20 15:10:50 +02:00
|
|
|
|
HOURGLASS="${TAB}⏳${TAB}"
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 14:59:41 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# ensure_profile_loaded()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Sources /etc/profile.d/*.sh scripts if not already loaded
|
|
|
|
|
|
# - Fixes PATH issues when running via pct enter/exec (non-login shells)
|
|
|
|
|
|
# - Safe to call multiple times (uses guard variable)
|
|
|
|
|
|
# - Should be called in update_script() or any script running inside LXC
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
ensure_profile_loaded() {
|
|
|
|
|
|
# Skip if already loaded or running on Proxmox host
|
|
|
|
|
|
[[ -n "${_PROFILE_LOADED:-}" ]] && return
|
|
|
|
|
|
command -v pveversion &>/dev/null && return
|
|
|
|
|
|
|
|
|
|
|
|
# Source all profile.d scripts to ensure PATH is complete
|
|
|
|
|
|
if [[ -d /etc/profile.d ]]; then
|
|
|
|
|
|
for script in /etc/profile.d/*.sh; do
|
|
|
|
|
|
[[ -r "$script" ]] && source "$script"
|
|
|
|
|
|
done
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Also ensure /usr/local/bin is in PATH (common install location)
|
|
|
|
|
|
if [[ ":$PATH:" != *":/usr/local/bin:"* ]]; then
|
|
|
|
|
|
export PATH="/usr/local/bin:$PATH"
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
export _PROFILE_LOADED=1
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# default_vars()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Sets default retry and wait variables used for system actions
|
|
|
|
|
|
# - RETRY_NUM: Maximum number of retry attempts (default: 10)
|
|
|
|
|
|
# - RETRY_EVERY: Seconds to wait between retries (default: 3)
|
|
|
|
|
|
# - i: Counter variable initialized to RETRY_NUM
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
default_vars() {
|
|
|
|
|
|
RETRY_NUM=10
|
|
|
|
|
|
RETRY_EVERY=3
|
|
|
|
|
|
i=$RETRY_NUM
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# set_std_mode()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Sets default verbose mode for script and OS execution
|
|
|
|
|
|
# - If VERBOSE=yes: STD="" (show all output)
|
|
|
|
|
|
# - If VERBOSE=no: STD="silent" (suppress output via silent() wrapper)
|
|
|
|
|
|
# - If DEV_MODE_TRACE=true: Enables bash tracing (set -x)
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
set_std_mode() {
|
|
|
|
|
|
if [ "${VERBOSE:-no}" = "yes" ]; then
|
|
|
|
|
|
STD=""
|
|
|
|
|
|
else
|
|
|
|
|
|
STD="silent"
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# Enable bash tracing if trace mode active
|
|
|
|
|
|
if [[ "${DEV_MODE_TRACE:-false}" == "true" ]]; then
|
|
|
|
|
|
set -x
|
|
|
|
|
|
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# parse_dev_mode()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Parses comma-separated dev_mode variable (e.g., "motd,keep,trace")
|
|
|
|
|
|
# - Sets global flags for each mode:
|
|
|
|
|
|
# * DEV_MODE_MOTD: Setup SSH/MOTD before installation
|
|
|
|
|
|
# * DEV_MODE_KEEP: Never delete container on failure
|
|
|
|
|
|
# * DEV_MODE_TRACE: Enable bash set -x tracing
|
|
|
|
|
|
# * DEV_MODE_PAUSE: Pause after each msg_info step
|
|
|
|
|
|
# * DEV_MODE_BREAKPOINT: Open shell on error instead of cleanup
|
|
|
|
|
|
# * DEV_MODE_LOGS: Persist all logs to /var/log/community-scripts/
|
|
|
|
|
|
# * DEV_MODE_DRYRUN: Show commands without executing
|
|
|
|
|
|
# - Call this early in script execution
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
parse_dev_mode() {
|
|
|
|
|
|
local mode
|
|
|
|
|
|
# Initialize all flags to false
|
|
|
|
|
|
export DEV_MODE_MOTD=false
|
|
|
|
|
|
export DEV_MODE_KEEP=false
|
|
|
|
|
|
export DEV_MODE_TRACE=false
|
|
|
|
|
|
export DEV_MODE_PAUSE=false
|
|
|
|
|
|
export DEV_MODE_BREAKPOINT=false
|
|
|
|
|
|
export DEV_MODE_LOGS=false
|
|
|
|
|
|
export DEV_MODE_DRYRUN=false
|
|
|
|
|
|
|
|
|
|
|
|
# Parse comma-separated modes
|
|
|
|
|
|
if [[ -n "${dev_mode:-}" ]]; then
|
|
|
|
|
|
IFS=',' read -ra MODES <<<"$dev_mode"
|
|
|
|
|
|
for mode in "${MODES[@]}"; do
|
|
|
|
|
|
mode="$(echo "$mode" | xargs)" # Trim whitespace
|
|
|
|
|
|
case "$mode" in
|
|
|
|
|
|
motd) export DEV_MODE_MOTD=true ;;
|
|
|
|
|
|
keep) export DEV_MODE_KEEP=true ;;
|
|
|
|
|
|
trace) export DEV_MODE_TRACE=true ;;
|
|
|
|
|
|
pause) export DEV_MODE_PAUSE=true ;;
|
|
|
|
|
|
breakpoint) export DEV_MODE_BREAKPOINT=true ;;
|
|
|
|
|
|
logs) export DEV_MODE_LOGS=true ;;
|
|
|
|
|
|
dryrun) export DEV_MODE_DRYRUN=true ;;
|
|
|
|
|
|
*)
|
|
|
|
|
|
if declare -f msg_warn >/dev/null 2>&1; then
|
|
|
|
|
|
msg_warn "Unknown dev_mode: '$mode' (ignored)"
|
|
|
|
|
|
else
|
|
|
|
|
|
echo "[WARN] Unknown dev_mode: '$mode' (ignored)" >&2
|
|
|
|
|
|
fi
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Show active dev modes
|
|
|
|
|
|
local active_modes=()
|
|
|
|
|
|
[[ $DEV_MODE_MOTD == true ]] && active_modes+=("motd")
|
|
|
|
|
|
[[ $DEV_MODE_KEEP == true ]] && active_modes+=("keep")
|
|
|
|
|
|
[[ $DEV_MODE_TRACE == true ]] && active_modes+=("trace")
|
|
|
|
|
|
[[ $DEV_MODE_PAUSE == true ]] && active_modes+=("pause")
|
|
|
|
|
|
[[ $DEV_MODE_BREAKPOINT == true ]] && active_modes+=("breakpoint")
|
|
|
|
|
|
[[ $DEV_MODE_LOGS == true ]] && active_modes+=("logs")
|
|
|
|
|
|
[[ $DEV_MODE_DRYRUN == true ]] && active_modes+=("dryrun")
|
|
|
|
|
|
|
|
|
|
|
|
if [[ ${#active_modes[@]} -gt 0 ]]; then
|
|
|
|
|
|
if declare -f msg_custom >/dev/null 2>&1; then
|
|
|
|
|
|
msg_custom "🔧" "${YWB}" "Dev modes active: ${active_modes[*]}"
|
|
|
|
|
|
else
|
|
|
|
|
|
echo "[DEV] Active modes: ${active_modes[*]}" >&2
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
}
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SECTION 2: VALIDATION CHECKS
|
|
|
|
|
|
# ==============================================================================
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# shell_check()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Verifies that the script is running under Bash shell
|
|
|
|
|
|
# - Exits with error message if different shell is detected
|
|
|
|
|
|
# - Required because scripts use Bash-specific features
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
shell_check() {
|
|
|
|
|
|
if [[ "$(ps -p $$ -o comm=)" != "bash" ]]; then
|
|
|
|
|
|
clear
|
|
|
|
|
|
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
|
|
|
|
|
|
echo -e "\nExiting..."
|
|
|
|
|
|
sleep 2
|
|
|
|
|
|
exit
|
2025-06-02 10:39:46 +02:00
|
|
|
|
fi
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
}
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# root_check()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Verifies script is running with root privileges
|
|
|
|
|
|
# - Detects if executed via sudo (which can cause issues)
|
|
|
|
|
|
# - Exits with error if not running as root directly
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
root_check() {
|
|
|
|
|
|
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
|
|
|
|
|
|
clear
|
|
|
|
|
|
msg_error "Please run this script as root."
|
|
|
|
|
|
echo -e "\nExiting..."
|
|
|
|
|
|
sleep 2
|
|
|
|
|
|
exit
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# pve_check()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Validates Proxmox VE version compatibility
|
|
|
|
|
|
# - Supported: PVE 8.0-8.9 and PVE 9.0-9.1
|
|
|
|
|
|
# - Exits with error message if unsupported version detected
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
pve_check() {
|
|
|
|
|
|
local PVE_VER
|
|
|
|
|
|
PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
|
|
|
|
|
|
|
|
|
|
|
# Check for Proxmox VE 8.x: allow 8.0–8.9
|
|
|
|
|
|
if [[ "$PVE_VER" =~ ^8\.([0-9]+) ]]; then
|
|
|
|
|
|
local MINOR="${BASH_REMATCH[1]}"
|
|
|
|
|
|
if ((MINOR < 0 || MINOR > 9)); then
|
|
|
|
|
|
msg_error "This version of Proxmox VE is not supported."
|
|
|
|
|
|
msg_error "Supported: Proxmox VE version 8.0 – 8.9"
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# Check for Proxmox VE 9.x: allow 9.0–9.1
|
|
|
|
|
|
if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
|
|
|
|
|
local MINOR="${BASH_REMATCH[1]}"
|
|
|
|
|
|
if ((MINOR < 0 || MINOR > 1)); then
|
|
|
|
|
|
msg_error "This version of Proxmox VE is not yet supported."
|
|
|
|
|
|
msg_error "Supported: Proxmox VE version 9.0 – 9.1"
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# All other unsupported versions
|
|
|
|
|
|
msg_error "This version of Proxmox VE is not supported."
|
|
|
|
|
|
msg_error "Supported versions: Proxmox VE 8.0 – 8.9 or 9.0 – 9.1"
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
}
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# arch_check()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Validates system architecture is amd64/x86_64
|
|
|
|
|
|
# - Exits with error message for unsupported architectures (e.g., ARM/PiMox)
|
|
|
|
|
|
# - Provides link to ARM64-compatible scripts
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
arch_check() {
|
|
|
|
|
|
if [ "$(dpkg --print-architecture)" != "amd64" ]; then
|
|
|
|
|
|
echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n"
|
|
|
|
|
|
echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n"
|
|
|
|
|
|
echo -e "Exiting..."
|
|
|
|
|
|
sleep 2
|
|
|
|
|
|
exit
|
2025-06-02 10:39:46 +02:00
|
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# ssh_check()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Detects if script is running over SSH connection
|
|
|
|
|
|
# - Warns user for external SSH connections (recommends Proxmox shell)
|
|
|
|
|
|
# - Skips warning for local/same-subnet connections
|
|
|
|
|
|
# - Does not abort execution, only warns
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
ssh_check() {
|
|
|
|
|
|
if [ -n "$SSH_CLIENT" ]; then
|
|
|
|
|
|
local client_ip=$(awk '{print $1}' <<<"$SSH_CLIENT")
|
|
|
|
|
|
local host_ip=$(hostname -I | awk '{print $1}')
|
|
|
|
|
|
|
|
|
|
|
|
# Check if connection is local (Proxmox WebUI or same machine)
|
|
|
|
|
|
# - localhost (127.0.0.1, ::1)
|
|
|
|
|
|
# - same IP as host
|
|
|
|
|
|
# - local network range (10.x, 172.16-31.x, 192.168.x)
|
|
|
|
|
|
if [[ "$client_ip" == "127.0.0.1" || "$client_ip" == "::1" || "$client_ip" == "$host_ip" ]]; then
|
|
|
|
|
|
return
|
2025-07-04 21:22:50 +02:00
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# Check if client is in same local network (optional, safer approach)
|
|
|
|
|
|
local host_subnet=$(echo "$host_ip" | cut -d. -f1-3)
|
|
|
|
|
|
local client_subnet=$(echo "$client_ip" | cut -d. -f1-3)
|
|
|
|
|
|
if [[ "$host_subnet" == "$client_subnet" ]]; then
|
|
|
|
|
|
return
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# Only warn for truly external connections
|
|
|
|
|
|
msg_warn "Running via external SSH (client: $client_ip)."
|
|
|
|
|
|
msg_warn "For better stability, consider using the Proxmox Shell (Console) instead."
|
2025-06-02 10:39:46 +02:00
|
|
|
|
fi
|
2025-07-04 21:22:50 +02:00
|
|
|
|
}
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SECTION 3: EXECUTION HELPERS
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# get_active_logfile()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Returns the appropriate log file based on execution context
|
|
|
|
|
|
# - BUILD_LOG: Host operations (container creation)
|
|
|
|
|
|
# - INSTALL_LOG: Container operations (application installation)
|
|
|
|
|
|
# - Fallback to BUILD_LOG if neither is set
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
get_active_logfile() {
|
|
|
|
|
|
if [[ -n "${INSTALL_LOG:-}" ]]; then
|
|
|
|
|
|
echo "$INSTALL_LOG"
|
|
|
|
|
|
elif [[ -n "${BUILD_LOG:-}" ]]; then
|
|
|
|
|
|
echo "$BUILD_LOG"
|
2025-07-04 21:22:50 +02:00
|
|
|
|
else
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# Fallback for legacy scripts
|
|
|
|
|
|
echo "/tmp/build-$(date +%Y%m%d_%H%M%S).log"
|
2025-07-04 21:22:50 +02:00
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# Legacy compatibility: SILENT_LOGFILE points to active log
|
|
|
|
|
|
SILENT_LOGFILE="$(get_active_logfile)"
|
|
|
|
|
|
|
2025-06-02 10:39:46 +02:00
|
|
|
|
# ------------------------------------------------------------------------------
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# silent()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Executes command with output redirected to active log file
|
|
|
|
|
|
# - On error: displays last 10 lines of log and exits with original exit code
|
|
|
|
|
|
# - Temporarily disables error trap to capture exit code correctly
|
|
|
|
|
|
# - Sources explain_exit_code() for detailed error messages
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
silent() {
|
|
|
|
|
|
local cmd="$*"
|
|
|
|
|
|
local caller_line="${BASH_LINENO[0]:-unknown}"
|
|
|
|
|
|
local logfile="$(get_active_logfile)"
|
|
|
|
|
|
|
|
|
|
|
|
# Dryrun mode: Show command without executing
|
|
|
|
|
|
if [[ "${DEV_MODE_DRYRUN:-false}" == "true" ]]; then
|
|
|
|
|
|
if declare -f msg_custom >/dev/null 2>&1; then
|
|
|
|
|
|
msg_custom "🔍" "${BL}" "[DRYRUN] $cmd"
|
|
|
|
|
|
else
|
|
|
|
|
|
echo "[DRYRUN] $cmd" >&2
|
|
|
|
|
|
fi
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
set +Eeuo pipefail
|
|
|
|
|
|
trap - ERR
|
|
|
|
|
|
|
|
|
|
|
|
"$@" >>"$logfile" 2>&1
|
|
|
|
|
|
local rc=$?
|
|
|
|
|
|
|
|
|
|
|
|
set -Eeuo pipefail
|
|
|
|
|
|
trap 'error_handler' ERR
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $rc -ne 0 ]]; then
|
|
|
|
|
|
# Source explain_exit_code if needed
|
|
|
|
|
|
if ! declare -f explain_exit_code >/dev/null 2>&1; then
|
|
|
|
|
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local explanation
|
|
|
|
|
|
explanation="$(explain_exit_code "$rc")"
|
|
|
|
|
|
|
|
|
|
|
|
printf "\e[?25h"
|
|
|
|
|
|
msg_error "in line ${caller_line}: exit code ${rc} (${explanation})"
|
|
|
|
|
|
msg_custom "→" "${YWB}" "${cmd}"
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -s "$logfile" ]]; then
|
|
|
|
|
|
local log_lines=$(wc -l <"$logfile")
|
|
|
|
|
|
echo "--- Last 10 lines of silent log ---"
|
|
|
|
|
|
tail -n 10 "$logfile"
|
|
|
|
|
|
echo "-----------------------------------"
|
|
|
|
|
|
|
|
|
|
|
|
# Show how to view full log if there are more lines
|
|
|
|
|
|
if [[ $log_lines -gt 10 ]]; then
|
|
|
|
|
|
msg_custom "📋" "${YW}" "View full log (${log_lines} lines): ${logfile}"
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
exit "$rc"
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# spinner()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays animated spinner with rotating characters (⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏)
|
|
|
|
|
|
# - Shows SPINNER_MSG alongside animation
|
|
|
|
|
|
# - Runs in infinite loop until killed by stop_spinner()
|
|
|
|
|
|
# - Uses color_spinner() colors for output
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-07-04 21:22:50 +02:00
|
|
|
|
spinner() {
|
|
|
|
|
|
local chars=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏)
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
local msg="${SPINNER_MSG:-Processing...}"
|
2025-07-04 21:22:50 +02:00
|
|
|
|
local i=0
|
|
|
|
|
|
while true; do
|
|
|
|
|
|
local index=$((i++ % ${#chars[@]}))
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
printf "\r\033[2K%s %b" "${CS_YWB}${chars[$index]}${CS_CL}" "${CS_YWB}${msg}${CS_CL}"
|
2025-07-04 21:22:50 +02:00
|
|
|
|
sleep 0.1
|
|
|
|
|
|
done
|
|
|
|
|
|
}
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# clear_line()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Clears current terminal line using tput or ANSI escape codes
|
|
|
|
|
|
# - Moves cursor to beginning of line (carriage return)
|
|
|
|
|
|
# - Erases from cursor to end of line
|
|
|
|
|
|
# - Fallback to ANSI codes if tput not available
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-07-04 21:22:50 +02:00
|
|
|
|
clear_line() {
|
|
|
|
|
|
tput cr 2>/dev/null || echo -en "\r"
|
|
|
|
|
|
tput el 2>/dev/null || echo -en "\033[K"
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# stop_spinner()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Stops running spinner process by PID
|
|
|
|
|
|
# - Reads PID from SPINNER_PID variable or /tmp/.spinner.pid file
|
|
|
|
|
|
# - Attempts graceful kill, then forced kill if needed
|
|
|
|
|
|
# - Cleans up temp file and resets terminal state
|
|
|
|
|
|
# - Unsets SPINNER_PID and SPINNER_MSG variables
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
stop_spinner() {
|
2025-07-04 21:22:50 +02:00
|
|
|
|
local pid="${SPINNER_PID:-}"
|
|
|
|
|
|
[[ -z "$pid" && -f /tmp/.spinner.pid ]] && pid=$(</tmp/.spinner.pid)
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -n "$pid" && "$pid" =~ ^[0-9]+$ ]]; then
|
|
|
|
|
|
if kill "$pid" 2>/dev/null; then
|
|
|
|
|
|
sleep 0.05
|
|
|
|
|
|
kill -9 "$pid" 2>/dev/null || true
|
|
|
|
|
|
wait "$pid" 2>/dev/null || true
|
2025-06-02 10:39:46 +02:00
|
|
|
|
fi
|
2025-07-04 21:22:50 +02:00
|
|
|
|
rm -f /tmp/.spinner.pid
|
2025-06-02 10:39:46 +02:00
|
|
|
|
fi
|
|
|
|
|
|
|
2025-07-04 21:22:50 +02:00
|
|
|
|
unset SPINNER_PID SPINNER_MSG
|
|
|
|
|
|
stty sane 2>/dev/null || true
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SECTION 4: MESSAGE OUTPUT
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_info()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays informational message with spinner animation
|
|
|
|
|
|
# - Shows each unique message only once (tracked via MSG_INFO_SHOWN)
|
|
|
|
|
|
# - In verbose/Alpine mode: shows hourglass icon instead of spinner
|
|
|
|
|
|
# - Stops any existing spinner before starting new one
|
|
|
|
|
|
# - Backgrounds spinner process and stores PID for later cleanup
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
msg_info() {
|
|
|
|
|
|
local msg="$1"
|
2025-07-04 21:22:50 +02:00
|
|
|
|
[[ -z "$msg" ]] && return
|
|
|
|
|
|
|
|
|
|
|
|
if ! declare -p MSG_INFO_SHOWN &>/dev/null || ! declare -A MSG_INFO_SHOWN &>/dev/null; then
|
|
|
|
|
|
declare -gA MSG_INFO_SHOWN=()
|
|
|
|
|
|
fi
|
|
|
|
|
|
[[ -n "${MSG_INFO_SHOWN["$msg"]+x}" ]] && return
|
2025-06-02 10:39:46 +02:00
|
|
|
|
MSG_INFO_SHOWN["$msg"]=1
|
2025-06-20 13:28:06 +02:00
|
|
|
|
|
2025-06-02 10:39:46 +02:00
|
|
|
|
stop_spinner
|
2025-07-04 21:22:50 +02:00
|
|
|
|
SPINNER_MSG="$msg"
|
2025-06-20 13:28:06 +02:00
|
|
|
|
|
2025-07-04 21:22:50 +02:00
|
|
|
|
if is_verbose_mode || is_alpine; then
|
|
|
|
|
|
local HOURGLASS="${TAB}⏳${TAB}"
|
2025-06-20 15:10:50 +02:00
|
|
|
|
printf "\r\e[2K%s %b" "$HOURGLASS" "${YW}${msg}${CL}" >&2
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
|
|
|
|
|
|
# Pause mode: Wait for Enter after each step
|
|
|
|
|
|
if [[ "${DEV_MODE_PAUSE:-false}" == "true" ]]; then
|
|
|
|
|
|
echo -en "\n${YWB}[PAUSE]${CL} Press Enter to continue..." >&2
|
|
|
|
|
|
read -r
|
|
|
|
|
|
fi
|
2025-07-04 21:22:50 +02:00
|
|
|
|
return
|
2025-06-20 13:28:06 +02:00
|
|
|
|
fi
|
2025-07-04 21:22:50 +02:00
|
|
|
|
|
|
|
|
|
|
color_spinner
|
|
|
|
|
|
spinner &
|
|
|
|
|
|
SPINNER_PID=$!
|
|
|
|
|
|
echo "$SPINNER_PID" >/tmp/.spinner.pid
|
|
|
|
|
|
disown "$SPINNER_PID" 2>/dev/null || true
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
|
|
|
|
|
|
# Pause mode: Stop spinner and wait
|
|
|
|
|
|
if [[ "${DEV_MODE_PAUSE:-false}" == "true" ]]; then
|
|
|
|
|
|
stop_spinner
|
|
|
|
|
|
echo -en "\n${YWB}[PAUSE]${CL} Press Enter to continue..." >&2
|
|
|
|
|
|
read -r
|
|
|
|
|
|
fi
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_ok()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays success message with checkmark icon
|
|
|
|
|
|
# - Stops spinner and clears line before output
|
|
|
|
|
|
# - Removes message from MSG_INFO_SHOWN to allow re-display
|
|
|
|
|
|
# - Uses green color for success indication
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
msg_ok() {
|
|
|
|
|
|
local msg="$1"
|
|
|
|
|
|
[[ -z "$msg" ]] && return
|
|
|
|
|
|
stop_spinner
|
2025-07-04 21:22:50 +02:00
|
|
|
|
clear_line
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
echo -e "$CM ${GN}${msg}${CL}"
|
2025-06-02 10:39:46 +02:00
|
|
|
|
unset MSG_INFO_SHOWN["$msg"]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_error()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays error message with cross/X icon
|
|
|
|
|
|
# - Stops spinner before output
|
|
|
|
|
|
# - Uses red color for error indication
|
|
|
|
|
|
# - Outputs to stderr
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
msg_error() {
|
|
|
|
|
|
stop_spinner
|
2025-07-04 21:22:50 +02:00
|
|
|
|
local msg="$1"
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
echo -e "${BFR:-}${CROSS:-✖️} ${RD}${msg}${CL}" >&2
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_warn()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays warning message with info/lightbulb icon
|
|
|
|
|
|
# - Stops spinner before output
|
|
|
|
|
|
# - Uses bright yellow color for warning indication
|
|
|
|
|
|
# - Outputs to stderr
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
msg_warn() {
|
|
|
|
|
|
stop_spinner
|
2025-07-04 21:22:50 +02:00
|
|
|
|
local msg="$1"
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
echo -e "${BFR:-}${INFO:-ℹ️} ${YWB}${msg}${CL}" >&2
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_custom()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays custom message with user-defined symbol and color
|
|
|
|
|
|
# - Arguments: symbol, color code, message text
|
|
|
|
|
|
# - Stops spinner before output
|
|
|
|
|
|
# - Useful for specialized status messages
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
msg_custom() {
|
|
|
|
|
|
local symbol="${1:-"[*]"}"
|
2025-07-04 21:22:50 +02:00
|
|
|
|
local color="${2:-"\e[36m"}"
|
2025-06-02 10:39:46 +02:00
|
|
|
|
local msg="${3:-}"
|
|
|
|
|
|
[[ -z "$msg" ]] && return
|
2025-07-04 21:22:50 +02:00
|
|
|
|
stop_spinner
|
|
|
|
|
|
echo -e "${BFR:-} ${symbol} ${color}${msg}${CL:-\e[0m}"
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_debug()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays debug message with timestamp when var_full_verbose=1
|
|
|
|
|
|
# - Automatically enables var_verbose if not already set
|
|
|
|
|
|
# - Shows date/time prefix for log correlation
|
|
|
|
|
|
# - Uses bright yellow color for debug output
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
msg_debug() {
|
|
|
|
|
|
if [[ "${var_full_verbose:-0}" == "1" ]]; then
|
|
|
|
|
|
[[ "${var_verbose:-0}" != "1" ]] && var_verbose=1
|
|
|
|
|
|
echo -e "${YWB}[$(date '+%F %T')] [DEBUG]${CL} $*"
|
|
|
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# msg_dev()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Display development mode messages with 🔧 icon
|
|
|
|
|
|
# - Only shown when dev_mode is active
|
|
|
|
|
|
# - Useful for debugging and development-specific output
|
|
|
|
|
|
# - Format: [DEV] message with distinct formatting
|
|
|
|
|
|
# - Usage: msg_dev "Container ready for debugging"
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
msg_dev() {
|
|
|
|
|
|
if [[ -n "${dev_mode:-}" ]]; then
|
|
|
|
|
|
echo -e "${SEARCH}${BOLD}${DGN}🔧 [DEV]${CL} $*"
|
|
|
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays error message and immediately terminates script
|
|
|
|
|
|
# - Sends SIGINT to current process to trigger error handler
|
|
|
|
|
|
# - Use for unrecoverable errors that require immediate exit
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
fatal() {
|
|
|
|
|
|
msg_error "$1"
|
|
|
|
|
|
kill -INT $$
|
|
|
|
|
|
}
|
2025-06-02 10:39:46 +02:00
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SECTION 5: UTILITY FUNCTIONS
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# exit_script()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Called when user cancels an action
|
|
|
|
|
|
# - Clears screen and displays exit message
|
|
|
|
|
|
# - Exits with default exit code
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
exit_script() {
|
|
|
|
|
|
clear
|
|
|
|
|
|
echo -e "\n${CROSS}${RD}User exited script${CL}\n"
|
|
|
|
|
|
exit
|
2025-06-02 10:39:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# get_header()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Downloads and caches application header ASCII art
|
|
|
|
|
|
# - Falls back to local cache if already downloaded
|
|
|
|
|
|
# - Determines app type (ct/vm) from APP_TYPE variable
|
|
|
|
|
|
# - Returns header content or empty string on failure
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
get_header() {
|
|
|
|
|
|
local app_name=$(echo "${APP,,}" | tr -d ' ')
|
|
|
|
|
|
local app_type=${APP_TYPE:-ct} # Default to 'ct' if not set
|
|
|
|
|
|
local header_url="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/${app_type}/headers/${app_name}"
|
|
|
|
|
|
local local_header_path="/usr/local/community-scripts/headers/${app_type}/${app_name}"
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "$(dirname "$local_header_path")"
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -s "$local_header_path" ]; then
|
|
|
|
|
|
if ! curl -fsSL "$header_url" -o "$local_header_path"; then
|
|
|
|
|
|
return 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cat "$local_header_path" 2>/dev/null || true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# header_info()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Displays application header ASCII art at top of screen
|
|
|
|
|
|
# - Clears screen before displaying header
|
|
|
|
|
|
# - Detects terminal width for formatting
|
|
|
|
|
|
# - Returns silently if header not available
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
header_info() {
|
|
|
|
|
|
local app_name=$(echo "${APP,,}" | tr -d ' ')
|
|
|
|
|
|
local header_content
|
|
|
|
|
|
|
|
|
|
|
|
header_content=$(get_header "$app_name") || header_content=""
|
|
|
|
|
|
|
|
|
|
|
|
clear
|
|
|
|
|
|
local term_width
|
|
|
|
|
|
term_width=$(tput cols 2>/dev/null || echo 120)
|
|
|
|
|
|
|
|
|
|
|
|
if [ -n "$header_content" ]; then
|
|
|
|
|
|
echo "$header_content"
|
|
|
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# ensure_tput()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Ensures tput command is available for terminal control
|
|
|
|
|
|
# - Installs ncurses-bin on Debian/Ubuntu or ncurses on Alpine
|
|
|
|
|
|
# - Required for clear_line() and terminal width detection
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
ensure_tput() {
|
|
|
|
|
|
if ! command -v tput >/dev/null 2>&1; then
|
|
|
|
|
|
if grep -qi 'alpine' /etc/os-release; then
|
|
|
|
|
|
apk add --no-cache ncurses >/dev/null 2>&1
|
|
|
|
|
|
elif command -v apt-get >/dev/null 2>&1; then
|
|
|
|
|
|
apt-get update -qq >/dev/null
|
|
|
|
|
|
apt-get install -y -qq ncurses-bin >/dev/null 2>&1
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# is_alpine()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Detects if running on Alpine Linux
|
|
|
|
|
|
# - Checks var_os, PCT_OSTYPE, or /etc/os-release
|
|
|
|
|
|
# - Returns 0 if Alpine, 1 otherwise
|
|
|
|
|
|
# - Used to adjust behavior for Alpine-specific commands
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
is_alpine() {
|
|
|
|
|
|
local os_id="${var_os:-${PCT_OSTYPE:-}}"
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -z "$os_id" && -f /etc/os-release ]]; then
|
|
|
|
|
|
os_id="$(
|
|
|
|
|
|
. /etc/os-release 2>/dev/null
|
|
|
|
|
|
echo "${ID:-}"
|
|
|
|
|
|
)"
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
[[ "$os_id" == "alpine" ]]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# is_verbose_mode()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Determines if script should run in verbose mode
|
|
|
|
|
|
# - Checks VERBOSE and var_verbose variables
|
|
|
|
|
|
# - Also returns true if not running in TTY (pipe/redirect scenario)
|
|
|
|
|
|
# - Used by msg_info() to decide between spinner and static output
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
is_verbose_mode() {
|
|
|
|
|
|
local verbose="${VERBOSE:-${var_verbose:-no}}"
|
|
|
|
|
|
local tty_status
|
|
|
|
|
|
if [[ -t 2 ]]; then
|
|
|
|
|
|
tty_status="interactive"
|
|
|
|
|
|
else
|
|
|
|
|
|
tty_status="not-a-tty"
|
|
|
|
|
|
fi
|
|
|
|
|
|
[[ "$verbose" != "no" || ! -t 2 ]]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SECTION 6: CLEANUP & MAINTENANCE
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# cleanup_lxc()
|
|
|
|
|
|
#
|
2026-01-26 14:55:04 +01:00
|
|
|
|
# - Cleans package manager and language caches (safe for installs AND updates)
|
|
|
|
|
|
# - Supports Alpine (apk), Debian/Ubuntu (apt), Python, Node.js, Go, Rust, Ruby, PHP
|
|
|
|
|
|
# - Uses fallback error handling to prevent cleanup failures from breaking installs
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-10-30 04:47:54 -07:00
|
|
|
|
cleanup_lxc() {
|
|
|
|
|
|
msg_info "Cleaning up"
|
2025-11-09 05:46:09 -08:00
|
|
|
|
|
2025-10-30 04:47:54 -07:00
|
|
|
|
if is_alpine; then
|
|
|
|
|
|
$STD apk cache clean || true
|
|
|
|
|
|
rm -rf /var/cache/apk/*
|
|
|
|
|
|
else
|
2026-01-26 14:55:04 +01:00
|
|
|
|
$STD apt -y autoremove 2>/dev/null || msg_warn "apt autoremove failed (non-critical)"
|
|
|
|
|
|
$STD apt -y autoclean 2>/dev/null || msg_warn "apt autoclean failed (non-critical)"
|
|
|
|
|
|
$STD apt -y clean 2>/dev/null || msg_warn "apt clean failed (non-critical)"
|
2025-10-30 04:47:54 -07:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
find /tmp /var/tmp -type f -name 'tmp*' -delete 2>/dev/null || true
|
|
|
|
|
|
find /tmp /var/tmp -type f -name 'tempfile*' -delete 2>/dev/null || true
|
|
|
|
|
|
|
2026-01-26 14:55:04 +01:00
|
|
|
|
# Python
|
|
|
|
|
|
if command -v pip &>/dev/null; then
|
|
|
|
|
|
rm -rf /root/.cache/pip 2>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
if command -v uv &>/dev/null; then
|
|
|
|
|
|
rm -rf /root/.cache/uv 2>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Node.js
|
2025-12-18 11:32:30 +01:00
|
|
|
|
if command -v npm &>/dev/null; then
|
2025-12-18 18:38:08 +01:00
|
|
|
|
rm -rf /root/.npm/_cacache /root/.npm/_logs 2>/dev/null || true
|
2025-12-18 11:32:30 +01:00
|
|
|
|
fi
|
2026-01-26 14:55:04 +01:00
|
|
|
|
if command -v yarn &>/dev/null; then
|
|
|
|
|
|
rm -rf /root/.cache/yarn /root/.yarn/cache 2>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
if command -v pnpm &>/dev/null; then
|
|
|
|
|
|
pnpm store prune &>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Go (only build cache, not modules)
|
|
|
|
|
|
if command -v go &>/dev/null; then
|
|
|
|
|
|
$STD go clean -cache 2>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Rust (only registry cache, not build artifacts)
|
|
|
|
|
|
if command -v cargo &>/dev/null; then
|
|
|
|
|
|
rm -rf /root/.cargo/registry/cache /root/.cargo/.package-cache 2>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Ruby
|
|
|
|
|
|
if command -v gem &>/dev/null; then
|
|
|
|
|
|
rm -rf /root/.gem/cache 2>/dev/null || true
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# PHP
|
|
|
|
|
|
if command -v composer &>/dev/null; then
|
|
|
|
|
|
rm -rf /root/.composer/cache 2>/dev/null || true
|
|
|
|
|
|
fi
|
2025-10-30 04:47:54 -07:00
|
|
|
|
|
|
|
|
|
|
msg_ok "Cleaned"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# check_or_create_swap()
|
|
|
|
|
|
#
|
|
|
|
|
|
# - Checks if swap is active on system
|
|
|
|
|
|
# - Offers to create swap file if none exists
|
|
|
|
|
|
# - Prompts user for swap size in MB
|
|
|
|
|
|
# - Creates /swapfile with specified size
|
|
|
|
|
|
# - Activates swap immediately
|
|
|
|
|
|
# - Returns 0 if swap active or successfully created, 1 if declined/failed
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2025-06-02 10:39:46 +02:00
|
|
|
|
check_or_create_swap() {
|
|
|
|
|
|
msg_info "Checking for active swap"
|
|
|
|
|
|
|
|
|
|
|
|
if swapon --noheadings --show | grep -q 'swap'; then
|
|
|
|
|
|
msg_ok "Swap is active"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
msg_error "No active swap detected"
|
|
|
|
|
|
|
|
|
|
|
|
read -p "Do you want to create a swap file? [y/N]: " create_swap
|
|
|
|
|
|
create_swap="${create_swap,,}" # to lowercase
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$create_swap" != "y" && "$create_swap" != "yes" ]]; then
|
|
|
|
|
|
msg_info "Skipping swap file creation"
|
|
|
|
|
|
return 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
read -p "Enter swap size in MB (e.g., 2048 for 2GB): " swap_size_mb
|
|
|
|
|
|
if ! [[ "$swap_size_mb" =~ ^[0-9]+$ ]]; then
|
|
|
|
|
|
msg_error "Invalid size input. Aborting."
|
|
|
|
|
|
return 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local swap_file="/swapfile"
|
|
|
|
|
|
|
|
|
|
|
|
msg_info "Creating ${swap_size_mb}MB swap file at $swap_file"
|
|
|
|
|
|
if dd if=/dev/zero of="$swap_file" bs=1M count="$swap_size_mb" status=progress &&
|
|
|
|
|
|
chmod 600 "$swap_file" &&
|
|
|
|
|
|
mkswap "$swap_file" &&
|
|
|
|
|
|
swapon "$swap_file"; then
|
|
|
|
|
|
msg_ok "Swap file created and activated successfully"
|
|
|
|
|
|
else
|
|
|
|
|
|
msg_error "Failed to create or activate swap"
|
|
|
|
|
|
return 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
}
|
2025-07-04 21:22:50 +02:00
|
|
|
|
|
2026-01-19 15:43:12 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
# Loads LOCAL_IP from persistent store or detects if missing.
|
|
|
|
|
|
#
|
|
|
|
|
|
# Description:
|
|
|
|
|
|
# - Loads from /run/local-ip.env or performs runtime lookup
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
function get_lxc_ip() {
|
|
|
|
|
|
local IP_FILE="/run/local-ip.env"
|
|
|
|
|
|
if [[ -f "$IP_FILE" ]]; then
|
|
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
|
|
source "$IP_FILE"
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -z "${LOCAL_IP:-}" ]]; then
|
|
|
|
|
|
get_current_ip() {
|
|
|
|
|
|
local ip
|
|
|
|
|
|
|
2026-01-23 09:05:17 +01:00
|
|
|
|
# Try direct interface lookup for eth0 FIRST (most reliable for LXC) - IPv4
|
2026-01-19 17:41:17 +01:00
|
|
|
|
ip=$(ip -4 addr show eth0 2>/dev/null | awk '/inet / {print $2}' | cut -d/ -f1 | head -n1)
|
|
|
|
|
|
if [[ -n "$ip" && "$ip" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
|
|
echo "$ip"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
2026-01-23 09:05:17 +01:00
|
|
|
|
# Fallback: Try hostname -I (returns IPv4 first if available)
|
2026-01-19 17:32:44 +01:00
|
|
|
|
if command -v hostname >/dev/null 2>&1; then
|
|
|
|
|
|
ip=$(hostname -I 2>/dev/null | awk '{print $1}')
|
|
|
|
|
|
if [[ -n "$ip" && "$ip" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
|
|
echo "$ip"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
2026-01-23 09:05:17 +01:00
|
|
|
|
# Try routing table with IPv4 targets
|
|
|
|
|
|
local ipv4_targets=("8.8.8.8" "1.1.1.1" "default")
|
|
|
|
|
|
for target in "${ipv4_targets[@]}"; do
|
2026-01-19 15:43:12 +01:00
|
|
|
|
if [[ "$target" == "default" ]]; then
|
|
|
|
|
|
ip=$(ip route get 1 2>/dev/null | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')
|
|
|
|
|
|
else
|
|
|
|
|
|
ip=$(ip route get "$target" 2>/dev/null | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')
|
|
|
|
|
|
fi
|
|
|
|
|
|
if [[ -n "$ip" ]]; then
|
|
|
|
|
|
echo "$ip"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
done
|
|
|
|
|
|
|
2026-01-23 09:05:17 +01:00
|
|
|
|
# IPv6 fallback: Try direct interface lookup for eth0
|
|
|
|
|
|
ip=$(ip -6 addr show eth0 scope global 2>/dev/null | awk '/inet6 / {print $2}' | cut -d/ -f1 | head -n1)
|
|
|
|
|
|
if [[ -n "$ip" && "$ip" =~ : ]]; then
|
|
|
|
|
|
echo "$ip"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# IPv6 fallback: Try hostname -I for IPv6
|
|
|
|
|
|
if command -v hostname >/dev/null 2>&1; then
|
|
|
|
|
|
ip=$(hostname -I 2>/dev/null | tr ' ' '\n' | grep -E ':' | head -n1)
|
|
|
|
|
|
if [[ -n "$ip" && "$ip" =~ : ]]; then
|
|
|
|
|
|
echo "$ip"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# IPv6 fallback: Use routing table with IPv6 targets
|
|
|
|
|
|
local ipv6_targets=("2001:4860:4860::8888" "2606:4700:4700::1111")
|
|
|
|
|
|
for target in "${ipv6_targets[@]}"; do
|
|
|
|
|
|
ip=$(ip -6 route get "$target" 2>/dev/null | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')
|
|
|
|
|
|
if [[ -n "$ip" && "$ip" =~ : ]]; then
|
|
|
|
|
|
echo "$ip"
|
|
|
|
|
|
return 0
|
|
|
|
|
|
fi
|
|
|
|
|
|
done
|
|
|
|
|
|
|
2026-01-19 15:43:12 +01:00
|
|
|
|
return 1
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LOCAL_IP="$(get_current_ip || true)"
|
|
|
|
|
|
if [[ -z "$LOCAL_IP" ]]; then
|
|
|
|
|
|
msg_error "Could not determine LOCAL_IP"
|
|
|
|
|
|
return 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
export LOCAL_IP
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Three-tier defaults system | security improvements | error_handler | improved logging | improved container creation | improved architecture (#9540)
* Refactor Core
Refactored misc/alpine-install.func to improve error handling, network checks, and MOTD setup. Added misc/alpine-tools.func and misc/error_handler.func for modular tool installation and error management. Enhanced misc/api.func with detailed exit code explanations and telemetry functions. Updated misc/core.func for better initialization, validation, and execution helpers. Removed misc/create_lxc.sh as part of cleanup.
* Delete config-file.func
* Update install.func
* Refactor stop_all_services function and variable names
Refactor service stopping logic and improve variable handling
* Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
* Update install.func
* Update license comment format in install.func
* Refactor IPv6 handling and enhance MOTD and SSH
Refactor IPv6 handling and update OS function. Enhance MOTD with additional details and configure SSH settings.
* big core refactor
* Enhance IPv6 configuration menu options
Updated IPv6 Address Management menu options for clarity and added a new option for fully disabling IPv6.
* Update default Node.js version to 24 LTS
* Update misc/alpine-tools.func
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
* indention
* remove debugf and duplicate codes
* Update whiptail backtitles and error codes
Removed '[dev]' from whiptail --backtitle strings for consistency. Refactored custom exit codes in build.func and error_handler.func: updated Proxmox error codes, shifted MySQL/MariaDB codes to 260-263, and removed unused MongoDB code. Updated error descriptions to match new codes.
* comments
* Refactor error handling and clean up debug comments
Standardized bash variable checks, removed unnecessary debug and commented code, and clarified error handling logic in container build and setup scripts. These changes improve code readability and maintainability without altering functional behavior.
* Update build.func
* feat: Improve LXC network checks and LINSTOR storage handling
Enhanced LXC container network setup to check for both IPv4 and IPv6 addresses, added connectivity (ping) tests, and provided troubleshooting tips on failure. Updated storage validation to support LINSTOR, including cluster connectivity checks and special handling for LINSTOR template storage.
---------
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-12-04 07:52:18 +01:00
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
# SIGNAL TRAPS
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
2025-07-04 21:22:50 +02:00
|
|
|
|
trap 'stop_spinner' EXIT INT TERM
|