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