- LSB compliance fixes for init script

- don't run the test suite as root
- ensure a constant timestamp on the sysconfig file
This commit is contained in:
jorton 2010-05-27 09:52:04 +00:00
parent 02ba63630b
commit 507fad5acf
2 changed files with 34 additions and 20 deletions

View File

@ -3,7 +3,7 @@
Name: memcached Name: memcached
Version: 1.4.5 Version: 1.4.5
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 0 Epoch: 0
Summary: High Performance, Distributed Memory Object Cache Summary: High Performance, Distributed Memory Object Cache
@ -55,10 +55,13 @@ memcached binary include files.
make %{?_smp_mflags} make %{?_smp_mflags}
%check %check
# remove failing test that doesn't work in # Parts of the test suite only succeed as non-root.
# build systems if [ `id -u` -ne 0 ]; then
rm -f t/daemonize.t # remove failing test that doesn't work in
make test # build systems
rm -f t/daemonize.t
make test
fi
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
@ -82,6 +85,9 @@ CACHESIZE="64"
OPTIONS="" OPTIONS=""
EOF EOF
# Constant timestamp on the config file.
touch -r %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
# pid directory # pid directory
mkdir -p %{buildroot}/%{_localstatedir}/run/memcached mkdir -p %{buildroot}/%{_localstatedir}/run/memcached
@ -133,6 +139,11 @@ exit 0
%{_includedir}/memcached/* %{_includedir}/memcached/*
%changelog %changelog
* Wed May 26 2010 Joe Orton <jorton@redhat.com> - 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 <lindner@inuus.com> - 0:1.4.5-1 * Sun Apr 4 2010 Paul Lindner <lindner@inuus.com> - 0:1.4.5-1
- Upgrade to upstream memcached-1.4.5 (http://code.google.com/p/memcached/wiki/ReleaseNotes145) - Upgrade to upstream memcached-1.4.5 (http://code.google.com/p/memcached/wiki/ReleaseNotes145)

View File

@ -32,27 +32,28 @@ fi
RETVAL=0 RETVAL=0
prog="memcached" prog="memcached"
pidfile=${PIDFILE-/var/run/memcached/memcached.pid}
lockfile=${LOCKFILE-/var/lock/subsys/memcached}
start () { start () {
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
# insure that /var/run/memcached has proper permissions # Ensure that /var/run/memcached has proper permissions
if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then
chown $USER /var/run/memcached chown $USER /var/run/memcached
fi 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=$? RETVAL=$?
echo echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached [ $RETVAL -eq 0 ] && touch ${lockfile}
} }
stop () { stop () {
echo -n $"Stopping $prog: " echo -n $"Stopping $prog: "
killproc -p /var/run/memcached/memcached.pid /usr/bin/memcached killproc -p ${pidfile} /usr/bin/memcached
RETVAL=$? RETVAL=$?
echo echo
if [ $RETVAL -eq 0 ] ; then if [ $RETVAL -eq 0 ] ; then
rm -f /var/lock/subsys/memcached rm -f ${lockfile} ${pidfile}
rm -f /var/run/memcached.pid
fi fi
} }
@ -71,17 +72,19 @@ case "$1" in
stop stop
;; ;;
status) status)
status memcached status -p ${pidfile} memcached
RETVAL=$?
;; ;;
restart|reload|force-reload) restart|reload|force-reload)
restart restart
;; ;;
condrestart) condrestart|try-restart)
[ -f /var/lock/subsys/memcached ] && restart || : [ -f ${lockfile} ] && restart || :
;; ;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
exit 1 RETVAL=2
;;
esac esac
exit $? exit $RETVAL