fix proxy nonroot, add vpn, backup services
[distro-setup] / filesystem / etc / apt / detect-http-proxy
index 2e4a962119c8206ff78b9f157bcafe5598dcbee5..b8ec1d94ea39b01708b241e80ffb8078cdc08275 100755 (executable)
@@ -16,11 +16,15 @@ if [[ -r $f ]]; then
         echo DIRECT
         exit 0
     else
-        rm $f
+        if [[ -w $f ]]; then
+            rm $f
+        fi
     fi
 fi
-if host $proxy_host && nc -z $proxy_host $proxy_port; then
+if getent hosts $proxy_host && nc -z $proxy_host $proxy_port; then
     echo $proxy_url
 else
-    touch $f
+    if [[ ! -e $f || -w $f ]]; then
+        touch $f
+    fi
 fi