blob: c8ac4eea11de0c6052e79b5eee5c308fe38f311d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/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 <aliases>' \
'' \
'# 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
|