aboutsummaryrefslogtreecommitdiff
path: root/network/dnscrypt-proxy/doinst.sh
diff options
context:
space:
mode:
authorT3slider <t3slider@gmail.com>2014-10-05 23:38:01 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-10-11 00:13:58 +0700
commit1bbffca294904b2db7942a22b4b5c6fe6e7313fc (patch)
treef716f2ecc256984b0fab82c952fe1319b85cd208 /network/dnscrypt-proxy/doinst.sh
parent7d79d345593986b00d9d2d509b419d5a8b3254df (diff)
network/dnscrypt-proxy: Updated for version 1.4.1.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/dnscrypt-proxy/doinst.sh')
-rw-r--r--network/dnscrypt-proxy/doinst.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/network/dnscrypt-proxy/doinst.sh b/network/dnscrypt-proxy/doinst.sh
new file mode 100644
index 000000000000..11fd7612c286
--- /dev/null
+++ b/network/dnscrypt-proxy/doinst.sh
@@ -0,0 +1,27 @@
+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...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.dnscrypt-proxy.new
+config etc/default/dnscrypt-proxy.new
+config etc/logrotate.d/dnscrypt-proxy.new