From b68cc21916f0e69f5f6b9affaf2569e30d2320f7 Mon Sep 17 00:00:00 2001 From: Benjamin Trigona-Harany Date: Sat, 28 Dec 2013 10:56:19 +0700 Subject: network/hostsblock: Added (ad/malware-blocking cron script). Signed-off-by: Willy Sudiarto Raharjo --- network/hostsblock/doinst.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 network/hostsblock/doinst.sh (limited to 'network/hostsblock/doinst.sh') diff --git a/network/hostsblock/doinst.sh b/network/hostsblock/doinst.sh new file mode 100644 index 000000000000..1cdd2c6ca516 --- /dev/null +++ b/network/hostsblock/doinst.sh @@ -0,0 +1,19 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/hostsblock/rc.conf.new + +# backup existing /etc/hosts to /etc/hostsblock/hosts.head if it doesn't already exist +if [ ! -r /etc/hostsblock/hosts.head ] ; then + cp /etc/hosts /etc/hostsblock/hosts.head +fi -- cgit v1.2.3