From 507fad5acf36e685558849fba90554ad0cc86ba8 Mon Sep 17 00:00:00 2001 From: jorton Date: May 27 2010 09:52:04 +0000 Subject: - LSB compliance fixes for init script - don't run the test suite as root - ensure a constant timestamp on the sysconfig file --- diff --git a/memcached.spec b/memcached.spec index 510fa62..2fd9500 100644 --- a/memcached.spec +++ b/memcached.spec @@ -3,7 +3,7 @@ Name: memcached Version: 1.4.5 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 0 Summary: High Performance, Distributed Memory Object Cache @@ -55,10 +55,13 @@ memcached binary include files. make %{?_smp_mflags} %check -# remove failing test that doesn't work in -# build systems -rm -f t/daemonize.t -make test +# Parts of the test suite only succeed as non-root. +if [ `id -u` -ne 0 ]; then + # remove failing test that doesn't work in + # build systems + rm -f t/daemonize.t + make test +fi %install rm -rf %{buildroot} @@ -82,6 +85,9 @@ CACHESIZE="64" OPTIONS="" EOF +# Constant timestamp on the config file. +touch -r %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name} + # pid directory mkdir -p %{buildroot}/%{_localstatedir}/run/memcached @@ -133,6 +139,11 @@ exit 0 %{_includedir}/memcached/* %changelog +* Wed May 26 2010 Joe Orton - 0:1.4.5-2 +- LSB compliance fixes for init script +- don't run the test suite as root +- ensure a constant timestamp on the sysconfig file + * Sun Apr 4 2010 Paul Lindner - 0:1.4.5-1 - Upgrade to upstream memcached-1.4.5 (http://code.google.com/p/memcached/wiki/ReleaseNotes145) diff --git a/memcached.sysv b/memcached.sysv index 5c738bd..62ac51f 100755 --- a/memcached.sysv +++ b/memcached.sysv @@ -32,27 +32,28 @@ fi RETVAL=0 prog="memcached" +pidfile=${PIDFILE-/var/run/memcached/memcached.pid} +lockfile=${LOCKFILE-/var/lock/subsys/memcached} start () { echo -n $"Starting $prog: " - # insure that /var/run/memcached has proper permissions - if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then - chown $USER /var/run/memcached - fi + # Ensure that /var/run/memcached has proper permissions + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi - daemon --pidfile /var/run/memcached/memcached.pid memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS + daemon --pidfile ${pidfile} memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P ${pidfile} $OPTIONS RETVAL=$? echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached + [ $RETVAL -eq 0 ] && touch ${lockfile} } stop () { echo -n $"Stopping $prog: " - killproc -p /var/run/memcached/memcached.pid /usr/bin/memcached + killproc -p ${pidfile} /usr/bin/memcached RETVAL=$? echo if [ $RETVAL -eq 0 ] ; then - rm -f /var/lock/subsys/memcached - rm -f /var/run/memcached.pid + rm -f ${lockfile} ${pidfile} fi } @@ -71,17 +72,19 @@ case "$1" in stop ;; status) - status memcached + status -p ${pidfile} memcached + RETVAL=$? ;; restart|reload|force-reload) restart ;; - condrestart) - [ -f /var/lock/subsys/memcached ] && restart || : + condrestart|try-restart) + [ -f ${lockfile} ] && restart || : ;; *) - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}" + RETVAL=2 + ;; esac -exit $? +exit $RETVAL