From ffd2fc3b868ab802e14f63cd49e0659347c33461 Mon Sep 17 00:00:00 2001 From: tteckster Date: Mon, 12 Feb 2024 05:53:26 -0500 Subject: [PATCH] Update install.func Check to see if the apt-cacher-ng proxy is available before attempting to use it. If it's not available, the system will directly communicate with the apt repositories. --- misc/install.func | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/misc/install.func b/misc/install.func index ba3c11df..f19e7f12 100644 --- a/misc/install.func +++ b/misc/install.func @@ -154,7 +154,16 @@ network_check() { update_os() { msg_info "Updating Container OS" if [[ "$CACHER" == "yes" ]]; then - echo "Acquire::http { Proxy \"http://${CACHER_IP}:3142\"; };" >/etc/apt/apt.conf.d/00aptproxy + echo "Acquire::http::Proxy-Auto-Detect \"/usr/local/bin/apt-proxy-detect.sh\";" >/etc/apt/apt.conf.d/00aptproxy + cat </usr/local/bin/apt-proxy-detect.sh +#!/bin/bash +if nc -w1 -z "${CACHER_IP}" 3142; then + echo -n "http://${CACHER_IP}:3142" +else + echo -n "DIRECT" +fi +EOF + chmod +x /usr/local/bin/apt-proxy-detect.sh fi $STD apt-get update $STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade