b8fa79
%bcond_without pam
b8fa79
%global _hardened_build 1
b8fa79
b8fa79
Summary:	Job spooling tools
b8fa79
Name:		at
b8fa79
Version:	3.1.13
8746ec
Release:	24%{?dist}
b8fa79
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
b8fa79
# + install-sh is MIT license with changes under Public Domain
b8fa79
License:	GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
b8fa79
Group:		System Environment/Daemons
b8fa79
URL:		http://ftp.debian.org/debian/pool/main/a/at
b8fa79
b8fa79
Source:		http://ftp.debian.org/debian/pool/main/a/at/at_%{version}.orig.tar.gz
b8fa79
# git upstream source git://git.debian.org/git/collab-maint/at.git
b8fa79
Source1:	pam_atd
b8fa79
Source2:	atd.init
b8fa79
Source3:	atd.sysconf
b8fa79
Source5:	atd.systemd
b8fa79
b8fa79
Patch1:		at-3.1.13-makefile.patch
b8fa79
Patch2:		at-3.1.12-opt_V.patch
b8fa79
Patch3:		at-3.1.12-shell.patch
b8fa79
Patch4:		at-3.1.13-nitpicks.patch
b8fa79
Patch5:		at-3.1.13-pam.patch
b8fa79
Patch6:		at-3.1.13-selinux.patch
b8fa79
Patch7:		at-3.1.12-nowrap.patch
b8fa79
Patch8:		at-3.1.12-fix_no_export.patch 
b8fa79
Patch9:         at-3.1.13-mailwithhostname.patch
b8fa79
Patch10:        at-3.1.13-usePOSIXtimers.patch
b8fa79
Patch11:        at-3.1.13-help.patch
b8fa79
Patch12:        at-3.1.10-filter-environment.patch
b8fa79
Patch13:	at-3.1.13-fclose-error.patch
b8fa79
Patch14:	at-3.1.13-clear-nonjobs.patch
b8fa79
Patch15:	at-3.1.13-utc-dst.patch
f2233f
Patch16:	at-3.1.13-document-n.patch
b8fa79
Patch17:	at-3.1.13-aborted-jobs.patch
8746ec
Patch18:	at-3.1.13-log-jobs.patch
b8fa79
b8fa79
BuildRequires: fileutils /etc/init.d
b8fa79
BuildRequires: flex flex-static bison autoconf
b8fa79
BuildRequires: libselinux-devel >= 1.27.9
b8fa79
BuildRequires: perl(Test::Harness)
b8fa79
BuildRequires: perl(Test::More)
b8fa79
b8fa79
%if %{with pam}
b8fa79
BuildRequires: pam-devel
b8fa79
%endif
b8fa79
Conflicts: crontabs <= 1.5
b8fa79
# No, I'm not kidding
b8fa79
BuildRequires: smtpdaemon
b8fa79
b8fa79
Requires(post): systemd-units
b8fa79
Requires(preun): systemd-units
b8fa79
Requires(postun): systemd-units
b8fa79
b8fa79
%description
b8fa79
At and batch read commands from standard input or from a specified
b8fa79
file. At allows you to specify that a command will be run at a
b8fa79
particular time. Batch will execute commands when the system load
b8fa79
levels drop to a particular level. Both commands use user's shell.
b8fa79
b8fa79
You should install the at package if you need a utility for
b8fa79
time-oriented job control. Note: If it is a recurring job that will
b8fa79
need to be repeated at the same time every day/week, etc. you should
b8fa79
use crontab instead.
b8fa79
b8fa79
%package sysvinit
b8fa79
Summary:	SysV init script for at
b8fa79
Group:		System Environment/Base
b8fa79
Requires:	%{name} = %{version}-%{release}
b8fa79
Requires(post): /sbin/chkconfig
b8fa79
b8fa79
%description sysvinit
b8fa79
SysV style init script for at. It needs to be installed only if systemd
b8fa79
is not used as the system init process.
b8fa79
b8fa79
%prep
b8fa79
%setup -q
b8fa79
cp %{SOURCE1} .
b8fa79
%patch1 -p1 -b .make
b8fa79
%patch2 -p1 -b .opt_V
b8fa79
%patch3 -p1 -b .shell
b8fa79
%patch4 -p1 -b .nit
b8fa79
%patch5 -p1 -b .pam
b8fa79
%patch6 -p1 -b .selinux
b8fa79
%patch7 -p1 -b .nowrap
b8fa79
%patch8 -p1 -b .export
b8fa79
%patch9 -p1 -b .mail
b8fa79
%patch10 -p1 -b .posix
b8fa79
%patch11 -p1 -b .help
b8fa79
%patch12 -p1 -b .filter-environment
b8fa79
%patch13 -p1 -b .fclose
b8fa79
%patch14 -p1 -b .clear-nonjobs
b8fa79
%patch15 -p1 -b .dst
f2233f
%patch16 -p1 -b .document-n
b8fa79
%patch17 -p1 -b .aborted-jobs
8746ec
%patch18 -p1 -b .log-jobs
b8fa79
b8fa79
%build
b8fa79
# patch9 touches configure.in
b8fa79
autoconf
b8fa79
# clean old pregenerated files
b8fa79
rm -f lex.yy.* y.tab.*
b8fa79
%configure --with-atspool=%{_localstatedir}/spool/at/spool \
b8fa79
	--with-jobdir=%{_localstatedir}/spool/at \
b8fa79
	--with-daemon_username=root  \
b8fa79
	--with-daemon_groupname=root \
b8fa79
	--with-selinux \
b8fa79
%if %{with pam}
b8fa79
	--with-pam
b8fa79
%endif
b8fa79
b8fa79
make
b8fa79
b8fa79
%install
b8fa79
make install \
b8fa79
	DAEMON_USERNAME=`id -nu`\
b8fa79
	DAEMON_GROUPNAME=`id -ng` \
b8fa79
	DESTDIR=%{buildroot}\
b8fa79
	sbindir=%{buildroot}%{_prefix}/sbin\
b8fa79
	bindir=%{buildroot}%{_bindir}\
b8fa79
	prefix=%{buildroot}%{_prefix}\
b8fa79
	exec_prefix=%{buildroot}%{_prefix}\
b8fa79
	docdir=%{buildroot}/usr/doc\
b8fa79
	mandir=%{buildroot}%{_mandir}\
b8fa79
	etcdir=%{buildroot}%{_sysconfdir} \
b8fa79
	ATJOB_DIR=%{buildroot}%{_localstatedir}/spool/at \
b8fa79
	ATSPOOL_DIR=%{buildroot}%{_localstatedir}/spool/at/spool \
b8fa79
	INSTALL_ROOT_USER=`id -nu` \
b8fa79
	INSTALL_ROOT_GROUP=`id -nu`;
b8fa79
b8fa79
echo > %{buildroot}%{_sysconfdir}/at.deny
b8fa79
mkdir docs
b8fa79
cp  %{buildroot}/%{_prefix}/doc/at/* docs/
b8fa79
b8fa79
mkdir -p %{buildroot}%{_sysconfdir}/pam.d
b8fa79
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/atd
b8fa79
b8fa79
mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
b8fa79
install -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/atd
b8fa79
b8fa79
mkdir -p %{buildroot}/etc/sysconfig
b8fa79
install -m 644 %{SOURCE3} %{buildroot}/etc/sysconfig/atd
b8fa79
b8fa79
# install systemd initscript
b8fa79
mkdir -p %{buildroot}/%{_unitdir}/
b8fa79
install -m 644 %{SOURCE5} %{buildroot}/%{_unitdir}/atd.service
b8fa79
b8fa79
# remove unpackaged files from the buildroot
b8fa79
rm -r  %{buildroot}%{_prefix}/doc
b8fa79
b8fa79
%check
b8fa79
make test
b8fa79
b8fa79
%post
b8fa79
touch %{_localstatedir}/spool/at/.SEQ
b8fa79
chmod 600 %{_localstatedir}/spool/at/.SEQ
f2233f
chown root:root %{_localstatedir}/spool/at/.SEQ
b8fa79
%systemd_post atd.service
b8fa79
b8fa79
%preun
b8fa79
%systemd_preun atd.service
b8fa79
b8fa79
%postun
b8fa79
%systemd_postun_with_restart atd.service
b8fa79
b8fa79
%triggerun -- at < 3.1.12-6
b8fa79
# Save the current service runlevel info
b8fa79
# User must manually run systemd-sysv-convert --apply atd
b8fa79
# to migrate them to systemd targets
b8fa79
/usr/bin/systemd-sysv-convert --save atd
b8fa79
b8fa79
# The package is allowed to autostart:
b8fa79
/bin/systemctl enable atd.service >/dev/null 2>&1
b8fa79
b8fa79
/sbin/chkconfig --del atd >/dev/null 2>&1 || :
b8fa79
/bin/systemctl try-restart atd.service >/dev/null 2>&1 || :
b8fa79
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
b8fa79
b8fa79
%triggerpostun -n at-sysvinit -- at < 3.1.12-9
b8fa79
/sbin/chkconfig --add atd >/dev/null 2>&1 || :
b8fa79
b8fa79
%files
b8fa79
%doc docs/*
b8fa79
%attr(0644,root,root)		%config(noreplace) %{_sysconfdir}/at.deny
b8fa79
%attr(0644,root,root)		%config(noreplace) %{_sysconfdir}/sysconfig/atd
f2233f
%attr(0700,root,root)		%dir %{_localstatedir}/spool/at
f2233f
%attr(0600,root,root)		%verify(not md5 size mtime) %ghost %{_localstatedir}/spool/at/.SEQ
f2233f
%attr(0700,root,root)		%dir %{_localstatedir}/spool/at/spool
b8fa79
%attr(0644,root,root)		%config(noreplace) %{_sysconfdir}/pam.d/atd
b8fa79
%{_sbindir}/atrun
b8fa79
%attr(0755,root,root)		%{_sbindir}/atd
b8fa79
%{_mandir}/man*/*
b8fa79
%{_bindir}/batch
b8fa79
%{_bindir}/atrm
b8fa79
%{_bindir}/atq
b8fa79
%attr(4755,root,root)		%{_bindir}/at
b8fa79
%attr(0644,root,root)		/%{_unitdir}/atd.service
b8fa79
b8fa79
%files sysvinit
b8fa79
%attr(0755,root,root)		%{_initrddir}/atd
b8fa79
b8fa79
%changelog
8746ec
* Wed May 23 2018 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-24
8746ec
- log the jobs being run
8746ec
f2233f
* Thu Sep 14 2017 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-23
f2233f
- fix the ownership of the spool directory (#1414228)
f2233f
- document the -n option of atd (#739870)
b8fa79
- fix handling of the aborted jobs (due to possibly
b8fa79
  temporary conditions) and avoid flooding the syslog
b8fa79
b8fa79
* Mon May 23 2016 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-22
b8fa79
- SIGPIPE should not be ignored in atd (#1338039)
b8fa79
b8fa79
* Wed Apr 20 2016 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-21
b8fa79
- correct the DST correction when using UTC time specification (#1328832)
b8fa79
- clear non-job files from at dir and test for write error on fclose
b8fa79
  to fix bogus syslog messages
b8fa79
b8fa79
* Mon Jun 22 2015 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-20
b8fa79
- build the package with hardening flags (PIE, full RELRO)
b8fa79
b8fa79
* Fri Oct  3 2014 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-18
b8fa79
- filter environment variables not acceptable in bash input
b8fa79
b8fa79
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 3.1.13-17
b8fa79
- Mass rebuild 2014-01-24
b8fa79
b8fa79
* Thu Jan 09 2014 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-16
b8fa79
- the correct solution is remove smp_flags, they don't work properly on ppc with
b8fa79
  the option mpower7
b8fa79
- Related: rhbz#1048745
b8fa79
b8fa79
* Mon Jan 06 2014 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-15
b8fa79
- remove old changelogs
b8fa79
- ppc fail to rebuild package
b8fa79
- Resolves: rhbz#1048745
b8fa79
b8fa79
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 3.1.13-14
b8fa79
- Mass rebuild 2013-12-27
b8fa79
b8fa79
* Thu Jul 11 2013 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-13
b8fa79
- rebuild with ? in dist
b8fa79
- Resolves: rhbz#983255
b8fa79
b8fa79
* Mon Feb 11 2013 Peter Robinson <pbrobinson@fedoraproject.org> 3.1.13-12
b8fa79
- Fix patch to fix FTBFS with gcc 4.8
b8fa79
b8fa79
* Wed Nov 14 2012 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-11
b8fa79
- fix license field again
b8fa79
b8fa79
* Thu Nov  1 2012 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-10
b8fa79
- fix license field
b8fa79
- fix systemd macros in scriptlets part of the specfile
b8fa79
- fix selinux patch to apply without fuzz=2
b8fa79
b8fa79
* Fri Jul 27 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.13-9
b8fa79
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b8fa79
b8fa79
* Tue Apr 17 2012 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-8
b8fa79
- at-3.1.13-mailwithhostname.patch in email mention also hostname address
b8fa79
- at-3.1.13-usePOSIXtimers.patch use POSIX timers, so we won't need
b8fa79
  pm-utils hack anymore
b8fa79
- at-3.1.13-help.patch update usage
b8fa79
- systemd-user-sessions.service is used in unit file, so the atd should be
b8fa79
  started after almost all services are up and running
b8fa79
- 812682 pam support work with new systemd defaults
b8fa79
b8fa79
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.13-7
b8fa79
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild