From 360fb8aed7dea9daec7fb901348212b1b5eb0e6a Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Sat, 30 Apr 2016 16:38:16 +0200
Subject: [PATCH] udftools: Fix LSB init output

---
 debian/udftools.init | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/debian/udftools.init b/debian/udftools.init
index 9a1a1f4..54b8ab1 100644
--- a/debian/udftools.init
+++ b/debian/udftools.init
@@ -24,6 +24,8 @@
 #                    writing device /dev/pktcdvd/0.
 ### END INIT INFO
 
+. /lib/lsb/init-functions
+
 set -e
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -70,13 +72,13 @@ fi
 
 dostart() {
     if test -z "$DEVICES"; then
-        echo "Not starting $DESC: No devices listed in $DEFAULTFILE"
+        log_action_msg "Not starting $DESC, no devices listed in $DEFAULTFILE"
     else
-        echo "Starting $DESC:"
+        log_action_begin_msg "Starting $DESC"
         if $NEWINT; then
             set $NEWINTNAMES
             for DEVICE in $DEVICES; do
-                echo -n "/dev/pktcdvd/$1=$DEVICE " || true
+                log_action_cont_msg "/dev/pktcdvd/$1=$DEVICE"
                 $PKTSETUP "$1" "$DEVICE"
                 shift
             done
@@ -87,24 +89,24 @@ dostart() {
                 set $OLDINTNAMES
             fi
             for DEVICE in $DEVICES; do
-                echo -n "$1=$DEVICE " || true
+                log_action_cont_msg "$1=$DEVICE"
                 $PKTSETUP "$1" "$DEVICE"
                 shift
             done
         fi
-        echo ""
+        log_action_end_msg 0
     fi
 }
 
 dostop() {
     if test -z "$DEVICES"; then
-        echo "Not stopping $DESC: No devices listed in $DEFAULTFILE"
+        log_action_msg "Not stopping $DESC, no devices listed in $DEFAULTFILE"
     else
-        echo "Stopping $DESC:"
+        log_action_begin_msg "Stopping $DESC"
         if $NEWINT; then
             set $NEWINTNAMES
             for DEVICE in $DEVICES; do
-                echo -n "/dev/pktcdvd/$1=$DEVICE " || true
+                log_action_cont_msg "/dev/pktcdvd/$1=$DEVICE"
                 $PKTSETUP -d "$1" || true
                 shift
             done
@@ -115,22 +117,24 @@ dostop() {
                 set $OLDINTNAMES
             fi
             for DEVICE in $DEVICES; do
-                echo -n "$1=$DEVICE " || true
+                log_action_cont_msg "$1=$DEVICE"
                 $PKTSETUP -d "$1" || true
                 shift
             done
         fi
-        echo ""
+        log_action_end_msg 0
     fi
 }
 
+set +e
+
 case "$1" in
     start) dostart;;
     stop)  dostop;;
     restart|force-reload) dostop; dostart;;
     status)
         nmappings=`$PKTSETUP -s | wc -l`
-        echo "Status of $DESC: $nmappings device mappings"
+        log_action_msg "Status of $DESC" "$nmappings device mappings"
         if test $nmappings -eq 0; then exit 1; fi
         ;;
     *)
-- 
2.8.1

