fix proxy nonroot, add vpn, backup services
[distro-setup] / filesystem / etc / apt / detect-http-proxy
index b5d502dbf4c844c1309968304da8e39802ed2b95..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 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