lsb 3.1-12 Debian release.
authorChris Lawrence <lawrencc@debian.org>
Mon, 7 Aug 2006 18:17:40 +0000 (13:17 -0500)
committerDidier Raboud <odyx@debian.org>
Mon, 7 Aug 2006 18:17:40 +0000 (13:17 -0500)
debian/changelog
init-functions
test [new file with mode: 0644]

index f67e00060ac206c77ac5407351de0cae8a7b4bfb..2ad5b600dbb9b637556d3c135e0b90647d67dfaa 100644 (file)
@@ -1,3 +1,15 @@
+lsb (3.1-12) unstable; urgency=low
+
+  * Revert log_end_msg() change.  (Closes: #381814)
+  * killproc() returns 0 if a signal is not specified and the program
+    is not running.  (Closes: #379387)
+  * Divert output in pidofproc test to /dev/null.  (Closes: #381821)
+  * Test tput setaf 1 in log_use_fancy_output().  (Closes: #375644)
+  * Fix call to getopts in start_daemon to properly work with command
+    options.  (Closes: #381822)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon,  7 Aug 2006 13:17:40 -0500
+
 lsb (3.1-11) unstable; urgency=low
 
   * Patch for other architectures from Martin Habets
index 048057922c49f5d0a0eab1c686a087a76fdab294..3493f5233563a8ddabb8523261d5c3052b151ad3 100644 (file)
@@ -1,6 +1,6 @@
 # /lib/lsb/init-functions for Debian -*- shell-script -*-
 #
-#Copyright (c) 2002-05 Chris Lawrence
+#Copyright (c) 2002-06 Chris Lawrence
 #All rights reserved.
 #
 #Redistribution and use in source and binary forms, with or without
@@ -35,14 +35,16 @@ start_daemon () {
 
     while getopts fn:p: opt ; do
         case "$opt" in
-            f)  force=1; shift 1;;
-            n)  nice="$OPTARG"; shift 2;;
-            p)  pidfile="$OPTARG"; shift 2;;
+            f)  force=1;;
+            n)  nice="$OPTARG";;
+            p)  pidfile="$OPTARG";;
         esac
     done
+    
+    shift $(($OPTIND - 1))
+    [ "$1" = '--' ] && shift
 
-    exec=$1; shift 1
-    if [ "$1" = '--' ] ; then shift 1; fi
+    exec="$1"; shift
 
     if [ $force = 1 ]; then
         /sbin/start-stop-daemon --start --nicelevel $nice --quiet --startas $exec --pidfile /dev/null --oknodo -- "$@"
@@ -60,9 +62,10 @@ pidofproc () {
 
     while getopts p:- opt ; do
         case $opt in
-            p)  pidfile="$OPTARG"; specified=1; shift 2;;
+            p)  pidfile="$OPTARG"; specified=1;;
         esac
     done
+    shift $(($OPTIND - 1))
 
     if [ -z "${pidfile:-}" ]; then
         pidfile=/var/run/${1##*/}.pid
@@ -71,7 +74,7 @@ pidofproc () {
     if [ -f "$pidfile" ]; then
         read pid < "$pidfile"
         if [ -n "${pid:-}" ]; then
-            if $(kill -0 "${pid:-}"); then
+            if $(kill -0 "${pid:-}" 2> /dev/null); then
                 echo "$pid"
                 return 0
             else
@@ -96,25 +99,29 @@ killproc () {
 
     while getopts p:- opt ; do
         case $i in
-            p)  pidfile="$OPTARG"; specified=1; shift 2;;
+            p)  pidfile="$OPTARG"; specified=1;;
         esac
     done
+    shift $(($OPTIND - 1))
 
     base=${1##*/}
     if [ ! $pidfile ]; then
         pidfile=/var/run/$base.pid
     fi
 
+    sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/')
+    sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
+    sig=${sig:-TERM}
     if [ "$specified" ]; then
-        sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/')
-        sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
-        sig=${sig:-TERM}
         /sbin/start-stop-daemon --stop --pidfile "$pidfile" --signal $sig --quiet --name "$base"
     else
         /sbin/start-stop-daemon --stop --pidfile "$pidfile" --retry 5 --quiet --oknodo --name "$base"
     fi
     status="$?"
-    [ "$status" = 1 ] && return 3 # program is not running
+    if [ "$status" = 1 ]; then
+        [ -n "$sig" ] && return 0
+        return 3 # program is not running
+    fi
     return 0
 
     rm -f "$pidfile"
@@ -123,10 +130,10 @@ killproc () {
 log_use_fancy_output () {
     TPUT=/usr/bin/tput
     EXPR=/usr/bin/expr
-    if FANCYTTY=0; then
+    if [ FANCYTTY = 0 ]; then
         false
     fi
-    if [ "x$TERM" != "xdumb" ] && [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
+    if [ "x$TERM" != "xdumb" ] && [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1 && $TPUT setaf 1 >/dev/null 2>&1; then
         FANCYTTY=1
         true
     else
@@ -252,7 +259,7 @@ log_end_msg () {
             echo " failed!"
         fi
     fi
-    return 0
+    return $1
 }
 
 log_action_msg () {
diff --git a/test b/test
new file mode 100644 (file)
index 0000000..8255579
--- /dev/null
+++ b/test
@@ -0,0 +1,2 @@
+. init-functions
+start_daemon -p /var/run/dirmngr.pid /usr/bin/dirmngr --daemon --sh