aboutsummaryrefslogtreecommitdiff
path: root/network/opensmtpd/doinst.sh
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackbuilds.org>2013-04-14 11:43:41 -0300
committerRobby Workman <rworkman@slackbuilds.org>2013-04-15 17:21:03 -0500
commit943df74e4857d1a481cea797a090abd56b4e35af (patch)
treed96613d5127618c17f24bd788e7abe4de359c6fb /network/opensmtpd/doinst.sh
parent0c8689bc04b11e787370fb59ad318c20740d4f80 (diff)
network/opensmtpd: Added (Open SMTPd)
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
Diffstat (limited to 'network/opensmtpd/doinst.sh')
-rw-r--r--network/opensmtpd/doinst.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/network/opensmtpd/doinst.sh b/network/opensmtpd/doinst.sh
new file mode 100644
index 0000000000000..aa5fc0bcc5142
--- /dev/null
+++ b/network/opensmtpd/doinst.sh
@@ -0,0 +1,30 @@
+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/opensmtpd/smtpd.conf.new
+config etc/opensmtpd/aliases.new
+preserve_perms etc/rc.d/rc.opensmtpd.new
+
+chroot . /usr/sbin/makemap -t aliases /etc/opensmtpd/aliases
+