#!/bin/mkpkg # description: Free implementation of the SMTP protocol # url: https://www.opensmtpd.org/ name=opensmtpd version=7.9.0p0 release=2 depends=(libressl libevent zlib musl-fts) makedeps=(bison) groups=( _smtpd:user:_smtpd:/nonexistent:755:915:915 _smtpq:user:_smtpq:/nonexistent:755:916:916 ) services=(smtpd) permissions=( /etc/mail/smtpd.conf:root:_smtpd:640 /var/spool/smtpd:root:root:711 /var/spool/smtpd/queue:_smtpq:root:700 /var/spool/smtpd/offline:root:_smtpq:770 /var/spool/smtpd/purge:_smtpq:root:700 ) source=(https://www.opensmtpd.org/archives/$name-$version.tar.gz) sha256sums=( "74e640de18a8ea63ef43ba2ddb1a6ad1eb82cce2e600b94e98cb551bb2a724c4" ) build() { cd $name-$version ./configure \ --prefix=/usr \ --sbindir=/usr/bin \ --sysconfdir=/etc/mail \ --localstatedir=/var \ --with-path-empty=/var/empty \ --with-path-socket=/run \ --with-path-CAfile=/etc/ssl/cert.pem \ --with-user-smtpd=_smtpd \ --with-user-queue=_smtpq \ --with-group-queue=_smtpq \ --with-mantype=man \ --with-libssl=/usr \ --with-libevent=/usr make make DESTDIR=$PKG install # Clean docs rm -rf $PKG/usr/share/doc # Symlink sendmail compatibility install -d $PKG/usr/bin [ -e $PKG/usr/bin/sendmail ] || ln -sf smtpctl $PKG/usr/bin/sendmail install -d $PKG/usr/lib ln -sf /usr/bin/smtpctl $PKG/usr/lib/sendmail # Spool directory layout (queue/offline/purge created by smtpd at runtime, # but pre-create for permissions= to set ownership on install) install -d -m 711 $PKG/var/spool/smtpd install -d -m 700 $PKG/var/spool/smtpd/queue install -d -m 770 $PKG/var/spool/smtpd/offline install -d -m 700 $PKG/var/spool/smtpd/purge # Mail aliases default install -d $PKG/etc/mail } post_build() { # Minimal smtpd.conf — outbound only initially, no inbound listener. # Receives local mail (from cron, scripts, etc.) and forwards to smarthost # if needed, or accepts on localhost for sendmail-compat. printf '%s\n' \ '# OpenSMTPD configuration — see smtpd.conf(5)' \ '' \ 'table aliases file:/etc/mail/aliases' \ '' \ '# Listen only on loopback for local submissions' \ 'listen on lo' \ '' \ '# Local delivery to system users (Maildir under ~/Maildir)' \ 'action "local_mail" maildir "~/Maildir" alias ' \ '' \ '# Outbound relay (direct MX delivery)' \ 'action "outbound" relay' \ '' \ 'match from local for local action "local_mail"' \ 'match from local for any action "outbound"' \ > $PKG/etc/mail/smtpd.conf # Stub aliases file printf '%s\n' \ '# /etc/mail/aliases — see aliases(5)' \ 'postmaster: root' \ 'root: root' \ > $PKG/etc/mail/aliases # runit service install -d $PKG/etc/sv/smtpd/log printf '%s\n' \ '#!/bin/sh' \ 'exec 2>&1' \ '' \ '# Validate config before launching' \ 'smtpd -n || exit 1' \ '' \ 'exec smtpd -d' \ > $PKG/etc/sv/smtpd/run printf '%s\n' \ '#!/bin/sh' \ 'mkdir -p /var/log/smtpd' \ 'exec svlogd -tt /var/log/smtpd' \ > $PKG/etc/sv/smtpd/log/run chmod 755 $PKG/etc/sv/smtpd/run chmod 755 $PKG/etc/sv/smtpd/log/run } signify() { untrusted comment: public key RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3 } # vim: filetype=sh