Added install and ct files
This commit is contained in:
committed by
bluisholive
parent
686e1988b3
commit
773e250193
@@ -184,17 +184,17 @@ variables() {
|
||||
# - Initialize error traps after loading
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/api.func)
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/api.func)
|
||||
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func)
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/error_handler.func)
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/core.func)
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/error_handler.func)
|
||||
load_functions
|
||||
catch_errors
|
||||
#echo "(build.func) Loaded core.func via curl"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
source <(wget -qO- https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func)
|
||||
source <(wget -qO- https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/error_handler.func)
|
||||
source <(wget -qO- https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/core.func)
|
||||
source <(wget -qO- https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/error_handler.func)
|
||||
load_functions
|
||||
catch_errors
|
||||
#echo "(build.func) Loaded core.func via wget"
|
||||
@@ -2186,7 +2186,7 @@ configure_ssh_settings() {
|
||||
# - Otherwise: shows update/setting menu
|
||||
# ------------------------------------------------------------------------------
|
||||
start() {
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/tools.func)
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/tools.func)
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
install_script || return 0
|
||||
return 0
|
||||
@@ -2322,9 +2322,9 @@ build_container() {
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
pushd "$TEMP_DIR" >/dev/null
|
||||
if [ "$var_os" == "alpine" ]; then
|
||||
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/alpine-install.func)"
|
||||
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/alpine-install.func)"
|
||||
else
|
||||
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/install.func)"
|
||||
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/luismco/ProxmoxVED/refs/heads/byparr/misc/install.func)"
|
||||
fi
|
||||
export DIAGNOSTICS="$DIAGNOSTICS"
|
||||
export RANDOM_UUID="$RANDOM_UUID"
|
||||
@@ -2731,44 +2731,9 @@ EOF'
|
||||
install_ssh_keys_into_ct
|
||||
|
||||
# Run application installer
|
||||
# NOTE: We disable error handling here because:
|
||||
# 1. Container errors are caught by error_handler INSIDE container
|
||||
# 2. Container creates flag file with exit code
|
||||
# 3. We read flag file and handle cleanup manually below
|
||||
# 4. We DON'T want host error_handler to fire for lxc-attach command itself
|
||||
|
||||
set +Eeuo pipefail # Disable ALL error handling temporarily
|
||||
trap - ERR # Remove ERR trap completely
|
||||
|
||||
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"
|
||||
local lxc_exit=$?
|
||||
|
||||
set -Eeuo pipefail # Re-enable error handling
|
||||
trap 'error_handler' ERR # Restore ERR trap
|
||||
|
||||
# Check for error flag file in container (more reliable than lxc-attach exit code)
|
||||
local install_exit_code=0
|
||||
if [[ -n "${SESSION_ID:-}" ]]; then
|
||||
local error_flag="/root/.install-${SESSION_ID}.failed"
|
||||
if pct exec "$CTID" -- test -f "$error_flag" 2>/dev/null; then
|
||||
install_exit_code=$(pct exec "$CTID" -- cat "$error_flag" 2>/dev/null || echo "1")
|
||||
pct exec "$CTID" -- rm -f "$error_flag" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fallback to lxc-attach exit code if no flag file
|
||||
if [[ $install_exit_code -eq 0 && $lxc_exit -ne 0 ]]; then
|
||||
install_exit_code=$lxc_exit
|
||||
fi
|
||||
|
||||
# Installation failed?
|
||||
if [[ $install_exit_code -ne 0 ]]; then
|
||||
msg_error "Installation failed in container ${CTID} (exit code: ${install_exit_code})"
|
||||
|
||||
# Copy both logs from container before potential deletion
|
||||
local build_log_copied=false
|
||||
local install_log_copied=false
|
||||
|
||||
if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"; then
|
||||
local exit_code=$?
|
||||
# Try to copy installation log from container before exiting
|
||||
if [[ -n "$CTID" && -n "${SESSION_ID:-}" ]]; then
|
||||
# Copy BUILD_LOG (creation log) if it exists
|
||||
if [[ -f "${BUILD_LOG}" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user