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