diff --git a/.gitignore b/.gitignore index 6d4b80a..4c048fd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ test.pl at_3.1.11.orig.tar.gz at_3.1.12.orig.tar.gz pam_atd +/atd.systemd diff --git a/at.spec b/at.spec index 105f5f0..bc87487 100644 --- a/at.spec +++ b/at.spec @@ -6,7 +6,7 @@ Summary: Job spooling tools Name: at Version: %{major_ver} -Release: 5%{dist} +Release: 6%{dist} License: GPLv2+ Group: System Environment/Daemons URL: http://ftp.debian.org/debian/pool/main/a/at @@ -16,6 +16,7 @@ Source1: pam_atd Source2: atd.init Source3: atd.sysconf Source4: 56atd +Source5: atd.systemd Patch1: at-3.1.12-makefile.patch Patch2: at-3.1.12-opt_V.patch @@ -38,7 +39,10 @@ BuildRequires: pam-devel Conflicts: crontabs <= 1.5 # No, I'm not kidding BuildRequires: smtpdaemon -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# systemd compatibility +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units %description At and batch read commands from standard input or from a specified @@ -116,6 +120,10 @@ install -m 755 %{SOURCE3} %{buildroot}/etc/sysconfig/atd mkdir -p %{buildroot}/%{_libdir}/pm-utils/sleep.d/ install -m 755 %{SOURCE4} %{buildroot}/%{_libdir}/pm-utils/sleep.d/56atd +# install systemd initscript +mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/ +install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/lib/systemd/system/atd.service + # remove unpackaged files from the buildroot rm -r %{buildroot}%{_prefix}/doc @@ -131,16 +139,23 @@ chmod 600 %{_localstatedir}/spool/at/.SEQ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ # must be in chkconfig on /sbin/chkconfig --add atd +# systemd +/bin/systemctl enable atd.service >/dev/null 2>&1 || : %preun if [ "$1" = "0" ] ; then /sbin/service atd stop >/dev/null 2>&1 ||: /sbin/chkconfig --del atd + # systemd + /bin/systemctl disable atd.service >/dev/null 2>&1 || : + /bin/systemctl stop atd.service > /dev/null 2>&1 || : fi %postun if [ "$1" -ge "1" ]; then /sbin/service atd condrestart >/dev/null 2>&1 ||: + # systemd + /bin/systemctl try-restart atd.service >/dev/null 2>&1 || : fi %files @@ -161,8 +176,12 @@ fi %{_bindir}/atq %attr(4755,root,root) %{_bindir}/at %attr(0755,root,root) %{_libdir}/pm-utils/sleep.d/56atd +%attr(0644,root,root) /lib/systemd/system/atd.service %changelog +* Tue Nov 30 2010 Marcela Mašláňová - 3.1.12-6 +- 617320 systemd init script replacement + * Mon Mar 15 2010 Marcela Mašláňová - 3.1.12-5 - 568222 interrupted 'at' job creates empty job for non-root diff --git a/atd.init b/atd.init index f601f21..2f3fd20 100755 --- a/atd.init +++ b/atd.init @@ -34,10 +34,11 @@ start() { [ -x $exec ] || exit 5 [ -f $config ] || exit 6 echo -n $"Starting $prog: " - daemon $exec $OPTS + daemon $exec $OPTS && success || failure retval=$? echo [ $retval -eq 0 ] && touch $lockfile + return $retval } stop() { @@ -51,6 +52,7 @@ stop() { retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile + return $retval } restart() { diff --git a/sources b/sources index 0a6b956..a1df2a4 100644 --- a/sources +++ b/sources @@ -3,3 +3,4 @@ b117781fd68e393443b2a8e478c7c22f atd.init ac1471fe22f63f666dc7d31173f47ea0 atd.sysconf 1e67991776148fb319fd77a2e599a765 at_3.1.12.orig.tar.gz 000d2f30379d2bf8af09f51416e863ec pam_atd +0e763d641e33ad468bd8f5ef05da395a atd.systemd