From 15a096b486b9403c1d493ae35ee78b7946537b52 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 18 Mar 2010 15:46:04 +0000 Subject: [PATCH] - follow guidelines for alternatives (#570800) - fix init script LSB compliance (#523238) - handle undefined NETWORKING in init script (#483528) --- exim.init | 30 +++++++++++++++--------------- exim.spec | 28 +++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/exim.init b/exim.init index 1a86e30..58ffd51 100644 --- a/exim.init +++ b/exim.init @@ -23,11 +23,6 @@ else QUEUE=1h fi -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - -[ -f /usr/sbin/exim ] || exit 0 - gen_cert() { if [ ! -f /etc/pki/tls/certs/exim.pem ] ; then umask 077 @@ -59,6 +54,10 @@ EOF } start() { + [ "$EUID" != "0" ] && exit 4 + [ "${NETWORKING}" = "no" ] && exit 1 + [ -f /usr/sbin/exim ] || exit 5 + # check ownerships # do this by seeing if /var/log/exim/main.log exists and is # owned by exim - if owned by someone else we fix it up @@ -83,6 +82,7 @@ start() { } stop() { + [ "$EUID" != "0" ] && exit 4 # Stop daemons. echo -n $"Shutting down exim: " killproc exim @@ -107,22 +107,22 @@ case "$1" in restart) restart ;; - reload) - if [ -f /var/lock/subsys/exim ]; then - echo -n $"Reloading exim:" - killproc exim -HUP - echo - fi + reload|force-reload) + status exim > /dev/null || exit 7 + echo -n $"Reloading exim:" + killproc exim -HUP + echo ;; - condrestart) - [ -f /var/lock/subsys/exim ] && restart || : + condrestart|try-restart) + status exim > /dev/null || exit 0 + restart ;; status) status exim ;; *) - echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" - exit 1 + echo $"Usage: $0 {start|stop|restart|reload|force-reload|status|condrestart|try-restart}" + exit 2 esac exit $RETVAL diff --git a/exim.spec b/exim.spec index 4778e40..64f3fb3 100644 --- a/exim.spec +++ b/exim.spec @@ -12,13 +12,12 @@ Summary: The exim mail transfer agent Name: exim Version: 4.71 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Url: http://www.exim.org/ Group: System Environment/Daemons Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Provides: MTA smtpd smtpdaemon server(smtp) /usr/bin/newaliases -Provides: /usr/sbin/sendmail /usr/bin/mailq /usr/bin/rmail +Provides: MTA smtpd smtpdaemon server(smtp) Requires(post): /sbin/chkconfig /sbin/service %{_sbindir}/alternatives Requires(preun): /sbin/chkconfig /sbin/service %{_sbindir}/alternatives Requires(pre): %{_sbindir}/groupadd, %{_sbindir}/useradd @@ -292,6 +291,14 @@ mkdir -p $RPM_BUILD_ROOT/etc/pki/tls/{certs,private} touch $RPM_BUILD_ROOT/etc/pki/tls/{certs,private}/exim.pem chmod 600 $RPM_BUILD_ROOT/etc/pki/tls/{certs,private}/exim.pem +# generate alternatives ghosts +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 +for i in %{_sbindir}/sendmail %{_bindir}/{mailq,runq,rsmtp,rmail,newaliases} \ + /usr/lib/sendmail %{_sysconfdir}/pam.d/smtp %{_mandir}/man1/mailq.1.gz +do + touch $RPM_BUILD_ROOT$i +done + %if 0%{?buildclam} # Munge the clamav init and config files from clamav-devel. This really ought # to be a subpackage of clamav, but this hack will have to do for now. @@ -430,6 +437,16 @@ fi %attr(0600,root,root) %ghost %config(missingok,noreplace) %verify(not md5 size mtime) /etc/pki/tls/certs/exim.pem %attr(0600,root,root) %ghost %config(missingok,noreplace) %verify(not md5 size mtime) /etc/pki/tls/private/exim.pem +%attr(0755,root,root) %ghost %{_sbindir}/sendmail +%attr(0755,root,root) %ghost %{_bindir}/mailq +%attr(0755,root,root) %ghost %{_bindir}/runq +%attr(0755,root,root) %ghost %{_bindir}/rsmtp +%attr(0755,root,root) %ghost %{_bindir}/rmail +%attr(0755,root,root) %ghost %{_bindir}/newaliases +%attr(0755,root,root) %ghost /usr/lib/sendmail +%ghost %{_sysconfdir}/pam.d/smtp +%ghost %{_mandir}/man1/mailq.1.gz + %files mysql %defattr(-,root,root,-) %{_libdir}/exim/%{version}-%{release}/lookups/mysql.so @@ -484,6 +501,11 @@ test "$1" = 0 || %{_initrddir}/clamd.exim condrestart >/dev/null || : %{_sysconfdir}/cron.daily/greylist-tidy.sh %changelog +* Thu Mar 18 2010 Miroslav Lichvar - 4.71-3 +- follow guidelines for alternatives (#570800) +- fix init script LSB compliance (#523238) +- handle undefined NETWORKING in init script (#483528) + * Tue Feb 09 2010 Adam Jackson 4.71-2 - Fix FTBFS with --no-add-needed