lsb 3.2-17 Debian release.
authorChris Lawrence <lawrencc@debian.org>
Sun, 3 Aug 2008 15:15:45 +0000 (10:15 -0500)
committerDidier Raboud <odyx@debian.org>
Sun, 3 Aug 2008 15:15:45 +0000 (10:15 -0500)
debian/changelog
debian/rules
init-functions
init-skeleton [deleted file]
test/init-skeleton [new file with mode: 0644]

index c987317ff4f78e793a2f8f5045160829d19ef65f..45e8042238cc8df29d4d021b4463cf838d8f9155 100644 (file)
@@ -1,3 +1,10 @@
+lsb (3.2-17) unstable; urgency=low
+
+  * log_{success,failure,warning}_msg suck, please don't use them for
+    Debian scripts.  Nonetheless, breakage fixed.  (Closes: #493505)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 03 Aug 2008 10:15:45 -0500
+
 lsb (3.2-16) unstable; urgency=low
 
   * Add a bugscript to lsb-release to help figure out why people keep
index e21fb841702adde90482133e19e254deff49e902..dc344968188af7730d5282e1582ac1efff44998b 100755 (executable)
@@ -122,7 +122,7 @@ binary-arch: build install
        dh_testroot
        dh_installdebconf -a
        dh_installdocs -a
-       dh_installexamples -a init-skeleton
+       dh_installexamples -a test/init-skeleton
        dh_installmenu -a
 #      dh_installlogrotate
 #      dh_installemacsen
index 724a06f8931d593f09ff758b6e638fac82436e34..d0fc183c503bc485973a0040903a696db0c0f825 100644 (file)
@@ -208,7 +208,7 @@ log_warning_msg () {
     if [ -n "${1:-}" ]; then
         log_begin_msg $@
     fi
-    log_end_msg -1
+    log_end_msg 255
 }
 
 #
@@ -290,6 +290,9 @@ log_end_msg () {
     if [ -z "${1:-}" ]; then
         return 1
     fi
+
+    retval=$1
+
     log_end_msg_pre "$@"
 
     # Only do the fancy stuff if we have an appropriate terminal
@@ -300,22 +303,23 @@ log_end_msg () {
         NORMAL=`$TPUT op`
         if [ $1 -eq 0 ]; then
             echo "."
-        elif [ $1 -eq -1 ]; then
+        elif [ $1 -eq 255 ]; then
             /bin/echo -e " ${YELLOW}(warning).${NORMAL}"
+            retval=0
         else
             /bin/echo -e " ${RED}failed!${NORMAL}"
         fi
     else
        if [ $1 -eq 0 ]; then
             echo "."
-        elif [ $1 -eq -1 ]; then
+        elif [ $1 -eq 255 ]; then
             echo -e " (warning)."
         else
             echo " failed!"
         fi
     fi
     log_end_msg_post "$@"
-    return $1
+    return $retval
 }
 
 log_action_msg () {
diff --git a/init-skeleton b/init-skeleton
deleted file mode 100644 (file)
index 27714a8..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-#!/bin/sh
-#
-# /etc/init.d/FOO
-#
-# Template and example of a LSB conform init script for the service FOO
-# See http://www.linuxbase.org/spec/ for details
-#
-### BEGIN INIT INFO
-# Provides:          FOO
-# Required-Start:    $syslog $remote_fs
-# Should-Start:      $time $portmap
-# Required-Stop:     $syslog $remote_fs
-# Should-Stop:       $time $portmap
-# Default-Start:     3 5
-# Default-Stop:      0 1 2 6
-# Short-Description: FOO daemon used for ABC
-# Description:       The FOO service is used for ZZZ
-#      The (long) description can spread multiple lines
-#      which start with '#<TAB>' or # followed by at least
-#       two spaces.
-# X-UnitedLinux-Default-Enabled: yes
-### END INIT INFO
-# 
-# Remarks:
-# - The LSB actually might be interpreted that there is only a single space
-#   between the the colon after the keyword and the first argument, but
-#   most or all LSB install_initd's support more than one space
-# - Local extensions start with a X-[LANA registered provider or domain]-
-#   The X-UnitedLinux-Default-Enabled is one of the few actually used
-#   extension (enable service by when installing package, but keep current
-#   status when updating).
-#
-# The other keywords are described by the LSB. Notes on the differences
-# between Required-Start and Should-Start (which was introduced by LSB 1.9):
-#
-# a) Required-Start/Required-Stop is used as hard dependencies, i.e. for
-#    services which have to be started before this service. For instance
-#    needs the 'nfs-kernel-server' the portmap service. Requiring
-#      Required-Start: $portmap
-#    ensures that the portmapper is started before the nfs server.
-#    If a required service is missing, an init script cannot be installed
-#    and an init script which is required by another cannot be removed.
-#
-# b) Should-Start/Should-Stop is used for weak dependencies. This ensures
-#    that the order of the init scripts is useful. A possible use for
-#    'autofs' is to ask for
-#      Should-Start: nis
-#    which enables to read maps via NIS. Note that not all LSB install_initd
-#    programs support Should-Start (Debian's does) and therefore one should
-#    try hard not to rely on its support.
-#
-#    The Required-Stop/Should-Stop usually contain the same services as
-#    Required-Start/Should-Start do.
-#
-#    Besides using the services provided by the Provides section of
-#    init script, those predefined facilities are available
-#    (while they start with a $ they are no shell variables):
-#
-#    a) LSB 1.1 facility names
-#    - $local_fs    all local filesystems are mounted
-#    - $remote_fs   all remote filesystems are mounted
-#                   (note that /usr might be remote)
-#    - $syslog      system logging is operational
-#    - $network     low level networking (ethernet card etc.)
-#    - $named       hostname resolution available
-#    - $netdaemons  all network daemons are running
-#                   (Removed in LSB 1.2)
-#    b) LSB 1.2 facility names
-#    - $time        the system time has been set (e.g. NTP)
-#    - $portmap     daemons providing SunRPC/ONCRPC portmapping service
-#                   are running
-#
-# The LSB specifies those runlevels, most services use 3 and 5 for
-# Default-Start and 0 1 2 6 for Default-Stop.
-# 
-# 0 - halt
-# 1 - single user mode
-# 2 - multiuser with no network services exported
-# 3 - normal/full multiuser
-# 4 - reserved for local use (usually normal/full multiuser)
-# 5 - multiuser with xdm or equivalent
-# 6 - reboot
-# 
-# Note on that script names should follow the LSB:
-# http://www.linuxbase.org/spec/gLSB/gLSB/scrptnames.html
-# There is a registry for script names that are reserved for use by
-# distributions and registered script and provider names at
-# http://www.lanana.org/
-
-# Source LSB init functions
-# This provides start_daemon, killproc, pidofproc,
-# log_success_msg, log_failure_msg and log_warning_msg.
-. /lib/lsb/init-functions
-
-# Since init scripts are config files, they might be left after an uninstall
-# Check whether the binary is still present:
-FOO_BIN=/usr/sbin/FOO
-test -x "$FOO_BIN" || {log_failure_msg "$FOO_BIN not installed"; exit 5}
-
-# Check whether a required configuration file is available
-FOO_CONFIG=/etc/FOO.conf
-test -r "$FOO_CONFIG" || {log_failure_msg "$FOO_CONFIG not existing"; exit 6}
-
-# Those LSB defined exit status codes shall be used (except for status)
-# 0     sucess
-# 1    generic or unspecified error (current practice)
-# 2    invalid or excess argument(s)
-# 3    unimplemented feature (for example, "reload")
-# 4    user had insufficient privilege
-# 5    program is not installed
-# 6    program is not configured
-# 7            program is not running
-# 8-199 reserved (8-99 LSB, 100-149 distribution, 150-199 application)
-# 
-# Note that those situation shall also be regarded as success:
-# * restarting a service (instead of reloading it)
-#   with the "force-reload" argument
-# * running "start" on a service already running
-# * running "stop" on a service already stopped or not running
-# * running "restart" on a service already stopped or not running
-# * running "try-restart" on a service already stopped or not running
-#
-
-case "$1" in
-    start)
-       # Start service with startproc which shall return the
-        # LSB exit status
-       start_daemon "$FOO_BIN" -c "$FOO_CONFIG"
-       STATUS=$?
-       if [ "$STATUS" = 0 ]
-       then
-            log_success_msg "Starting FOO"
-        else
-           log_failure_msg "Starting FOO"
-        fi
-       exit $STATUS
-       ;;
-    stop)
-       echo -n "Shutting down FOO "
-       # Stop the service with killproc which shall return the
-        # LSB exit status
-       killproc "$FOO_BIN"
-       STATUS=$?
-       if [ "$STATUS" = 0 ]
-           log_success_msg "Shutting down FOO"
-           exit 0
-        else
-           log_failure_msg "Shutting down FOO"
-        fi
-       exit $STATUS
-       ;;
-    try-restart)
-       # Do a restart only if the service is running
-       # try-restart has been added to the LSB in 1.9
-       # RedHat's similar command is called condrestart.
-       $0 status > /dev/null
-       STATUS=$?
-       if [ "$STATUS" = 0 ]
-       then
-           $0 restart
-       else
-           log_success_msg "Try-Restarting FOO: not running"
-       fi
-       exit 0 # not running is also regarded as success
-       ;;
-    restart)
-       # Restart service (if running) or start service
-       $0 stop
-       $0 start
-       ;;
-    force-reload)
-       # Reload the configuartion. Usually a SIGHUP is used for this
-       # If it doesn't support his signal, restart it (only if running)
-
-        # Supports signalling
-       killproc -HUP "$FOO_BIN"
-       SIGNAL=$?
-       if [ "$SIGNAL" = 0 ]
-       then
-           log_success_msg "Reloading FOO"
-       else
-           log_failure_msg "Reloading FOO"
-       fi
-       exit $STATUS
-
-       # Otherwise
-       #$0 try-restart
-       ;;
-    reload)
-       # Reload configuration file, but don't restart if it is not supported
-
-       # If it supports signaling:
-       killproc -HUP "$FOO_BIN"
-       SIGNAL=$?
-       if [ "$SIGNAL" = 0 ]
-       then
-           log_success_msg "Reloading FOO"
-       else
-           log_failure_msg "Reloading FOO"
-       fi
-       exit $STATUS
-       
-       # Otherwise
-       # exit 3
-       ;;
-    status)
-       # Use pidofproc to check the status of the service,
-       # pidofproc returns the exit status code of 0 when it the process is
-       # running.
-
-       # LSB defined exit status codes for status:
-       # 0     program is running or service is OK
-       # 1     program is dead and /var/run pid file exists
-       # 2     program is dead and /var/lock lock file exists
-       # 3     program is not running
-       # 4     program or service status is unknown
-       # 5-199 reserved (5-99 LSB, 100-149 distribution, 150-199 applications)
-       
-       checkproc "$FOO_BIN" > /dev/null
-       STATUS=$?
-       if [ "$SIGNAL" = 0 ]
-       then
-           log_success_msg "Checking FOO"
-       else
-           log_warning_msg "Checking FOO: Not running"
-       fi
-       exit $STATUS
-       ;;
-    *)
-       echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
-       exit 1
-       ;;
-esac
diff --git a/test/init-skeleton b/test/init-skeleton
new file mode 100644 (file)
index 0000000..27714a8
--- /dev/null
@@ -0,0 +1,233 @@
+#!/bin/sh
+#
+# /etc/init.d/FOO
+#
+# Template and example of a LSB conform init script for the service FOO
+# See http://www.linuxbase.org/spec/ for details
+#
+### BEGIN INIT INFO
+# Provides:          FOO
+# Required-Start:    $syslog $remote_fs
+# Should-Start:      $time $portmap
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:       $time $portmap
+# Default-Start:     3 5
+# Default-Stop:      0 1 2 6
+# Short-Description: FOO daemon used for ABC
+# Description:       The FOO service is used for ZZZ
+#      The (long) description can spread multiple lines
+#      which start with '#<TAB>' or # followed by at least
+#       two spaces.
+# X-UnitedLinux-Default-Enabled: yes
+### END INIT INFO
+# 
+# Remarks:
+# - The LSB actually might be interpreted that there is only a single space
+#   between the the colon after the keyword and the first argument, but
+#   most or all LSB install_initd's support more than one space
+# - Local extensions start with a X-[LANA registered provider or domain]-
+#   The X-UnitedLinux-Default-Enabled is one of the few actually used
+#   extension (enable service by when installing package, but keep current
+#   status when updating).
+#
+# The other keywords are described by the LSB. Notes on the differences
+# between Required-Start and Should-Start (which was introduced by LSB 1.9):
+#
+# a) Required-Start/Required-Stop is used as hard dependencies, i.e. for
+#    services which have to be started before this service. For instance
+#    needs the 'nfs-kernel-server' the portmap service. Requiring
+#      Required-Start: $portmap
+#    ensures that the portmapper is started before the nfs server.
+#    If a required service is missing, an init script cannot be installed
+#    and an init script which is required by another cannot be removed.
+#
+# b) Should-Start/Should-Stop is used for weak dependencies. This ensures
+#    that the order of the init scripts is useful. A possible use for
+#    'autofs' is to ask for
+#      Should-Start: nis
+#    which enables to read maps via NIS. Note that not all LSB install_initd
+#    programs support Should-Start (Debian's does) and therefore one should
+#    try hard not to rely on its support.
+#
+#    The Required-Stop/Should-Stop usually contain the same services as
+#    Required-Start/Should-Start do.
+#
+#    Besides using the services provided by the Provides section of
+#    init script, those predefined facilities are available
+#    (while they start with a $ they are no shell variables):
+#
+#    a) LSB 1.1 facility names
+#    - $local_fs    all local filesystems are mounted
+#    - $remote_fs   all remote filesystems are mounted
+#                   (note that /usr might be remote)
+#    - $syslog      system logging is operational
+#    - $network     low level networking (ethernet card etc.)
+#    - $named       hostname resolution available
+#    - $netdaemons  all network daemons are running
+#                   (Removed in LSB 1.2)
+#    b) LSB 1.2 facility names
+#    - $time        the system time has been set (e.g. NTP)
+#    - $portmap     daemons providing SunRPC/ONCRPC portmapping service
+#                   are running
+#
+# The LSB specifies those runlevels, most services use 3 and 5 for
+# Default-Start and 0 1 2 6 for Default-Stop.
+# 
+# 0 - halt
+# 1 - single user mode
+# 2 - multiuser with no network services exported
+# 3 - normal/full multiuser
+# 4 - reserved for local use (usually normal/full multiuser)
+# 5 - multiuser with xdm or equivalent
+# 6 - reboot
+# 
+# Note on that script names should follow the LSB:
+# http://www.linuxbase.org/spec/gLSB/gLSB/scrptnames.html
+# There is a registry for script names that are reserved for use by
+# distributions and registered script and provider names at
+# http://www.lanana.org/
+
+# Source LSB init functions
+# This provides start_daemon, killproc, pidofproc,
+# log_success_msg, log_failure_msg and log_warning_msg.
+. /lib/lsb/init-functions
+
+# Since init scripts are config files, they might be left after an uninstall
+# Check whether the binary is still present:
+FOO_BIN=/usr/sbin/FOO
+test -x "$FOO_BIN" || {log_failure_msg "$FOO_BIN not installed"; exit 5}
+
+# Check whether a required configuration file is available
+FOO_CONFIG=/etc/FOO.conf
+test -r "$FOO_CONFIG" || {log_failure_msg "$FOO_CONFIG not existing"; exit 6}
+
+# Those LSB defined exit status codes shall be used (except for status)
+# 0     sucess
+# 1    generic or unspecified error (current practice)
+# 2    invalid or excess argument(s)
+# 3    unimplemented feature (for example, "reload")
+# 4    user had insufficient privilege
+# 5    program is not installed
+# 6    program is not configured
+# 7            program is not running
+# 8-199 reserved (8-99 LSB, 100-149 distribution, 150-199 application)
+# 
+# Note that those situation shall also be regarded as success:
+# * restarting a service (instead of reloading it)
+#   with the "force-reload" argument
+# * running "start" on a service already running
+# * running "stop" on a service already stopped or not running
+# * running "restart" on a service already stopped or not running
+# * running "try-restart" on a service already stopped or not running
+#
+
+case "$1" in
+    start)
+       # Start service with startproc which shall return the
+        # LSB exit status
+       start_daemon "$FOO_BIN" -c "$FOO_CONFIG"
+       STATUS=$?
+       if [ "$STATUS" = 0 ]
+       then
+            log_success_msg "Starting FOO"
+        else
+           log_failure_msg "Starting FOO"
+        fi
+       exit $STATUS
+       ;;
+    stop)
+       echo -n "Shutting down FOO "
+       # Stop the service with killproc which shall return the
+        # LSB exit status
+       killproc "$FOO_BIN"
+       STATUS=$?
+       if [ "$STATUS" = 0 ]
+           log_success_msg "Shutting down FOO"
+           exit 0
+        else
+           log_failure_msg "Shutting down FOO"
+        fi
+       exit $STATUS
+       ;;
+    try-restart)
+       # Do a restart only if the service is running
+       # try-restart has been added to the LSB in 1.9
+       # RedHat's similar command is called condrestart.
+       $0 status > /dev/null
+       STATUS=$?
+       if [ "$STATUS" = 0 ]
+       then
+           $0 restart
+       else
+           log_success_msg "Try-Restarting FOO: not running"
+       fi
+       exit 0 # not running is also regarded as success
+       ;;
+    restart)
+       # Restart service (if running) or start service
+       $0 stop
+       $0 start
+       ;;
+    force-reload)
+       # Reload the configuartion. Usually a SIGHUP is used for this
+       # If it doesn't support his signal, restart it (only if running)
+
+        # Supports signalling
+       killproc -HUP "$FOO_BIN"
+       SIGNAL=$?
+       if [ "$SIGNAL" = 0 ]
+       then
+           log_success_msg "Reloading FOO"
+       else
+           log_failure_msg "Reloading FOO"
+       fi
+       exit $STATUS
+
+       # Otherwise
+       #$0 try-restart
+       ;;
+    reload)
+       # Reload configuration file, but don't restart if it is not supported
+
+       # If it supports signaling:
+       killproc -HUP "$FOO_BIN"
+       SIGNAL=$?
+       if [ "$SIGNAL" = 0 ]
+       then
+           log_success_msg "Reloading FOO"
+       else
+           log_failure_msg "Reloading FOO"
+       fi
+       exit $STATUS
+       
+       # Otherwise
+       # exit 3
+       ;;
+    status)
+       # Use pidofproc to check the status of the service,
+       # pidofproc returns the exit status code of 0 when it the process is
+       # running.
+
+       # LSB defined exit status codes for status:
+       # 0     program is running or service is OK
+       # 1     program is dead and /var/run pid file exists
+       # 2     program is dead and /var/lock lock file exists
+       # 3     program is not running
+       # 4     program or service status is unknown
+       # 5-199 reserved (5-99 LSB, 100-149 distribution, 150-199 applications)
+       
+       checkproc "$FOO_BIN" > /dev/null
+       STATUS=$?
+       if [ "$SIGNAL" = 0 ]
+       then
+           log_success_msg "Checking FOO"
+       else
+           log_warning_msg "Checking FOO: Not running"
+       fi
+       exit $STATUS
+       ;;
+    *)
+       echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
+       exit 1
+       ;;
+esac