summaryrefslogtreecommitdiff
path: root/community/nullmailer
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2014-01-15 03:49:32 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2014-01-15 03:49:32 +0000
commit154321f7346db5c32dbdf9c730735969eabbd88f (patch)
treec89badf5b9547f313d7b28a7f400c3df404af70f /community/nullmailer
parent271da49386e259723ef574713339f04886630604 (diff)
Wed Jan 15 03:43:12 UTC 2014
Diffstat (limited to 'community/nullmailer')
-rw-r--r--community/nullmailer/PKGBUILD40
-rw-r--r--community/nullmailer/nullmailer.install44
-rw-r--r--community/nullmailer/nullmailer.service13
3 files changed, 97 insertions, 0 deletions
diff --git a/community/nullmailer/PKGBUILD b/community/nullmailer/PKGBUILD
new file mode 100644
index 000000000..7fa8a5a9b
--- /dev/null
+++ b/community/nullmailer/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 104004 2014-01-14 15:23:43Z flexiondotorg $
+# Maintainer : Martin Wimpress <code@flexion.org>
+# Contributor: Roberto Alsina <ralsina at kde.org>
+# Contributor: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de>
+
+pkgname=nullmailer
+pkgver=1.13
+pkgrel=3
+pkgdesc="Simple relay-only mail transport agent."
+arch=('i686' 'x86_64')
+url="http://www.untroubled.org/nullmailer/"
+license=("GPL")
+provides=('smtp-forwarder')
+conflicts=('smtp-forwarder' 'smtp-server')
+depends=('gnutls')
+install=nullmailer.install
+source=("http://www.untroubled.org/nullmailer/archive/${pkgname}-${pkgver}.tar.gz"
+ nullmailer.service)
+md5sums=('aaeb8746fbc082917b26d0827ccc9270'
+ '300f17c52422d4156583f207f2405930')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure \
+ --prefix=/usr \
+ --libexecdir=/usr/lib/${pkgname} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --sbindir=/usr/bin \
+ --enable-tls
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -D -m 0644 ../nullmailer.service "${pkgdir}/usr/lib/systemd/system/nullmailer.service"
+ # Remove pipe and create on install to work around makepkg hang on grep -R
+ rm -f "${pkgdir}/var/nullmailer/trigger"
+}
diff --git a/community/nullmailer/nullmailer.install b/community/nullmailer/nullmailer.install
new file mode 100644
index 000000000..823df6e27
--- /dev/null
+++ b/community/nullmailer/nullmailer.install
@@ -0,0 +1,44 @@
+# arg 1: the new package version
+post_install() {
+ if ! getent passwd nullmail > /dev/null; then
+ echo "==> Creating nullmail user"
+ usr/bin/useradd --comment "nullmailer MTA" --shell /bin/sh --home /var/nullmailer --system --user-group nullmail
+ fi
+
+ echo "==> Creating trigger fifo"
+ rm -f var/nullmailer/trigger && mkfifo -m 600 var/nullmailer/trigger
+
+ echo "==> Fixing permissions"
+ chown nullmail var/nullmailer/*
+ chown nullmail usr/bin/nullmailer-queue
+ chmod u+s usr/bin/nullmailer-queue
+ chown nullmail usr/bin/mailq
+ chmod u+s usr/bin/mailq
+ if ! [ -s etc/nullmailer/me ]; then
+ echo "==> Configuring"
+ hostnamectl --static > etc/nullmailer/me
+ fi
+ if ! [ -s etc/nullmailer/remotes ]; then
+ echo "smarthost.example.org smtp --port=25 --auth-login --user=user --pass=pass" > etc/nullmailer/remotes
+ chgrp nullmail etc/nullmailer/remotes
+ chmod 640 etc/nullmailer/remotes
+ fi
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ post_install $1
+}
+
+# arg 1: the old package version
+pre_remove() {
+ systemctl stop nullmailer
+ # Leave the 'queue' directory intact
+ rm -rf var/service/nullmailer/{tmp,trigger}
+ echo "==> Removing nullmailer user and group"
+ userdel nullmail
+ if getent group nullmail > /dev/null; then
+ groupdel nullmail
+ fi
+}
diff --git a/community/nullmailer/nullmailer.service b/community/nullmailer/nullmailer.service
new file mode 100644
index 000000000..8adbec076
--- /dev/null
+++ b/community/nullmailer/nullmailer.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Nullmailer relay-only MTA
+After=local-fs.target
+ConditionPathExists=/var/nullmailer/queue
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+WorkingDirectory=/var/nullmailer
+ExecStart=/usr/bin/nullmailer-send
+User=nullmail
+Restart=always