aboutsummaryrefslogtreecommitdiff
path: root/network/pdns/doinst.sh
diff options
context:
space:
mode:
authorDejan Strbac <me@dejanstrbac.com>2018-03-18 09:39:06 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-03-24 06:50:29 +0700
commit1e4c60e5c6bda9a967908260430beeb00bef54b9 (patch)
treeab1bbc41ffc44fd32d21eccbf0c88af99458f4cf /network/pdns/doinst.sh
parentb5b0b0e5956dff7ac905b0d07a9bb0f437a50849 (diff)
network/pdns: Added (high-performance authoritative server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/pdns/doinst.sh')
-rw-r--r--network/pdns/doinst.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/network/pdns/doinst.sh b/network/pdns/doinst.sh
new file mode 100644
index 000000000000..8d5120985100
--- /dev/null
+++ b/network/pdns/doinst.sh
@@ -0,0 +1,26 @@
+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
+}
+
+config etc/pdns.conf.new
+preserve_perms etc/rc.d/rc.pdns.new