From c258e698ab3d60cdb0c9e475f0f68174fc296144 Mon Sep 17 00:00:00 2001 From: fatalerrors Date: Wed, 23 Oct 2024 20:02:08 +0200 Subject: [PATCH] added proxy cleanup before changing it --- modules/upgrade_dist.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/upgrade_dist.sh b/modules/upgrade_dist.sh index 556a70e..814bd20 100644 --- a/modules/upgrade_dist.sh +++ b/modules/upgrade_dist.sh @@ -15,7 +15,7 @@ # * PROXY_SRV_PORT: Working port for general purpose proxy if one declared # ------------------------------------------------------------------------------ -export VER_upgrade_dist="0.2.3" +export VER_upgrade_dist="0.2.4" # As aptitude might fail if clock is too far from real time, we need to depend # on ntp @@ -43,9 +43,17 @@ upgrade_dist() prnt E "Impossible to create directory to receive APT configuration." die 60 ) - fi - tag_file $proxyfile - echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile + else + # Cleanup + if [[ -s $proxyfile ]]; then + emptyflie $proxyfile + fi + if [[ $(grep "^Acquire::http::Proxy" /etc/apt/apt.conf) ]]; then + sed -i -e "/^Acquire::http::Proxy/d" /etc/apt/apt.conf + fi + fi + tag_file $proxyfile + echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile elif [[ -n $PROXY_SRV ]]; then tag_file $proxyfile echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile