sys-process/procps: Revbump for toprc backwards compatibility
[gentoo.git] / sys-process / at / at-3.1.23.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools eutils flag-o-matic pam user systemd
7
8 DESCRIPTION="Queues jobs for later execution"
9 HOMEPAGE="https://packages.qa.debian.org/a/at.html"
10 SRC_URI="mirror://debian/pool/main/a/at/${PN}_${PV}.orig.tar.gz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86"
15 IUSE="pam selinux"
16
17 DEPEND="virtual/mta
18         >=sys-devel/autoconf-2.64
19         sys-devel/bison
20         >=sys-devel/flex-2.5.4a
21         pam? ( sys-libs/pam )"
22 RDEPEND="virtual/mta
23         virtual/logger
24         selinux? ( sec-policy/selinux-at )"
25
26 PATCHES=(
27         "${FILESDIR}"/${PN}-3.1.8-more-deny.patch
28         "${FILESDIR}"/${PN}-3.1.14-Makefile.patch
29         # fix parallel make issues, bug #244884
30         "${FILESDIR}"/${PN}-3.1.10.2-Makefile.in-parallel-make-fix.patch
31         "${FILESDIR}"/${PN}-3.1.13-configure.in-fix-PAM-automagick-dep.patch
32         # Fix parallel make issue (bug #408375)
33         "${FILESDIR}"/${PN}-3.1.13-parallel-make-fix.patch
34         "${FILESDIR}"/${PN}-3.1.13-getloadavg.patch
35 )
36
37 pkg_setup() {
38         # Cannot be moved into pkg_preinst!
39         enewgroup at 25
40         enewuser at 25 -1 /var/spool/at/atjobs at
41 }
42
43 src_prepare() {
44         default
45         eautoreconf
46 }
47
48 src_configure() {
49         local my_conf=(
50                 --sysconfdir=/etc/at
51                 --with-jobdir=/var/spool/at/atjobs
52                 --with-atspool=/var/spool/at/atspool
53                 --with-etcdir=/etc/at
54                 --with-daemon_username=at
55                 --with-daemon_groupname=at
56                 $(usex pam '' --without-pam)
57                 $(use_with selinux)
58         )
59         econf ${my_conf[@]}
60 }
61
62 src_install() {
63         emake install IROOT="${D}"
64
65         newinitd "${FILESDIR}"/atd.rc8 atd
66         newconfd "${FILESDIR}"/atd.confd atd
67         newpamd "${FILESDIR}"/at.pamd-3.1.13-r1 atd
68
69         # Preserve existing .SEQ files (bug #386625)
70         local seq_file="${EROOT}/var/spool/at/atjobs/.SEQ"
71         if [ -f "${seq_file}" ] ; then
72                 einfo "Preserving existing .SEQ file (bug #386625)."
73                 cp -p "${seq_file}" "${ED}"/var/spool/at/atjobs/ || die
74         fi
75
76         systemd_dounit "${FILESDIR}/atd.service"
77         keepdir /var/spool/at/atspool
78 }
79
80 pkg_postinst() {
81         einfo "Forcing correct permissions on /var/spool/at"
82         local atspooldir="${EROOT}/var/spool/at"
83         chown at:at "${atspooldir}/atjobs"
84         chmod 1770  "${atspooldir}/atjobs"
85         chown at:at "${atspooldir}/atjobs/.SEQ"
86         chmod 0600  "${atspooldir}/atjobs/.SEQ"
87         chown at:at "${atspooldir}/atspool"
88         chmod 1770  "${atspooldir}/atspool"
89 }