aboutsummaryrefslogtreecommitdiff
path: root/network/tntnet/doinst.sh
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2012-09-17 00:05:58 +0200
committerdsomero <xgizzmo@slackbuilds.org>2012-09-16 19:44:44 -0400
commit5635c60b897c4bedbc79b22648ee9e8377c76d3d (patch)
tree958e2b14fda49968f54f8281db42f399b03cddbd /network/tntnet/doinst.sh
parent6b513bedf346653bb7d8a9898e74e7995e136210 (diff)
network/tntnet: Updated for version 2.1, various cleanups.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'network/tntnet/doinst.sh')
-rw-r--r--network/tntnet/doinst.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/network/tntnet/doinst.sh b/network/tntnet/doinst.sh
new file mode 100644
index 0000000000000..6a3d11314c827
--- /dev/null
+++ b/network/tntnet/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
+}
+
+config etc/tntnet/mime.conf.new
+config etc/tntnet/tntnet.conf.new
+preserve_perms etc/rc.d/rc.tntnet.new