X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=filesystem%2Fetc%2Fapt%2Fdetect-http-proxy;h=4bb8f3c8248c18e5b4f983031a43f7e73e333cf5;hb=1f524e72136f1d10548bdc4f502c6405ba6dbcd0;hp=1cfdaf978b878dd6f76aa2e94c371a8fcfb902db;hpb=aeab0a50f945bb27603011de850d870126028444;p=distro-setup diff --git a/filesystem/etc/apt/detect-http-proxy b/filesystem/etc/apt/detect-http-proxy index 1cfdaf9..4bb8f3c 100755 --- a/filesystem/etc/apt/detect-http-proxy +++ b/filesystem/etc/apt/detect-http-proxy @@ -15,15 +15,12 @@ if [[ ! -w /tmp ]]; then echo DIRECT exit 0 fi -if [[ -r $f ]]; then - if (( $(( $(date +%s) - $(stat -c %Y $f ) )) < 60*10 )); then - echo DIRECT - exit 0 - else - if [[ -w $f ]]; then - rm $f - fi - fi +modtime=$(stat -c %Y $f 2>/dev/null ) ||: +if [[ $modtime ]] && (( $(( $(date +%s) - modtime )) < 60*10 )); then + echo DIRECT + exit 0 +else + rm -f $f fi if getent hosts $proxy_host &>/dev/null && timeout 1 nc -z $proxy_host $proxy_port &>/dev/null; then echo $proxy_url