summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-12 13:35:27 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-12 13:35:27 +0200
commit9907fcc70159d76a94ee8bf2a2d69ff88856f193 (patch)
tree50a405324623151f7522542ecd69f99077b45266
parent4ddb96394a4657d2444018385be79d65c6fbad60 (diff)
downloadalpine-conf-9907fcc70159d76a94ee8bf2a2d69ff88856f193.zip
setup-proxy: fix removal of proxy with 'none'
Make sure that we remove the proxy with setup-proxy none. Also allow https proxies while at it and mock wget for testing
-rw-r--r--setup-proxy.in12
1 files changed, 5 insertions, 7 deletions
diff --git a/setup-proxy.in b/setup-proxy.in
index 8829ac8..115076b 100644
--- a/setup-proxy.in
+++ b/setup-proxy.in
@@ -38,16 +38,16 @@ if [ -f "$PROFILE" ] ; then
fi
suggest=${http_proxy:-none}
-while true; do
+while [ $# -eq 0 ]; do
case "$proxyurl" in
- http://*) break;;
+ http://*|https://*) break;;
none) proxyurl= ; break;;
esac
ask "HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none')" $suggest
proxyurl=$resp
done
-if [ -z "$proxyurl" ]; then
+if [ "$proxyurl" = "none" ]; then
rm -f "$PROFILE"
else
mkdir -p "${PROFILE%/*}"
@@ -60,11 +60,9 @@ else
export no_proxy=localhost
__EOF__
# busybox wget does not handle http proxies well
- apk add --quiet --no-progress wget
+ $MOCK apk add --quiet --no-progress wget
fi
-[ -e "$PROFILE" ] || exit 1
-
-if [ -z "$quiet" ]; then
+if [ -z "$quiet" ] && [ "$proxyurl" != "none" ]; then
echo -e "\nTo make changes active please do login again or source $PROFILE\nwith \". $PROFILE\""
fi