diff --git a/install.sh b/install.sh index 5529d90..90ac377 100755 --- a/install.sh +++ b/install.sh @@ -21,6 +21,7 @@ Core options: --ip (default: dhcp) --vlan VLAN tag for net0 (default: 90; set 0 to disable) --privileged Create privileged CT (default: unprivileged) + --apt-proxy Optional: APT proxy (e.g. http://192.168.45.2:3142) for Apt-Cacher NG Domain / n8n options: --base-domain (default: userman.de) -> FQDN becomes sb-.domain @@ -35,8 +36,9 @@ EOF } # Defaults +APT_PROXY="http://192.168.45.2:3142" CTID="" -CORES="2" +CORES="4" MEMORY="4096" SWAP="512" DISK="50" @@ -56,6 +58,7 @@ N8N_OWNER_PASS="" while [[ $# -gt 0 ]]; do case "$1" in --ctid) CTID="${2:-}"; shift 2 ;; + --apt-proxy) APT_PROXY="${2:-}"; shift 2 ;; --cores) CORES="${2:-}"; shift 2 ;; --memory) MEMORY="${2:-}"; shift 2 ;; --swap) SWAP="${2:-}"; shift 2 ;; @@ -88,8 +91,20 @@ if [[ "$IPCFG" != "dhcp" ]]; then [[ "$IPCFG" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$ ]] || die "--ip must be dhcp or CIDR (e.g. 192.168.45.171/24)" fi +if [[ -n "${APT_PROXY}" ]]; then + [[ "${APT_PROXY}" =~ ^http://[^/]+:[0-9]+$ ]] || die "--apt-proxy must look like http://IP:PORT (example: http://192.168.45.2:3142)" +fi + + info "Argument-Parsing OK" +if [[ -n "${APT_PROXY}" ]]; then + info "APT proxy enabled: ${APT_PROXY}" +else + info "APT proxy disabled" +fi + + # --------------------------- # Preflight Proxmox # --------------------------- @@ -174,6 +189,18 @@ info "CT_IP=${CT_IP}" # --------------------------- info "Step 6: Provisioning im CT (Docker + Locales + Base)" +# Optional: APT proxy (Apt-Cacher NG) +if [[ -n "${APT_PROXY}" ]]; then + pct_exec "${CTID}" "cat > /etc/apt/apt.conf.d/00aptproxy <<'EOF' +Acquire::http::Proxy \"${APT_PROXY}\"; +Acquire::https::Proxy \"DIRECT\"; +EOF" +fi + +# Minimal base packages +pct_exec "${CTID}" "export DEBIAN_FRONTEND=noninteractive; apt-get update -y" +pct_exec "${CTID}" "export DEBIAN_FRONTEND=noninteractive; apt-get install -y ca-certificates curl gnupg lsb-release" + # Locales (avoid perl warnings + consistent system) pct_exec "${CTID}" "export DEBIAN_FRONTEND=noninteractive; apt-get update -y" pct_exec "${CTID}" "export DEBIAN_FRONTEND=noninteractive; apt-get install -y locales ca-certificates curl gnupg lsb-release"