Diff nullmailer-1.13-r5 with a nullmailer-2.0

/usr/portage/mail-mta/nullmailer/nullmailer-2.0.ebuild 2017-05-27 21:41:00.000000000 +0300
1
# Copyright 1999-2015 Gentoo Foundation
1
# Copyright 1999-2016 Gentoo Foundation
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=5
4
EAPI=6
5 5

  
6 6
inherit autotools eutils flag-o-matic multilib systemd user
7 7

  
8
MY_P="${P/_rc/RC}"
9

  
10
DEBIAN_PV=1.11
11
DEBIAN_PR="2"
12
DEBIAN_P="${PN}-${DEBIAN_PV}"
13
DEBIAN_PF="${DEBIAN_P/-/_}-${DEBIAN_PR}"
14
DEBIAN_SRC="${DEBIAN_PF}.debian.tar.gz"
15

  
16 8
DESCRIPTION="Simple relay-only local mail transport agent"
17
HOMEPAGE="http://untroubled.org/nullmailer/"
18
SRC_URI="
19
	http://untroubled.org/${PN}/archive/${MY_P}.tar.gz
20
	https://dev.gentoo.org/~jlec/distfiles/${PN}-patches-${PV}.tar.xz"
21
#		mirror://debian/pool/main/n/${PN}/${DEBIAN_SRC}"
9
HOMEPAGE="http://untroubled.org/nullmailer/ https://github.com/bruceg/nullmailer"
10
SRC_URI="http://untroubled.org/${PN}/archive/${P}.tar.gz"
22 11

  
23
SLOT="0"
24 12
LICENSE="GPL-2"
25
KEYWORDS="amd64 ppc x86"
13
SLOT="0"
14
KEYWORDS="~amd64 ~ppc ~x86"
26 15
IUSE="ssl"
27 16

  
28 17
DEPEND="
29 18
	sys-apps/groff
30
	ssl? ( net-libs/gnutls )"
19
	ssl? ( net-libs/gnutls:0= )"
31 20
RDEPEND="
32 21
	virtual/logger
33 22
	virtual/shadow
34
	ssl? ( net-libs/gnutls )
23
	ssl? ( net-libs/gnutls:0= )
35 24
	!mail-mta/courier
36 25
	!mail-mta/esmtp
37 26
	!mail-mta/exim
......
44 33
	!mail-mta/opensmtpd
45 34
	!mail-mta/ssmtp"
46 35

  
47
S=${WORKDIR}/${MY_P}
48

  
49 36
pkg_setup() {
50 37
	enewgroup nullmail 88
51
	enewuser nullmail 88 -1 /var/nullmailer nullmail
38
	enewuser nullmail 88 -1 /var/spool/nullmailer nullmail
52 39
}
53 40

  
54 41
src_prepare() {
55
#	sed -i -e 's/nullmailer-1.10/nullmailer-1.11/g' \
56
#		"${WORKDIR}"/debian/patches/*.diff || die
57
#	EPATCH_OPTS="-d ${S} -p1" \
58
#	epatch "${DISTDIR}"/${DEBIAN_SRC}
59
	# why revert?  Ask Robin when he is back!
60
#	EPATCH_OPTS="-d ${WORKDIR} -p0 -R" \
61
#	epatch "${WORKDIR}"/debian/patches/02_ipv6.diff
62
	# this fixes the debian daemon/syslog to actually compile
63

  
64
	# old debian patches from 1.11
65
	# DO NOT APPLY patch 0009... It breaks
66
	epatch "${WORKDIR}"/patches/000{1..8}*patch
67

  
68
	epatch "${FILESDIR}"/${P}-unistd.h.patch
69

  
70
	sed -i.orig \
71
		-e '/^nullmailer_send_LDADD/s, =, = ../lib/cli++/libcli++.a,' \
72
		"${S}"/src/Makefile.am || die "Sed failed"
42
	default
73 43
	sed -i.orig \
74 44
		-e '/\$(localstatedir)\/trigger/d' \
75 45
		"${S}"/Makefile.am || die "Sed failed"
76 46
	sed \
77 47
		-e "s:^AC_PROG_RANLIB:AC_CHECK_TOOL(AR, ar, false)\nAC_PROG_RANLIB:g" \
78
		-i configure.in || die
79
	sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.in || die
48
		-i configure.ac || die
49
	sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.ac || die
50
	sed \
51
		-e "s#/usr/lib#\0exec#" -e "s#/usr/local#/usr#" \
52
		-e 's:/usr/etc/:/etc/:g' \
53
		-i doc/nullmailer-send.8 || die
80 54
	eautoreconf
81 55
}
82 56

  
83 57
src_configure() {
84
	# Note that we pass a different directory below due to bugs in the makefile!
58
	# https://github.com/bruceg/nullmailer/pull/31/commits
59
	append-lfs-flags #471102
85 60
	econf \
86
		--localstatedir=/var \
61
		--localstatedir="${EPREFIX}"/var \
87 62
		$(use_enable ssl tls)
88 63
}
89 64

  
90
src_install () {
91
	emake DESTDIR="${D}" localstatedir=/var/nullmailer install
92

  
93
	dodoc AUTHORS BUGS HOWTO INSTALL ChangeLog NEWS README TODO
65
src_install() {
66
	default
94 67

  
95 68
	# A small bit of sample config
96 69
	insinto /etc/nullmailer
......
101 74
	fowners root:nullmail /etc/nullmailer/remotes
102 75

  
103 76
	# daemontools stuff
104
	dodir /var/nullmailer/service{,/log}
77
	dodir /var/spool/nullmailer/service{,/log}
105 78

  
106
	insinto /var/nullmailer/service
79
	insinto /var/spool/nullmailer/service
107 80
	newins scripts/nullmailer.run run
108
	fperms 700 /var/nullmailer/service/run
81
	fperms 700 /var/spool/nullmailer/service/run
109 82

  
110
	insinto /var/nullmailer/service/log
83
	insinto /var/spool/nullmailer/service/log
111 84
	newins scripts/nullmailer-log.run run
112
	fperms 700 /var/nullmailer/service/log/run
85
	fperms 700 /var/spool/nullmailer/service/log/run
113 86

  
114 87
	# usability
115 88
	dosym /usr/sbin/sendmail usr/$(get_libdir)/sendmail
116 89

  
117 90
	# permissions stuff
118
	keepdir /var/log/nullmailer /var/nullmailer/{tmp,queue}
119
	fperms 770 /var/log/nullmailer /var/nullmailer/{tmp,queue}
91
	keepdir /var/log/nullmailer /var/spool/nullmailer/{tmp,queue}
92
	fperms 770 /var/log/nullmailer
120 93
	fowners nullmail:nullmail /usr/sbin/nullmailer-queue /usr/bin/mailq
121 94
	fperms 4711 /usr/sbin/nullmailer-queue /usr/bin/mailq
122 95

  
123
	newinitd "${FILESDIR}"/init.d-nullmailer-r4 nullmailer
124
	systemd_dounit "${FILESDIR}"/${PN}.service
96
	newinitd "${FILESDIR}"/init.d-nullmailer-r5 nullmailer
97
	systemd_dounit scripts/${PN}.service
125 98
}
126 99

  
127 100
pkg_postinst() {
128
	if [ ! -e "${ROOT}"/var/nullmailer/trigger ]; then
129
		mkfifo "${ROOT}"/var/nullmailer/trigger
101
	if [ ! -e "${EROOT}var/spool/nullmailer/trigger" ]; then
102
		mkfifo "${EROOT}var/spool/nullmailer/trigger" || die
130 103
	fi
131 104
	chown nullmail:nullmail \
132
		"${ROOT}"/var/log/nullmailer "${ROOT}"/var/nullmailer/{tmp,queue,trigger} || die
133
	chmod 770 "${ROOT}"/var/log/nullmailer "${ROOT}"/var/nullmailer/{tmp,queue} || die
134
	chmod 660 "${ROOT}"/var/nullmailer/trigger || die
105
		"${EROOT}"var/log/nullmailer \
106
		"${EROOT}"var/spool/nullmailer/{tmp,queue,trigger} || die
107
	chmod 770 \
108
		"${EROOT}"var/log/nullmailer \
109
		"${EROOT}"var/spool/nullmailer/{tmp,queue} || die
110
	chmod 660 "${EROOT}"var/spool/nullmailer/trigger || die
135 111

  
136 112
	# This contains passwords, so should be secure
137
	chmod 0640 "${ROOT}"/etc/nullmailer/remotes || die
138
	chown root:nullmail "${ROOT}"/etc/nullmailer/remotes || die
113
	chmod 0640 "${EROOT}"etc/nullmailer/remotes || die
114
	chown root:nullmail "${EROOT}"etc/nullmailer/remotes || die
139 115

  
140 116
	if [[ -z ${REPLACING_VERSIONS} ]]; then
141 117
		elog "To create an initial setup, please do:"
142 118
		elog "emerge --config =${CATEGORY}/${PF}"
143 119
	fi
144
	#echo
145
	#elog "To start nullmailer at boot you may use either the nullmailer init.d"
146
	#elog "script, or emerge sys-process/supervise-scripts, enable the"
147
	#elog "svscan init.d script and create the following link:"
148
	#elog "ln -fs /var/nullmailer/service /service/nullmailer"
149
	#echo
150 120
}
151 121

  
152 122
pkg_postrm() {
153
	if [[ -e "${ROOT}"/var/nullmailer/trigger ]]; then
154
		rm "${ROOT}"/var/nullmailer/trigger || die
123
	if [[ -e "${EROOT}var/spool/nullmailer/trigger" ]]; then
124
		rm "${EROOT}var/spool/nullmailer/trigger" || die
155 125
	fi
156 126
}
157 127

  
158 128
pkg_config() {
159
	if [ ! -s "${ROOT}"/etc/nullmailer/me ]; then
129
	if [ ! -s "${EROOT}etc/nullmailer/me" ]; then
160 130
		einfo "Setting /etc/nullmailer/me"
161
		/bin/hostname --fqdn > "${ROOT}"/etc/nullmailer/me
131
		hostname --fqdn > "${EROOT}etc/nullmailer/me"
162 132
	fi
163
	if [ ! -s "${ROOT}"/etc/nullmailer/defaultdomain ]; then
133
	if [ ! -s "${EROOT}etc/nullmailer/defaultdomain" ]; then
164 134
		einfo "Setting /etc/nullmailer/defaultdomain"
165
		/bin/hostname --domain > "${ROOT}"/etc/nullmailer/defaultdomain
135
		hostname --domain > "${EROOT}etc/nullmailer/defaultdomain"
166 136
	fi
167 137
}
Thank you!