1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 10:45:15 +03:00
aports/community/opensmtpd/smtpd.initd
Sören Tempel 92cd740773 community/opensmtpd: move from main
Requires openssl1.1 or libressl, both are in community.
2022-11-26 01:33:59 +00:00

41 lines
841 B
Bash

#!/sbin/openrc-run
name="OpenSMTPD"
extra_commands="checkconfig"
description_checkconfig="Check configuration file for errors"
command=/usr/sbin/smtpd
[ "$use_pam" = yes ] && command=/usr/sbin/smtpd-pam
command_args="-F ${command_args:-$SMTPD_OPTS}" # SMTPD_OPTS is deprecated
command_background=yes
pidfile=/run/$RC_SVCNAME.pid
required_files=/etc/smtpd/smtpd.conf
depend() {
need net localmount
after bootmisc firewall
use logger dns
provide mta
}
start_pre() {
checkconfig
}
checkconfig() {
if [ "$use_pam" = yes ] && [ ! -x "$command" ]; then
eerror "\$use_pam=yes, but opensmtpd-pam is not installed"
return 1
fi
ebegin "Checking $name configuration"
# Don't output anything unless something is *not* ok.
local out rc=0
out=$($command -n 2>&1) || rc=$?
[ "$rc" -eq 0 ] || printf '%s\n' "$out" >&2
eend $rc
}