Package: bittorrent
Version: 3.4.2
Severity: minor
Tags: patch

Hi,

the attached patch makes the bittorrent init.d script lsb-compliant by using lsb logging functions and return values.

Regards,
David
diff -ur ./bittorrent-3.4.2.orig/debian/bittorrent.init 
./bittorrent-3.4.2/debian/bittorrent.init
--- ./bittorrent-3.4.2.orig/debian/bittorrent.init      2006-08-26 
11:23:41.000000000 +0200
+++ ./bittorrent-3.4.2/debian/bittorrent.init   2006-08-26 11:28:55.000000000 
+0200
@@ -26,20 +26,21 @@
 # Gracefully exit if the package has been removed.
 test -x $DAEMON || exit 0
 
+. /lib/lsb/init-functions
+
 PORT=6969
 DFILE=/var/lib/bittorrent/bttrack.state
 
 # Read config file if it is present.
-if [ -r /etc/default/bittorrent ]
-then
-. /etc/default/bittorrent
+if [ -r /etc/default/bittorrent ]; then
+       . /etc/default/bittorrent
 fi
 
 # Add optional option $1 with argument $2 to OPTS, if $2 is nonempty
 add_opt () {
-if ! test -z "$2" ; then
-OPTS="$OPTS $1 $2"
-fi
+       if ! test -z "$2" ; then
+               OPTS="$OPTS $1 $2"
+       fi
 }
 
 # Compose command-line arguments list for bttrack daemon, based on variables
@@ -75,46 +76,50 @@
 #Function that starts the daemon/service.
 #
 d_start() {
-if [ $START_BTTRACK -ne 1 ]; then
-       echo -n "disabled in /etc/default/bittorrent"
-else
-       echo -n "$NAME"
-       start-stop-daemon --start --background --quiet \
-       --make-pidfile --pidfile "$PIDFILE" \
-       $METAOPTS \
-       --exec $DAEMON -- $DAEMONOPTS
-fi
+       if [ $START_BTTRACK -ne 1 ]; then
+               log_progress_msg "disabled in /etc/default/bittorrent"
+               return 1
+       else
+               start-stop-daemon --start --background --quiet \
+               --make-pidfile --pidfile "$PIDFILE" \
+               $METAOPTS \
+               --exec $DAEMON -- $DAEMONOPTS
+               return 0
+       fi
 }
 
 #
 #Function that stops the daemon/service.
 #
 d_stop() {
-start-stop-daemon --stop --oknodo --quiet --pidfile "$PIDFILE"
+       start-stop-daemon --stop --oknodo --quiet --pidfile "$PIDFILE"
 }
 
 case "$1" in
   start)
-echo -n "Starting $DESC: "
-d_start
-echo "."
-;;
+       log_daemon_msg "Starting $DESC" "$NAME"
+       d_start
+       log_end_msg $?
+       ;;
   stop)
-echo -n "Stopping $DESC: $NAME"
-d_stop
-echo "."
-;;
+       log_daemon_msg "Stopping $DESC" "$NAME"
+       d_stop
+       log_end_msg 0
+       ;;
   restart|force-reload)
-echo -n "Restarting $DESC: $NAME"
-d_stop
-sleep 1
-d_start
-echo "."
-;;
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       d_stop
+       sleep 1
+       d_start
+       log_end_msg $?
+       ;;
+  status)
+       exit 4
+       ;;
   *)
-echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
-exit 1
-;;
+       echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+       exit 2
+       ;;
 esac
 
 exit 0
diff -ur ./bittorrent-3.4.2.orig/debian/control 
./bittorrent-3.4.2/debian/control
--- ./bittorrent-3.4.2.orig/debian/control      2006-08-26 11:23:41.000000000 
+0200
+++ ./bittorrent-3.4.2/debian/control   2006-08-26 11:29:50.000000000 +0200
@@ -8,7 +8,7 @@
 
 Package: bittorrent
 Architecture: all
-Depends: ${python:Depends}
+Depends: ${python:Depends}, lsb-base (>= 3.0-10)
 Suggests: bittorrent-gui
 Recommends: mime-support
 Provides: ${python:Provides}

Reply via email to