From 87b63654a7a881afefddaeb6c3dbbf32105070bb Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 4 Jun 2021 16:43:08 +0200 Subject: update, add fv --- bin/update_hosts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/update_hosts') diff --git a/bin/update_hosts b/bin/update_hosts index 75c41d1..e7321bf 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -5,7 +5,7 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -echo "Check from https://github.com/StevenBlack/hosts" +echo "Checking from https://github.com/StevenBlack/hosts:" lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date') echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" echo "last local update: $(date -r /etc/hosts)" @@ -14,7 +14,7 @@ echo "last local update: $(date -r /etc/hosts)" cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) -curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' +curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' BEGIN { hosts = ARGV[1]; ARGV[1] = "" } /^# Custom host / { print hosts; next } /^# End of custom host / { next } @@ -22,5 +22,5 @@ curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | aw ' "$hosts" > hosts.new mv hosts.new hosts -[ "$(uname -s)" != Darwin ] || dscacheutil -flushcache +[ "$(uname -s)" != Darwin ] || { dscacheutil -flushcache; killall -HUP mDNSResponder; } diff -u /etc/hosts.old /etc/hosts | diffstat -- cgit v1.2.3