[Pkg-erlang-commits] r1249 - in couchdb/trunk/debian: . patches

sbisbee-guest at alioth.debian.org sbisbee-guest at alioth.debian.org
Sun May 30 03:40:40 UTC 2010


Author: sbisbee-guest
Date: 2010-05-30 03:40:35 +0000 (Sun, 30 May 2010)
New Revision: 1249

Modified:
   couchdb/trunk/debian/changelog
   couchdb/trunk/debian/patches/init.patch
Log:
adding force-reload to init file per lintian

Modified: couchdb/trunk/debian/changelog
===================================================================
--- couchdb/trunk/debian/changelog	2010-05-30 02:58:11 UTC (rev 1248)
+++ couchdb/trunk/debian/changelog	2010-05-30 03:40:35 UTC (rev 1249)
@@ -5,8 +5,10 @@
     addition of dependency in 0.10.1-1 (see #522051).
   * Updated debian/patches/init.patch, added reload functionality to the init
     file (displays a note and fails).
+  * Updated debian/patches/init.patch, added force-reload functionality to the
+    init file (alias for restart). 
 
- -- Sam Bisbee <sbisbee at computervip.com>  Sat, 29 May 2010 22:54:37 -0400
+ -- Sam Bisbee <sbisbee at computervip.com>  Sat, 29 May 2010 23:39:33 -0400
 
 couchdb (0.11.0-1) unstable; urgency=medium (security fixes)
 

Modified: couchdb/trunk/debian/patches/init.patch
===================================================================
--- couchdb/trunk/debian/patches/init.patch	2010-05-30 02:58:11 UTC (rev 1248)
+++ couchdb/trunk/debian/patches/init.patch	2010-05-30 03:40:35 UTC (rev 1249)
@@ -1,70 +1,102 @@
 --- couchdb-0.11.0/etc/init/couchdb.tpl.in	2010-03-17 16:37:38.000000000 -0400
-+++ couchdb-0.11.0.new/etc/init/couchdb.tpl.in	2010-05-29 22:35:36.000000000 -0400
-35a36,39
-> # Grace time in seconds to give the beam process to stop when we're running the
-> # stop target. Will end before grace time ends if the process ends sooner.
-> STOP_GRACE_TIME=5
-> 
-37c41
-<     exit $SCRIPT_ERROR
----
->     exit $SCRIPT_OK
-79a84
->     cd "$RUN_DIR"
-98a104,117
->     pidFile="$RUN_DIR/couchdb.pid"
->     if [ ! -r "$pidFile" ] 
->     then
->         #exists, but can't read it 
->         [ -f "$pidFile" ] && return $SCRIPT_ERROR
-> 
->         #doesn't exist, so assume couchdb is already stopped
->         return $SCRIPT_OK
->     fi
-> 
->     pid=`cat $pidFile` 
->     #unset $pidFile 
->     [ -z "$pid" ] && return $SCRIPT_OK
-> 
-102a122,127
-> 
->     # We need `heart`'s pid because its ppid is set to 1 when the beam proc
->     # ends, thereby hiding itself from our `ps` check bellow.
->     heart_pid=`ps -f --ppid $pid | grep "heart -pid $pid " | awk '{print $2}'`
->     [ -n "$heart_pid" ] && heart_pid=",$heart_pid" #for `ps` call formatting
-> 
-104,106c129
-<         if su $COUCHDB_USER -c "$command" > /dev/null; then
-<             return $SCRIPT_OK
-<         else
----
->         if ! su $COUCHDB_USER -c "$command" > /dev/null; then
-110,112c133
-<         if $command > /dev/null; then
-<             return $SCRIPT_OK
-<         else
----
->         if ! $command > /dev/null; then
-115a137,147
-> 
->     i=0
->     while ps -p $pid$heart_pid --ppid $pid$heart_pid > /dev/null 
->     do
->         [ $i -ge $STOP_GRACE_TIME ] && return $SCRIPT_ERROR
-> 
->         sleep 1
->         i=`expr $i + 1`
->     done
-> 
->     return $SCRIPT_OK
-158a191,196
-> 
->         reload)
->             log_daemon_msg "You must restart $NAME to reload its config, or use its HTTP REST API at /_config\n"
->             exit $SCRIPT_ERROR
->             ;;
-> 
-161c199
-< Usage: $SCRIPT_NAME {start|stop|restart|status}
----
-> Usage: $SCRIPT_NAME {start|stop|restart|reload|status}
++++ couchdb-0.11.0.new/etc/init/couchdb.tpl.in	2010-05-29 23:31:52.000000000 -0400
+@@ -33,8 +33,12 @@
+ RUN_DIR=%localstaterundir%
+ LSB_LIBRARY=/lib/lsb/init-functions
+ 
++# Grace time in seconds to give the beam process to stop when we're running the
++# stop target. Will end before grace time ends if the process ends sooner.
++STOP_GRACE_TIME=5
++
+ if test ! -x $COUCHDB; then
+-    exit $SCRIPT_ERROR
++    exit $SCRIPT_OK
+ fi
+ 
+ if test -r $CONFIGURATION_FILE; then
+@@ -77,6 +81,7 @@
+         command="$command $COUCHDB_OPTIONS"
+     fi
+     mkdir -p "$RUN_DIR"
++    cd "$RUN_DIR"
+     if test -n "$COUCHDB_USER"; then
+         chown $COUCHDB_USER "$RUN_DIR"
+         if su $COUCHDB_USER -c "$command" > /dev/null; then
+@@ -96,23 +101,50 @@
+ stop_couchdb () {
+     # Stop the running Apache CouchDB process.
+ 
++    pidFile="$RUN_DIR/couchdb.pid"
++    if [ ! -r "$pidFile" ] 
++    then
++        #exists, but can't read it 
++        [ -f "$pidFile" ] && return $SCRIPT_ERROR
++
++        #doesn't exist, so assume couchdb is already stopped
++        return $SCRIPT_OK
++    fi
++
++    pid=`cat $pidFile` 
++    #unset $pidFile 
++    [ -z "$pid" ] && return $SCRIPT_OK
++
+     command="$COUCHDB -d"
+     if test -n "$COUCHDB_OPTIONS"; then
+         command="$command $COUCHDB_OPTIONS"
+     fi
++
++    # We need `heart`'s pid because its ppid is set to 1 when the beam proc
++    # ends, thereby hiding itself from our `ps` check bellow.
++    heart_pid=`ps -f --ppid $pid | grep "heart -pid $pid " | awk '{print $2}'`
++    [ -n "$heart_pid" ] && heart_pid=",$heart_pid" #for `ps` call formatting
++
+     if test -n "$COUCHDB_USER"; then
+-        if su $COUCHDB_USER -c "$command" > /dev/null; then
+-            return $SCRIPT_OK
+-        else
++        if ! su $COUCHDB_USER -c "$command" > /dev/null; then
+             return $SCRIPT_ERROR
+         fi
+     else
+-        if $command > /dev/null; then
+-            return $SCRIPT_OK
+-        else
++        if ! $command > /dev/null; then
+             return $SCRIPT_ERROR
+         fi
+     fi
++
++    i=0
++    while ps -p $pid$heart_pid --ppid $pid$heart_pid > /dev/null 
++    do
++        [ $i -ge $STOP_GRACE_TIME ] && return $SCRIPT_ERROR
++
++        sleep 1
++        i=`expr $i + 1`
++    done
++
++    return $SCRIPT_OK
+ }
+ 
+ display_status () {
+@@ -156,9 +188,19 @@
+         status)
+             display_status
+             ;;
++
++        reload)
++            log_daemon_msg "You must restart $NAME to reload its config, or use its HTTP REST API at /_config\n"
++            exit $SCRIPT_ERROR
++            ;;
++
++        force-reload)
++            parse_script_option_list restart
++            ;;
++
+         *)
+             cat << EOF >&2
+-Usage: $SCRIPT_NAME {start|stop|restart|status}
++Usage: $SCRIPT_NAME {start|stop|restart|reload|force-reload|status}
+ EOF
+             exit $SCRIPT_ERROR
+             ;;




More information about the Pkg-erlang-commits mailing list