improve apt proxy auto detect
authorIan Kelling <ian@iankelling.org>
Sat, 27 Aug 2016 19:12:38 +0000 (12:12 -0700)
committerIan Kelling <ian@iankelling.org>
Sat, 27 Aug 2016 19:12:38 +0000 (12:12 -0700)
filesystem/etc/apt/detect-http-proxy
subdir_files/.config/sakura/sakura.conf

index 7a97b95c0c11b6781f013d1f3a608b41ce129e46..2e4a962119c8206ff78b9f157bcafe5598dcbee5 100755 (executable)
@@ -3,17 +3,24 @@
 # http://askubuntu.com/questions/53443/how-do-i-ignore-a-proxy-if-not-available
 # altered because testing a down proxy takes like 2 seconds,
 # and we would do it like 100 times in a row. so cache a failed result
-# locally for 1 hour. Also, using newer option based on man apt.conf.
+# locally for 10 minutes. Also, using newer option based on man apt.conf.
+#
+# Once when I was testing, it seemed I needed to have it output
+# DIRECT after toutputing the proxy url
 proxy_host=faiserver
 proxy_port=3142
-proxy_url=http://$proxy_host:$proxy_port
+proxy_url=http://$proxy_host:$proxy_port/
 f=/tmp/apt_proxy_fail
-if [[ ! -r $f ]] \
-       || (( $(( $(date +%s) - $(stat -c %Y $f ) )) > 60*60 )); then
-    if host $proxy_host && nc -z $proxy_host $proxy_port; then
-        echo $proxy_url
+if [[ -r $f ]]; then
+    if  (( $(( $(date +%s) - $(stat -c %Y $f ) )) < 60*10 )); then
+        echo DIRECT
+        exit 0
     else
-        touch $f
+        rm $f
     fi
 fi
-echo DIRECT
+if host $proxy_host && nc -z $proxy_host $proxy_port; then
+    echo $proxy_url
+else
+    touch $f
+fi
index 86589e2f2b09c2216d54d7069d7488d488fc142f..7f1b251b4289bf4dea322bfe30dc9e7c9e42378b 100644 (file)
@@ -24,7 +24,7 @@ colorset6_back=#000000
 colorset6_opacity=99
 colorset6_key=F6
 background=none
-font=Ubuntu Mono,monospace 13
+font=Ubuntu Mono,monospace 14
 show_always_first_tab=No
 scrollbar=true
 resize_grip=true