added proxy cleanup before changing it

This commit is contained in:
2024-10-23 20:02:08 +02:00
parent ba112e9ed9
commit c258e698ab

View File

@@ -15,7 +15,7 @@
# * PROXY_SRV_PORT: Working port for general purpose proxy if one declared # * 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 # As aptitude might fail if clock is too far from real time, we need to depend
# on ntp # on ntp
@@ -43,6 +43,14 @@ upgrade_dist()
prnt E "Impossible to create directory to receive APT configuration." prnt E "Impossible to create directory to receive APT configuration."
die 60 die 60
) )
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 fi
tag_file $proxyfile tag_file $proxyfile
echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile