Remove dev mode and log handling from build/install
Cleaned up dev mode and persistent log directory logic from build.func and install.func. Network connectivity status messages are now more direct, and unnecessary exports and re-parsing of dev_mode have been removed for clarity and maintainability.
This commit is contained in:
parent
bea8814994
commit
806bb715a9
@ -47,17 +47,7 @@ variables() {
|
||||
METHOD="default" # sets the METHOD variable to "default", used for the API call.
|
||||
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" # generates a random UUID and sets it to the RANDOM_UUID variable.
|
||||
SESSION_ID="${RANDOM_UUID:0:8}" # Short session ID (first 8 chars of UUID) for log files
|
||||
BUILD_LOG="/tmp/create-lxc-${SESSION_ID}.log" # Host-side container creation log
|
||||
CTTYPE="${CTTYPE:-${CT_TYPE:-1}}"
|
||||
|
||||
# Parse dev_mode early
|
||||
parse_dev_mode
|
||||
|
||||
# Setup persistent log directory if logs mode active
|
||||
if [[ "${DEV_MODE_LOGS:-false}" == "true" ]]; then
|
||||
mkdir -p /var/log/community-scripts
|
||||
BUILD_LOG="/var/log/community-scripts/create-lxc-${SESSION_ID}-$(date +%Y%m%d_%H%M%S).log"
|
||||
fi
|
||||
CTTYPE="${CTTYPE:-${CT_TYPE:-1}}"}
|
||||
|
||||
# Get Proxmox VE version and kernel version
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
@ -2338,16 +2328,6 @@ build_container() {
|
||||
export DIAGNOSTICS="$DIAGNOSTICS"
|
||||
export RANDOM_UUID="$RANDOM_UUID"
|
||||
export SESSION_ID="$SESSION_ID"
|
||||
export BUILD_LOG="$BUILD_LOG"
|
||||
export INSTALL_LOG="/root/.install-${SESSION_ID}.log"
|
||||
export dev_mode="${dev_mode:-}"
|
||||
export DEV_MODE_MOTD="${DEV_MODE_MOTD:-false}"
|
||||
export DEV_MODE_KEEP="${DEV_MODE_KEEP:-false}"
|
||||
export DEV_MODE_TRACE="${DEV_MODE_TRACE:-false}"
|
||||
export DEV_MODE_PAUSE="${DEV_MODE_PAUSE:-false}"
|
||||
export DEV_MODE_BREAKPOINT="${DEV_MODE_BREAKPOINT:-false}"
|
||||
export DEV_MODE_LOGS="${DEV_MODE_LOGS:-false}"
|
||||
export DEV_MODE_DRYRUN="${DEV_MODE_DRYRUN:-false}"
|
||||
export CACHER="$APT_CACHER"
|
||||
export CACHER_IP="$APT_CACHER_IP"
|
||||
export tz="$timezone"
|
||||
|
||||
@ -28,17 +28,6 @@
|
||||
# SECTION 1: INITIALIZATION
|
||||
# ==============================================================================
|
||||
|
||||
# Ensure INSTALL_LOG is set (exported from build.func, but fallback if missing)
|
||||
if [[ -z "${INSTALL_LOG:-}" ]]; then
|
||||
INSTALL_LOG="/root/.install-${SESSION_ID:-unknown}.log"
|
||||
fi
|
||||
|
||||
# Dev mode: Persistent logs directory
|
||||
if [[ "${DEV_MODE_LOGS:-false}" == "true" ]]; then
|
||||
mkdir -p /var/log/community-scripts
|
||||
INSTALL_LOG="/var/log/community-scripts/install-${SESSION_ID:-unknown}-$(date +%Y%m%d_%H%M%S).log"
|
||||
fi
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
|
||||
apt-get update >/dev/null 2>&1
|
||||
@ -49,9 +38,6 @@ source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxV
|
||||
load_functions
|
||||
catch_errors
|
||||
|
||||
# Re-parse dev_mode in container context (flags exported from host)
|
||||
parse_dev_mode
|
||||
|
||||
# ==============================================================================
|
||||
# SECTION 2: NETWORK & CONNECTIVITY
|
||||
# ==============================================================================
|
||||
@ -122,23 +108,20 @@ network_check() {
|
||||
|
||||
# Check IPv4 connectivity to Google, Cloudflare & Quad9 DNS servers.
|
||||
if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then
|
||||
msg_ok "IPv4 Internet Connected"
|
||||
ipv4_connected=true
|
||||
ipv4_status="${GN}✔${CL} IPv4"
|
||||
else
|
||||
ipv4_status="${RD}✖${CL} IPv4"
|
||||
msg_error "IPv4 Internet Not Connected"
|
||||
fi
|
||||
|
||||
# Check IPv6 connectivity to Google, Cloudflare & Quad9 DNS servers.
|
||||
if ping6 -c 1 -W 1 2606:4700:4700::1111 &>/dev/null || ping6 -c 1 -W 1 2001:4860:4860::8888 &>/dev/null || ping6 -c 1 -W 1 2620:fe::fe &>/dev/null; then
|
||||
msg_ok "IPv6 Internet Connected"
|
||||
ipv6_connected=true
|
||||
ipv6_status="${GN}✔${CL} IPv6"
|
||||
else
|
||||
ipv6_status="${RD}✖${CL} IPv6"
|
||||
msg_error "IPv6 Internet Not Connected"
|
||||
fi
|
||||
|
||||
# Show combined status
|
||||
msg_ok "Internet: ${ipv4_status} ${ipv6_status}"
|
||||
|
||||
# If both IPv4 and IPv6 checks fail, prompt the user
|
||||
if [[ $ipv4_connected == false && $ipv6_connected == false ]]; then
|
||||
read -r -p "No Internet detected, would you like to continue anyway? <y/N> " prompt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user