From 73aec290b0f95b7be7ef952b042359bb95b18645 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 26 Mar 2021 10:38:56 +0100 Subject: improve update_hosts --- bin/update_hosts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3