lsb 3.0-6 Debian release.
authorChris Lawrence <lawrencc@debian.org>
Fri, 16 Sep 2005 23:32:29 +0000 (19:32 -0400)
committerDidier Raboud <odyx@debian.org>
Fri, 16 Sep 2005 23:32:29 +0000 (19:32 -0400)
debian/README.Debian
debian/changelog
debian/lsb-base.README.Debian [new file with mode: 0644]
debian/lsb-base.dirs
debian/postinst
debian/prerm
init-functions

index c63d812f805a293d7f82a21247b0af6625182b06..c06add497562fa50e6850ad06c0dbd98aba94959 100644 (file)
@@ -43,30 +43,8 @@ packages:
   lsb 2.0-6 package so other packages could make use of the init
   functionality without requiring a full LSB installation.
 
-  Debian also provides a series of logging functions to permit
-  simplified logging of init script actions:
-  
-  - log_daemon_msg "Starting/stopping long daemon name" "daemond"
-
-    Log starting/stopping of daemons.  On Debian, outputs:
-
-    "Starting/stopping long daemon name: daemond"
-
-    and leaves the cursor at the end of the line.
-
-  - log_progress_msg "daemon2d"
-
-    Log startup of a second daemon (e.g. sysklogd, nfs init scripts).
-    On Debian, outputs " daemon2d" and leaves the cursor at the EOL.
-
-  - log_end_msg 0
-
-    Log successful startup.  On Debian, outputs "." followed by newline.
-    1 may also be specified, which indicates failure; currently implemented
-    as outputting "failed!" (in red on a color TTY) followed by newline.
-
-  A deprecated function, log_start_msg, is also provided for compatibility
-  with a few older packages and a derived distribution.
+  For documentation of those functions (and those added for Debian's use),
+  please see the README.Debian file in that package.
 
 The first three packages are architecture-specific because of
 differences in the requirements of the LSB on various binary
@@ -212,6 +190,6 @@ any reports of its success or failure.
 An example init script that tests some of these features is provided
 as /usr/share/doc/lsb/examples/init-skeleton.
 
- -- Chris Lawrence <lawrencc@debian.org>, Wed Aug 10 12:00:05 2005
+ -- Chris Lawrence <lawrencc@debian.org>, Fri Sep 16 19:01:50 2005
 
  LocalWords:  LSB
index aa18c473393f9e59fd9d9e26da8be373afe18d38..f6045fe2fb3a2bc21d347e51f576f8c187012730 100644 (file)
@@ -1,3 +1,17 @@
+lsb (3.0-6) unstable; urgency=low
+
+  * Add ld-lsb.so.3 symlinks.  (Closes: #326609)
+  * Use cat $pidfile instead of read.  (Closes: #327405)
+    If someone knows why the convoluted read was used instead... let me know.
+  * Test for TPUT and friends as needed.  (Closes: #327388, #327825)
+  * Add log_action_*().  (Closes: #324983)
+  * Edit README.Debian; fork off a README.Debian for lsb-base.
+    (Closes: #327525)
+  * The log_* functions can be overridden in /etc/lsb-base-logging.sh.
+    (Closes: #321963)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 16 Sep 2005 19:32:29 -0400
+
 lsb (3.0-5) unstable; urgency=low
 
   * Use --exec in calls to start-stop-daemon in killproc().  (Closes: #322770)
diff --git a/debian/lsb-base.README.Debian b/debian/lsb-base.README.Debian
new file mode 100644 (file)
index 0000000..415a6fb
--- /dev/null
@@ -0,0 +1,90 @@
+The Debian lsb-base package provides a series of logging functions to
+permit simplified logging of init script actions.
+
+  - log_daemon_msg "Starting/stopping long daemon name" "daemond"
+
+    Log starting/stopping of daemons.  On Debian, outputs:
+
+    "Starting/stopping long daemon name: daemond"
+
+    and leaves the cursor at the end of the line.
+
+  - log_progress_msg "daemon2d"
+
+    Log startup of a second daemon (e.g. sysklogd, nfs init scripts).
+    On Debian, outputs " daemon2d" and leaves the cursor at the EOL.
+
+  - log_end_msg 0
+
+    Log successful startup.  On Debian, outputs "." followed by newline.
+    1 may also be specified, which indicates failure; currently implemented
+    as outputting "failed!" (in red on a color TTY) followed by newline.
+
+  - log_action_msg "Setting VARIABLE to VALUE"
+
+    Log an atomic action by your init script.  Typically, this is the
+    setting of a kernel variable, but it might be something else that is
+    not expected to take any time (or fail).
+
+    On Debian, a trailing period will be added to the message,
+    followed by a newline.
+
+  - log_action_start_msg "Configuring network interfaces"
+
+    Log the start of an action that is expected to take some time.  On
+    Debian, an elipsis (...) will follow the message, and the cursor will
+    stay at EOL.
+
+  - log_action_cont_msg "flushing ARP cache"
+
+    Log an action as part of a process started by log_action_start_msg().
+    On Debian, this message will receive a trailing elipsis, and the cursor
+    will stay at EOL.
+
+  - log_action_end_msg {0|1} ["message"]
+
+    Log the end of the action started by log_action_start_msg().  If one
+    argument is supplied, either "done." (0) or "failed." (1) will be output,
+    followed by a newline.  If a second argument is supplied, the message
+    will appear as follows:
+
+    "done (your message here)." --- if first argument is 0
+    "failed (your message here)." --- if first argument is 1
+
+    This argument must be quoted, or otherwise only the first word will
+    be output.
+
+    On color TTYs, the failure messages will be red.
+
+A deprecated function, log_start_msg, is also provided for
+compatibility with a few older packages and a derived distribution.
+This may eventually disappear.
+
+This package also includes the LSB-specified functions:
+
+log_success_msg
+log_failure_msg
+log_warning_msg
+
+These functions *do not* comply with Debian policy and should only be used
+by LSB packages.
+
+To use these functions, source /lib/lsb/init-functions at the
+beginning of your (Bourne sh or compatible) init script.
+
+Please depend on lsb-base (>= 3.0-6) to ensure all of these
+functions are available for your init scripts.
+
+CUSTOMIZING OUTPUT
+
+If it exists, /etc/lsb-base-logging.sh will be sourced by
+/lib/lsb/init-functions.  You may override any of the log_* functions
+in this file.  The intent is for this file to be supplied as a
+conffile by derived distributions wishing to log init script events in
+a different way.
+
+If supplied, this script fragment should be compatible with any Debian
+/bin/sh, as init scripts sourcing this file may be running under any
+Bourne-style shell permitted by Debian policy (i.e. not just bash).
+
+ -- Chris Lawrence <lawrencc@debian.org>, Fri Sep 16 19:20:32 2005
index 4e00aa94f841cd0f93fb6c576c50fca622f3c023..b20e36f623f275a98094eb6e6398551691b79198 100644 (file)
@@ -1 +1,2 @@
 lib/lsb
+etc/lsb-base
index a6e5dcc592ebc09aa69b7d10944c397cb7f02fff..8d5ece9b05f753aa7d72809ceea2edf50c246322 100755 (executable)
@@ -6,23 +6,28 @@ setup_ldso_symlink () {
         s390|ppc64)
             ln -sf ld.so.1 /lib/ld-lsb-$ARCH.so.1
             ln -sf ld.so.1 /lib/ld-lsb-$ARCH.so.2
+            ln -sf ld.so.1 /lib/ld-lsb-$ARCH.so.3
             ;;
         powerpc)
             ln -sf ld.so.1 /lib/ld-lsb-ppc32.so.1
             ln -sf ld.so.1 /lib/ld-lsb-ppc32.so.2
+            ln -sf ld.so.1 /lib/ld-lsb-ppc32.so.3
             ;;
         i386)
             ln -sf ld-linux.so.2 /lib/ld-lsb.so.1
             ln -sf ld-linux.so.2 /lib/ld-lsb.so.2
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.3
             ;;
         amd64)
             ln -sf ld-linux.so.2 /lib/ld-lsb.so.1
             ln -sf ld-linux.so.2 /lib/ld-lsb.so.2
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.3
             ln -sf /lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.2
             ;;
         ia64)
             ln -sf ld-linux-ia64.so.2 /lib/ld-lsb-ia64.so.1
             ln -sf ld-linux-ia64.so.2 /lib/ld-lsb-ia64.so.2
+            ln -sf ld-linux-ia64.so.2 /lib/ld-lsb-ia64.so.3
             ;;
         *)
             echo "ld-lsb-*.so.1 symlink for $ARCH is unknown!"
index 162b3d0ab9fd515e90c0c83d3630133a85263e5b..d0469c181c599ddb3b1c325f758aa43873b92bc2 100644 (file)
@@ -4,16 +4,16 @@ remove_ldso_symlink () {
     ARCH=`dpkg --print-installation-architecture`
     case "$ARCH" in
         s390|ia64|ppc64)
-            rm -f /lib/ld-lsb-$ARCH.so.[12]
+            rm -f /lib/ld-lsb-$ARCH.so.[123]
             ;;
         powerpc)
-            rm -f /lib/ld-lsb-ppc32.so.[12]
+            rm -f /lib/ld-lsb-ppc32.so.[123]
             ;;
         i386)
-            rm -f /lib/ld-lsb.so.[12]
+            rm -f /lib/ld-lsb.so.[123]
             ;;
         amd64)
-            rm -f /lib/ld-lsb.so.[12] /lib64/ld-lsb-x86-64.so.2
+            rm -f /lib/ld-lsb.so.[123] /lib64/ld-lsb-x86-64.so.2
             ;;
         *)
             echo "ld-lsb-*.so.1 symlink for $ARCH is unknown; not removed."
index 22cfb184a5d0abb5601ec0f71bd1a8818feffa78..31579275fd7ac73894b124bb1152189a670aab97 100644 (file)
@@ -71,8 +71,7 @@ pidofproc () {
     fi
 
     if [ -f "$pidfile" ]; then
-        read -d "" line < "$pidfile"
-        for i in $line; do
+        for i in `cat $pidfile`; do
             if [ -z "$(echo $i | sed 's/[0-9]//g')" -a -d "/proc/$i" ]; then 
                 pids="$i $pids"
             fi
@@ -122,20 +121,24 @@ killproc () {
     fi
 }
 
-TPUT=/usr/bin/tput
-EXPR=/usr/bin/expr
-if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
-    FANCYTTY=1
-else
-    FANCYTTY=0
-fi
+log_use_fancy_output () {
+    TPUT=/usr/bin/tput
+    EXPR=/usr/bin/expr
+    if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
+        FANCYTTY=1
+        true
+    else
+        FANCYTTY=0
+        false
+    fi
+}
 
 log_success_msg () {
     echo "$@"
 }
 
 log_failure_msg () {
-    if [ $FANCYTTY -eq 1 ]; then
+    if log_use_fancy_output; then
         RED=`$TPUT setaf 1`
         NORMAL=`$TPUT op`
         echo "$RED*$NORMAL $@"
@@ -145,7 +148,7 @@ log_failure_msg () {
 }
 
 log_warning_msg () {
-    if [ $FANCYTTY -eq 1 ]; then
+    if log_use_fancy_output; then
         YELLOW=`$TPUT setaf 3`
         NORMAL=`$TPUT op`
         echo "$YELLOW*$NORMAL $@"
@@ -227,13 +230,12 @@ log_progress_msg () {
 
 # int log_end_message (int exitstatus)
 log_end_msg () {
-
     # If no arguments were passed, return
     [ -z "$1" ] && return 1
 
     # Only do the fancy stuff if we have an appropriate terminal
     # and if /usr is already mounted
-    if [ $FANCYTTY -eq 1 ]; then
+    if log_use_fancy_output; then
         RED=`$TPUT setaf 1`
         NORMAL=`$TPUT op`
         if [ $1 -eq 0 ]; then
@@ -250,3 +252,37 @@ log_end_msg () {
     fi
     return $1
 }
+
+log_action_msg () {
+    echo "$@."
+}
+
+log_action_begin_msg () {
+    echo -n "$@..."
+}
+
+log_action_cont_msg () {
+    echo -n "$@..."
+}
+
+log_action_end_msg () {
+    if [ -z "$2" ]; then
+        end="."
+    else
+        end=" ($2)."
+    fi
+
+    if [ $1 -eq 0 ]; then
+        echo "done${end}"
+    else
+        if log_use_fancy_output; then
+            RED=`$TPUT setaf 1`
+            NORMAL=`$TPUT op`
+            /bin/echo -e "${RED}failed${end}${NORMAL}"
+        else:
+            echo "failed${end}"
+        fi
+    fi
+}
+
+[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true