From 1b5b229e5c33db2aa7d1175567ff013f68acce4f Mon Sep 17 00:00:00 2001
From: Ian Kelling <ian@iankelling.org>
Date: Sat, 27 Aug 2016 12:12:38 -0700
Subject: [PATCH] improve apt proxy auto detect

---
 filesystem/etc/apt/detect-http-proxy    | 23 +++++++++++++++--------
 subdir_files/.config/sakura/sakura.conf |  2 +-
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/filesystem/etc/apt/detect-http-proxy b/filesystem/etc/apt/detect-http-proxy
index 7a97b95..2e4a962 100755
--- a/filesystem/etc/apt/detect-http-proxy
+++ b/filesystem/etc/apt/detect-http-proxy
@@ -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
diff --git a/subdir_files/.config/sakura/sakura.conf b/subdir_files/.config/sakura/sakura.conf
index 86589e2..7f1b251 100644
--- a/subdir_files/.config/sakura/sakura.conf
+++ b/subdir_files/.config/sakura/sakura.conf
@@ -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
-- 
2.30.2