summaryrefslogtreecommitdiff
path: root/network/knock/doinst.sh
diff options
context:
space:
mode:
authorJoey Trungale <joey@trungale.net>2010-05-12 23:32:20 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-12 23:32:20 +0200
commit43858c38016b71d1112b70f70a4c37755140af55 (patch)
treed2c48a92afd45085341b53df22eff71d6132fd14 /network/knock/doinst.sh
parent4a3fd527941ac66e06f4e54ee1dcffe531dbfdff (diff)
downloadslackbuilds-43858c38016b71d1112b70f70a4c37755140af55.tar.gz
network/knock: Added to 12.2 repository
Diffstat (limited to 'network/knock/doinst.sh')
-rw-r--r--network/knock/doinst.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/network/knock/doinst.sh b/network/knock/doinst.sh
new file mode 100644
index 0000000000..9a247a060b
--- /dev/null
+++ b/network/knock/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...
+}
+
+# Keep same permissions on rc.knockd.new as an existing rc.knockd:
+if [ -e etc/rc.d/rc.knockd ]; then
+ cp -a etc/rc.d/rc.knockd etc/rc.d/rc.knockd.new.incoming
+ cat etc/rc.d/rc.knockd.new > etc/rc.d/rc.knockd.new.incoming
+ mv etc/rc.d/rc.knockd.new.incoming etc/rc.d/rc.knockd.new
+else
+ # If rc.knockd does not exist, make the new one executable by default,
+ # which won't matter unless it's called from rc.local anyway
+ chmod 0755 etc/rc.d/rc.knockd.new
+fi
+
+config etc/rc.d/rc.knockd.new
+config etc/knockd.conf.new