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