summaryrefslogtreecommitdiff
blob: 334237eed9090ffac9ca7f1d1cdae4e9971b3854 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

[[ ${PV} == *9999 ]] && SCM="git-r3"
inherit perl-module ${SCM}

DESCRIPTION="qpsmtpd is a flexible smtpd daemon written in Perl"
HOMEPAGE="https://smtpd.github.io/qpsmtpd/"
if [[ ${PV} != *9999 ]]; then
	SRC_URI="https://github.com/smtpd/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64 ~x86"
else
	# This is a spotted development fork with many improvements
	EGIT_REPO_URI="https://github.com/smtpd/${PN}.git"
fi

LICENSE="MIT"
SLOT="0"
IUSE="postfix ipv6 syslog"

RDEPEND="
	acct-group/smtpd
	acct-user/smtpd
	dev-lang/perl
	dev-perl/Danga-Socket
	dev-perl/IPC-Shareable
	dev-perl/MailTools
	dev-perl/Net-DNS
	dev-perl/ParaDNS
	dev-perl/Socket6
	dev-perl/UNIVERSAL-isa
	postfix? ( acct-group/postdrop )
	virtual/inetd
	virtual/perl-MIME-Base64
	ipv6? ( dev-perl/IO-Socket-INET6 )
	syslog? ( virtual/perl-Sys-Syslog )
"

src_unpack() {
	if [[ ${PV} != *9999 ]]; then
		unpack ${A}
		cd "${S}"
	else
		git-r3_src_unpack
		cd "${S}"
	fi
}

src_install() {
	perl-module_src_install

	insinto /etc/xinetd.d
	newins "${FILESDIR}"/qpsmtpd.xinetd qpsmtpd

	dodir /usr/share/qpsmtpd
	cp -Rf plugins "${ED}"/usr/share/qpsmtpd/ || die

	diropts -m 0755 -o smtpd -g smtpd
	keepdir /var/spool/qpsmtpd

	insinto /etc/qpsmtpd
	doins config.sample/*

	echo "/usr/share/qpsmtpd/plugins" > "${ED}"/etc/qpsmtpd/plugin_dirs || die
	echo "/var/spool/qpsmtpd" > "${ED}"/etc/qpsmtpd/spool_dir || die
	if use syslog; then
		echo "logging/syslog loglevel LOGINFO priority LOG_NOTICE" > "${ED}"/etc/qpsmtpd/logging
	else
		diropts -m 0755 -o smtpd -g smtpd
		dodir /var/log/qpsmtpd
		keepdir /var/log/qpsmtpd
		echo "logging/file loglevel LOGINFO /var/log/qpsmtpd/%Y-%m-%d" > "${ED}"/etc/qpsmtpd/logging
	fi

	newenvd "${FILESDIR}"/qpsmtpd.envd 99qpsmtpd

	newconfd "${FILESDIR}"/qpsmtpd.confd qpsmtpd
	newinitd "${FILESDIR}"/qpsmtpd.initd-r1 qpsmtpd

	dodoc CREDITS Changes README.md README.plugins.md STATUS UPGRADING.md
}