aboutsummaryrefslogtreecommitdiff
path: root/network/imapproxy/doinst.sh
diff options
context:
space:
mode:
authorThomas Szteliga <ts@websafe.pl>2015-08-11 13:09:03 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-08-11 23:25:29 +0700
commitc2babcea5255953cbcf9769dd98a805e3b3a3b10 (patch)
tree3039c4683943023c6b1176ed9c128cddabdb88a2 /network/imapproxy/doinst.sh
parent5c7a3ec24e4cb84d2175b110244fb7c2f997b1cc (diff)
network/imapproxy: Added (SquirrelMail's IMAP Proxy server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/imapproxy/doinst.sh')
-rw-r--r--network/imapproxy/doinst.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/network/imapproxy/doinst.sh b/network/imapproxy/doinst.sh
new file mode 100644
index 0000000000000..82b58a530cff1
--- /dev/null
+++ b/network/imapproxy/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
+}
+
+preserve_perms etc/imapproxy.conf.new
+preserve_perms etc/rc.d/rc.imapproxy.new