diff options
| author | Marc Vertes <mvertes@free.fr> | 2021-03-26 10:38:56 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2021-03-26 10:38:56 +0100 |
| commit | 73aec290b0f95b7be7ef952b042359bb95b18645 (patch) | |
| tree | 6dbb2419139868f018b747f3c9b09dcf7cb95084 /bin/update_hosts | |
| parent | 262eb286cb7c8d7412160cacfb022247b1f09f00 (diff) | |
improve update_hosts
Diffstat (limited to 'bin/update_hosts')
| -rwxr-xr-x | bin/update_hosts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/update_hosts b/bin/update_hosts index 6444550..793344c 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -1,9 +1,10 @@ -#!/bin/sh -ex +#!/bin/sh -e # Update /etc/hosts with a well curated blacklist of malware, ads, porn, etc. # Custom hosts are preserved. [ "$USER" = root ] || exec sudo "$0" "$@" +echo "last update: $(date -r /etc/hosts)" cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) @@ -14,3 +15,4 @@ awk 'BEGIN { hosts = ARGV[1]; ARGV[1] = "" } {print}' "$hosts" > hosts.new mv hosts.new hosts [ "$(uname -s)" != Darwin ] || dscacheutil -flushcache +diff -u /etc/hosts.old /etc/hosts | diffstat |
