lsb 3.2-27 Debian release.
authorChris Lawrence <lawrencc@debian.org>
Mon, 17 Jan 2011 20:24:35 +0000 (14:24 -0600)
committerDidier Raboud <odyx@debian.org>
Mon, 17 Jan 2011 20:24:35 +0000 (14:24 -0600)
debian/changelog
debian/prerm
init-functions

index ec0e145d8bde828e1257b21b5a346ca3a67785d8..b68e64da90cd1515868a477467c8707f53998a69 100644 (file)
@@ -1,3 +1,18 @@
+lsb (3.2-27) unstable; urgency=low
+
+  * Track down another use of dpkg --print-installation-architecture.
+    (Closes: #610049)
+  * Various cleanups to init-functions, courtesy of Jari Aalto:
+    + Use /bin/echo when using options throughout.  (Closes: #602038)
+    + Use $() command substitution.  (Closes: #602035)
+    + Use && and || instead of -a and -o.  (Closes: #602037)
+    + Break long lines.  (Closes: #602039)
+    + Cleanup use of local.  (Closes: #602042)
+    + Use single-line statements.  (Closes: #602044)
+    + Use self-documenting values of variables.  (Closes: #602048)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 17 Jan 2011 14:24:35 -0600
+
 lsb (3.2-26) unstable; urgency=low
 
   * Fix reversed assignment in compare_release.  (Closes: #540208)
index 278be5baab3c73eb0cb8a08269fd0c7c45e175cd..fb33522e22dd0f3b3e5fb8e6337331479fc15ef4 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 
 remove_ldso_symlink () {
-    ARCH=`dpkg --print-installation-architecture`
+    ARCH=`dpkg --print-architecture`
     case "$ARCH" in
         s390|ia64|ppc64|sparc|sparc64|alpha|hppa|m68k|mipsel)
             rm -f /lib/ld-lsb-$ARCH.so.[123]
index 57444b8971e4ac93a0d9e485242294e6a225b7a4..8b14cf7a18507fdf63a283e25a7cc2c7a349cd72 100644 (file)
 #EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 start_daemon () {
-    local force nice pidfile exec args
-    force=0
+    local force nice pidfile exec args
+    force=""
     nice=0
     pidfile=/dev/null
 
     OPTIND=1
     while getopts fn:p: opt ; do
         case "$opt" in
-            f)  force=1;;
+            f)  force="force";;
             n)  nice="$OPTARG";;
             p)  pidfile="$OPTARG";;
         esac
@@ -50,24 +50,28 @@ start_daemon () {
     exec="$1"; shift
 
     args="--start --nicelevel $nice --quiet --oknodo"
-    if [ $force = 1 ]; then
-        /sbin/start-stop-daemon $args --chdir "$PWD" --startas $exec --pidfile /dev/null -- "$@"
+    if [ "$force" ]; then
+        /sbin/start-stop-daemon $args \
+           --chdir "$PWD" --startas $exec --pidfile /dev/null -- "$@"
     elif [ $pidfile ]; then
-        /sbin/start-stop-daemon $args --chdir "$PWD" --exec $exec --oknodo --pidfile "$pidfile" -- "$@"
+        /sbin/start-stop-daemon $args \
+           --chdir "$PWD" --exec $exec --oknodo --pidfile "$pidfile" -- "$@"
     else
         /sbin/start-stop-daemon $args --chdir "$PWD" --exec $exec -- "$@"
     fi
 }
 
 pidofproc () {
-    local pidfile line i pids= status specified pid
+    local pidfile line status specified pid
     pidfile=
     specified=
     
     OPTIND=1
     while getopts p: opt ; do
         case "$opt" in
-            p)  pidfile="$OPTARG"; specified=1;;
+            p)  pidfile="$OPTARG"
+                specified="specified"
+               ;;
         esac
     done
     shift $(($OPTIND - 1))
@@ -77,7 +81,7 @@ pidofproc () {
         pidfile="/var/run/$base.pid"
     fi
 
-    if [ -n "${pidfile:-}" -a -r "$pidfile" ]; then
+    if [ -n "${pidfile:-}" ] && [ -r "$pidfile" ]; then
         read pid < "$pidfile"
         if [ -n "${pid:-}" ]; then
             if $(kill -0 "${pid:-}" 2> /dev/null); then
@@ -91,7 +95,7 @@ pidofproc () {
             fi
         fi
     fi
-    if [ -x /bin/pidof -a ! "$specified" ]; then
+    if [ -x /bin/pidof ] && [ ! "$specified" ]; then
         status="0"
         /bin/pidof -o %PPID -x $1 || status="$?"
         if [ "$status" = 1 ]; then
@@ -107,10 +111,10 @@ pidofproc () {
 
 # start-stop-daemon uses the same algorithm as "pidofproc" above.
 killproc () {
-    local pidfile sig status base name_param is_term_sig
+    local pidfile sig status base name_param is_term_sig
     pidfile=
     name_param=
-    is_term_sig=no
+    is_term_sig=
 
     OPTIND=1
     while getopts p: opt ; do
@@ -129,18 +133,21 @@ killproc () {
 
     sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/')
     sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
-    if [ -z "$sig" -o "$sig" = 15 -o "$sig" = TERM ]; then
-        is_term_sig=yes
+    if [ -z "$sig" ] || [ "$sig" = 15 ] || [ "$sig" = TERM ]; then
+        is_term_sig="terminate_signal"
     fi
     status=0
-    if [ ! "$is_term_sig" = yes ]; then
+    if [ ! "$is_term_sig" ]; then
         if [ -n "$sig" ]; then
-            /sbin/start-stop-daemon --stop --signal "$sig" --quiet $name_param || status="$?"
+            /sbin/start-stop-daemon --stop --signal "$sig" \
+               --quiet $name_param || status="$?"
         else
-            /sbin/start-stop-daemon --stop --quiet $name_param || status="$?"
+            /sbin/start-stop-daemon --stop \
+               --quiet $name_param || status="$?"
         fi
     else
-        /sbin/start-stop-daemon --stop --quiet --oknodo $name_param || status="$?"
+        /sbin/start-stop-daemon --stop --quiet \
+           --oknodo $name_param || status="$?"
     fi
     if [ "$status" = 1 ]; then
         if [ -n "$sig" ]; then
@@ -149,7 +156,7 @@ killproc () {
         return 3 # program is not running
     fi
 
-    if [ "$status" = 0 -a "$is_term_sig" = yes -a "$pidfile" ]; then
+    if [ "$status" = 0 ] && [ "$is_term_sig" ] && [ "$pidfile" ]; then
         pidofproc -p "$pidfile" "$1" >/dev/null || rm -f "$pidfile"
     fi
     return 0
@@ -191,7 +198,13 @@ status_of_proc () {
 log_use_fancy_output () {
     TPUT=/usr/bin/tput
     EXPR=/usr/bin/expr
-    if [ -t 1 ] && [ "x${TERM:-}" != "x" ] && [ "x${TERM:-}" != "xdumb" ] && [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1 && $TPUT setaf 1 >/dev/null 2>&1; then
+    if  [ -t 1 ] &&
+       [ "x${TERM:-}" != "x" ] &&
+       [ "x${TERM:-}" != "xdumb" ] &&
+       [ -x $TPUT ] && [ -x $EXPR ] &&
+       $TPUT hpa 60 >/dev/null 2>&1 &&
+       $TPUT setaf 1 >/dev/null 2>&1
+    then
         [ -z $FANCYTTY ] && FANCYTTY=1 || true
     else
         FANCYTTY=0
@@ -241,7 +254,7 @@ log_begin_msg () {
     if [ -z "${1:-}" ]; then
         return 1
     fi
-    echo -n "$@"
+    /bin/echo -n "$@"
 }
 
 # Sample usage:
@@ -265,11 +278,11 @@ log_daemon_msg () {
     log_daemon_msg_pre "$@"
 
     if [ -z "${2:-}" ]; then
-        echo -n "$1:"
+        /bin/echo -n "$1:"
         return
     fi
     
-    echo -n "$1: $2"
+    /bin/echo -n "$1: $2"
     log_daemon_msg_post "$@"
 }
 
@@ -292,7 +305,7 @@ log_progress_msg () {
     if [ -z "${1:-}" ]; then
         return 1
     fi
-    echo -n " $@"
+    /bin/echo -n " $@"
 }
 
 
@@ -303,6 +316,7 @@ log_end_msg () {
         return 1
     fi
 
+    local retval
     retval=$1
 
     log_end_msg_pre "$@"
@@ -310,9 +324,9 @@ log_end_msg () {
     # Only do the fancy stuff if we have an appropriate terminal
     # and if /usr is already mounted
     if log_use_fancy_output; then
-        RED=`$TPUT setaf 1`
-        YELLOW=`$TPUT setaf 3`
-        NORMAL=`$TPUT op`
+        RED=$( $TPUT setaf 1)
+        YELLOW=$( $TPUT setaf 3)
+        NORMAL=$( $TPUT op)
     else
         RED=''
         YELLOW=''
@@ -335,14 +349,15 @@ log_action_msg () {
 }
 
 log_action_begin_msg () {
-    echo -n "$@..."
+    /bin/echo -n "$@..."
 }
 
 log_action_cont_msg () {
-    echo -n "$@..."
+    /bin/echo -n "$@..."
 }
 
 log_action_end_msg () {
+    local end
     log_action_end_msg_pre "$@"
     if [ -z "${2:-}" ]; then
         end="."
@@ -354,8 +369,8 @@ log_action_end_msg () {
         echo "done${end}"
     else
         if log_use_fancy_output; then
-            RED=`$TPUT setaf 1`
-            NORMAL=`$TPUT op`
+            RED=$( $TPUT setaf 1)
+            NORMAL=$( $TPUT op)
             /bin/echo -e "${RED}failed${end}${NORMAL}"
         else
             echo "failed${end}"