diff options
author | Benjamin Trigona-Harany <slackbuilds@jaxartes.net> | 2013-12-28 10:56:19 +0700 |
---|---|---|
committer | Erik Hanson <erik@slackbuilds.org> | 2014-01-07 11:13:57 -0600 |
commit | b68cc21916f0e69f5f6b9affaf2569e30d2320f7 (patch) | |
tree | 0ffed2b196628f6a4f03bed3eb0e2359e6aaff65 /network/hostsblock/doinst.sh | |
parent | f21bd1fd8e277d0d99167f072e1d923d4ad79a4e (diff) | |
download | slackbuilds-b68cc21916f0e69f5f6b9affaf2569e30d2320f7.tar.gz slackbuilds-b68cc21916f0e69f5f6b9affaf2569e30d2320f7.tar.xz |
network/hostsblock: Added (ad/malware-blocking cron script).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/hostsblock/doinst.sh')
-rw-r--r-- | network/hostsblock/doinst.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/network/hostsblock/doinst.sh b/network/hostsblock/doinst.sh new file mode 100644 index 0000000000..1cdd2c6ca5 --- /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 |