From 52aeaa5c1ed96e1951f025233af79018cd97a3efac1fe39cd010ddfaa908cc3b Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 7 Mar 2010 23:11:23 +0000 Subject: [PATCH] fix OBS-URL: https://build.opensuse.org/package/show/server:database/redis?expand=0&rev=6 --- redis-conf.patch | 13 +++++++++++ redis-initscript.patch | 49 ++++++++++++++++++++++++++++++++---------- redis.changes | 1 + redis.spec | 19 +++++++++++++--- 4 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 redis-conf.patch diff --git a/redis-conf.patch b/redis-conf.patch new file mode 100644 index 0000000..e175467 --- /dev/null +++ b/redis-conf.patch @@ -0,0 +1,13 @@ +Index: redis.conf +=================================================================== +--- redis.conf.orig ++++ redis.conf +@@ -2,7 +2,7 @@ + + # By default Redis does not run as a daemon. Use 'yes' if you need it. + # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. +-daemonize no ++daemonize yes + + # When run as a daemon, Redis write a pid file in /var/run/redis.pid by default. + # You can specify a custom pid file location here. diff --git a/redis-initscript.patch b/redis-initscript.patch index 594677e..c7e8508 100644 --- a/redis-initscript.patch +++ b/redis-initscript.patch @@ -2,7 +2,7 @@ Index: utils/redis_init_script =================================================================== --- utils/redis_init_script.orig +++ utils/redis_init_script -@@ -1,7 +1,18 @@ +@@ -1,28 +1,39 @@ #!/bin/sh +### BEGIN INIT INFO +# Provides: redis @@ -13,29 +13,56 @@ Index: utils/redis_init_script +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Redis server -+# Description: Starts the Redis server ++# Description: Manages the Redis server +### END INIT INFO REDISPORT=6379 -EXEC=/usr/local/bin/redis-server +EXEC=/usr/sbin/redis-server - PIDFILE=/var/run/redis_${REDISPORT}.pid - CONF="/etc/redis/${REDISPORT}.conf" -@@ -22,7 +33,7 @@ case "$1" in - echo -n "$PIDFILE does not exist, process is not running\n" +-PIDFILE=/var/run/redis_${REDISPORT}.pid +-CONF="/etc/redis/${REDISPORT}.conf" ++PIDFILE=/var/run/redis.pid ++CONF=/etc/redis.conf + + case "$1" in + start) + if [ -f $PIDFILE ] + then +- echo -n "$PIDFILE exists, process is already running or crashed\n" ++ echo "$PIDFILE exists, process is already running or crashed" else - echo -n "Stopping ...\n" +- echo -n "Starting Redis server...\n" ++ echo "Starting Redis server..." + $EXEC $CONF + fi + ;; + stop) + if [ ! -f $PIDFILE ] + then +- echo -n "$PIDFILE does not exist, process is not running\n" ++ echo "$PIDFILE does not exist, process is not running" + else +- echo -n "Stopping ...\n" - echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT & -+ echo -n "SHUTDOWN\r\n" | netcat localhost $REDISPORT & ++ echo "Stopping ..." ++ echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT & PID=$(cat $PIDFILE) while [ -x /proc/${PIDFILE} ] do -@@ -33,4 +44,7 @@ case "$1" in +@@ -33,4 +44,15 @@ case "$1" in echo "Redis stopped" fi ;; -+ *) -+ echo "Usage: $0 [start|stop]" ++ status) ++ if [ ! -f $PIDFILE ] ++ then ++ echo "$PIDFILE does not exist, process is not running" ++ else ++ echo "$PIDFILE does exist, process is running" ++ fi ++ ;; ++ *) ++ echo "Usage: $0 [start|stop|status]" + ;; esac diff --git a/redis.changes b/redis.changes index 9fc8efa..8d78717 100644 --- a/redis.changes +++ b/redis.changes @@ -2,6 +2,7 @@ Sun Mar 7 17:21:53 UTC 2010 - prusnak@suse.cz - updated to 1.2.4 +- install config file, more fixes to initscript ------------------------------------------------------------------- Fri Mar 5 06:12:24 EST 2010 - pzb@suse.de diff --git a/redis.spec b/redis.spec index 69d516e..2e3140e 100644 --- a/redis.spec +++ b/redis.spec @@ -23,6 +23,7 @@ Group: Productivity/Databases/Servers Summary: Persistent key-value database with built-in net interface Source: http://redis.googlecode.com/files/%{name}-%{version}.tar.gz Patch0: %{name}-initscript.patch +Patch1: %{name}-conf.patch # for init script Requires: netcat BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -35,9 +36,17 @@ with atomic operations to push/pop elements, add/remove elements, perform server side union, intersection, difference between sets, and so forth. Redis supports different kind of sorting abilities. +%package doc +Summary: HTML documentation for Redis +Requires: redis = %{version} + +%description doc +HTML documentation for Redis + %prep %setup -q %patch0 +%patch1 mv doc html %build @@ -49,19 +58,23 @@ install -D -m 0755 redis-cli $RPM_BUILD_ROOT%{_bindir}/redis-cli install -D -m 0755 redis-server $RPM_BUILD_ROOT%{_sbindir}/redis-server install -D -m 0755 utils/redis_init_script $RPM_BUILD_ROOT%{_sysconfdir}/init.d/redis ln -s %{_sysconfdir}/init.d/redis $RPM_BUILD_ROOT%{_sbindir}/rcredis -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/redis +install -D -m 0644 redis.conf $RPM_BUILD_ROOT%{_sysconfdir}/redis.conf %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO html/ +%doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO %{_bindir}/redis-benchmark %{_bindir}/redis-cli %{_sbindir}/redis-server %{_sysconfdir}/init.d/redis %{_sbindir}/rcredis -%dir %{_sysconfdir}/redis +%config(noreplace) %{_sysconfdir}/redis.conf + +%files doc +%defattr(-,root,root) +%doc html/ %changelog