summaryrefslogtreecommitdiff
path: root/network/shorewall/doinst.sh
diff options
context:
space:
mode:
authorArTourter <artourter@gmail.com>2010-05-13 01:00:22 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-13 01:00:22 +0200
commitab1d59ca5d1f0e84c2689b272068b2097b2746ff (patch)
tree9046337aeb4b5344a8a9c1b92c3020de14aba2f5 /network/shorewall/doinst.sh
parent7d2aa13af582cfc1a1be46835f0890521a318f63 (diff)
downloadslackbuilds-ab1d59ca5d1f0e84c2689b272068b2097b2746ff.tar.gz
network/shorewall: Added to 13.0 repository
Diffstat (limited to 'network/shorewall/doinst.sh')
-rw-r--r--network/shorewall/doinst.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/network/shorewall/doinst.sh b/network/shorewall/doinst.sh
new file mode 100644
index 0000000000..c56e81cd2c
--- /dev/null
+++ b/network/shorewall/doinst.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# vim: et ts=2 sw=2
+
+config() {
+ NEW="$1"
+ OLD="${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.firewall.new
+preserve_perms etc/rc.d/rc.shorewall.new
+