[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#676845: sane-utils: The init.d script of saned doesn't have a 'fancy' lsb output



Package: sane-utils
Version: 1.0.23-3
Followup-For: Bug #676845

Dear Maintainer,

attached you find a patched version of /etc/init.d/saned where all echo
commands have been replaced by the appropriate lsb functions.

Thanks.

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'stable'), (400, 'stable-updates'), (2, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.10-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sane-utils depends on:
ii  adduser                3.113+nmu3
ii  debconf [debconf-2.0]  1.5.52
ii  libavahi-client3       0.6.31-2
ii  libavahi-common3       0.6.31-2
ii  libc6                  2.17-93
ii  libieee1284-3          0.2.11-12
ii  libsane                1.0.23-3
ii  libusb-1.0-0           2:1.0.17-1+b1
ii  update-inetd           4.43

sane-utils recommends no packages.

Versions of packages sane-utils suggests:
ii  avahi-daemon  0.6.31-2
pn  unpaper       <none>

-- Configuration Files:
/etc/init.d/saned changed:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/saned
NAME=saned
DESC="SANE network scanner server"
test -x $DAEMON || exit 0
RUN=no
RUN_AS_USER=saned
.. /lib/lsb/init-functions
if [ -f /etc/default/saned ] ; then
    . /etc/default/saned
fi
if [ "x$RUN" != "xyes" ] ; then
    log_success_msg "$NAME disabled; edit /etc/default/saned"
    exit 0
fi
DAEMON_OPTS="-a $RUN_AS_USER"
set -e
case "$1" in
  start)
	log_daemon_msg "Starting $DESC" "$NAME"
	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON -- $DAEMON_OPTS
	log_end_msg $?
	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON
	log_end_msg $?
	;;
  force-reload)
	# check whether $DAEMON is running. If so, restart
	start-stop-daemon --stop --test --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON \
	&& $0 restart \
	|| exit 0
	;;
  restart)
	log_daemon_msg "Restarting $DESC" "$NAME"
	start-stop-daemon --stop --oknodo --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON
	sleep 1
	start-stop-daemon --start --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
	log_end_msg $?
	;;
  status)
	if [ -s /var/run/$NAME.pid ]; then
            RUNNING=$(cat /var/run/$NAME.pid)
            if [ -d /proc/$RUNNING ]; then
                if [ $(readlink /proc/$RUNNING/exe) = $DAEMON ]; then
                    log_success_msg "$NAME is running"
                    exit 0
                fi
            fi
            # No such PID, or executables don't match
            log_failure_msg "$NAME is not running, but pidfile existed"
            rm /var/run/$NAME.pid
            exit 1
        else
            rm -f /var/run/$NAME.pid
            log_failure_msg "$NAME not running"
            exit 1
        fi
	;;
  *)
	N=/etc/init.d/$NAME
	log_failure_msg "Usage: $N {start|stop|restart|force-reload}"
	exit 1
	;;
esac
exit 0


-- debconf information:
  sane-utils/saned_scanner_group: true
  sane-utils/saned_run: false
--- 1.0.23-3/saned	2013-11-14 13:55:32.278804866 +0100
+++ lsb-output/saned	2013-11-14 14:07:58.859989773 +0100
@@ -23,13 +23,16 @@
 RUN=no
 RUN_AS_USER=saned
 
+# Get lsb functions
+. /lib/lsb/init-functions
+
 # Include saned defaults if available
 if [ -f /etc/default/saned ] ; then
     . /etc/default/saned
 fi
 
 if [ "x$RUN" != "xyes" ] ; then
-    echo "$NAME disabled; edit /etc/default/saned"
+    log_success_msg "$NAME disabled; edit /etc/default/saned"
     exit 0
 fi
 
@@ -39,16 +42,16 @@
 
 case "$1" in
   start)
-	echo -n "Starting $DESC: "
+	log_daemon_msg "Starting $DESC" "$NAME"
 	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
 		--exec $DAEMON -- $DAEMON_OPTS
-	echo "$NAME."
+	log_end_msg $?
 	;;
   stop)
-	echo -n "Stopping $DESC: "
+	log_daemon_msg "Stopping $DESC" "$NAME"
 	start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
 		--exec $DAEMON
-	echo "$NAME."
+	log_end_msg $?
 	;;
   force-reload)
 	# check whether $DAEMON is running. If so, restart
@@ -58,37 +61,37 @@
 	|| exit 0
 	;;
   restart)
-	echo -n "Restarting $DESC: "
+	log_daemon_msg "Restarting $DESC" "$NAME"
 	start-stop-daemon --stop --oknodo --quiet --pidfile \
 		/var/run/$NAME.pid --exec $DAEMON
 	sleep 1
 	start-stop-daemon --start --quiet --pidfile \
 		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
-	echo "$NAME."
+	log_end_msg $?
 	;;
   status)
 	if [ -s /var/run/$NAME.pid ]; then
             RUNNING=$(cat /var/run/$NAME.pid)
             if [ -d /proc/$RUNNING ]; then
                 if [ $(readlink /proc/$RUNNING/exe) = $DAEMON ]; then
-                    echo "$NAME is running."
+                    log_success_msg "$NAME is running"
                     exit 0
                 fi
             fi
 
             # No such PID, or executables don't match
-            echo "$NAME is not running, but pidfile existed."
+            log_failure_msg "$NAME is not running, but pidfile existed"
             rm /var/run/$NAME.pid
             exit 1
         else
             rm -f /var/run/$NAME.pid
-            echo "$NAME not running."
+            log_failure_msg "$NAME not running"
             exit 1
         fi
 	;;
   *)
 	N=/etc/init.d/$NAME
-	echo "Usage: $N {start|stop|restart|force-reload}" >&2
+	log_failure_msg "Usage: $N {start|stop|restart|force-reload}"
 	exit 1
 	;;
 esac

Reply to: