Package: rsync
Version: 2.6.8-2
Severity: wishlist
Tags: patch

Hi,

Can you please convert rsync's init script to use LSB init functions?
This abstraction opens the gate for doing fancy stuff like boot
logging, graphical boot splashes, etc.

I attach the Ubuntu patch for your convenience.

Thank you!

Martin
-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?
diff -u rsync-2.6.8/debian/control rsync-2.6.8/debian/control
--- rsync-2.6.8/debian/control
+++ rsync-2.6.8/debian/control
@@ -7,7 +7,7 @@
 
 Package: rsync
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, lsb-base (>= 3.0)
 Suggests: openssh-client, openssh-server
 Description: fast remote file copy program (like rcp)
  rsync is a program that allows files to be copied to and from remote
diff -u rsync-2.6.8/debian/changelog rsync-2.6.8/debian/changelog
--- rsync-2.6.8/debian/init.d
+++ rsync-2.6.8/debian/init.d
@@ -12,14 +12,17 @@
 
 test -x $DAEMON || exit 0
 
+. /lib/lsb/init-functions
+. /etc/default/rcS
+
 if [ -s $RSYNC_DEFAULTS_FILE ]; then
     . $RSYNC_DEFAULTS_FILE
     case "x$RSYNC_ENABLE" in
         xtrue|xfalse)   ;;
         xinetd)         exit 0
                         ;;
-        *)              echo "Value of RSYNC_ENABLE in $RSYNC_DEFAULTS_FILE 
must be either 'true' or 'false';"
-                        echo "not starting rsync daemon."
+        *)              log_failure_msg "Value of RSYNC_ENABLE in 
$RSYNC_DEFAULTS_FILE must be either 'true' or 'false';"
+                        log_failure_msg "not starting rsync daemon."
                         exit 1
                         ;;
     esac
@@ -38,59 +41,57 @@
 case "$1" in
   start)
        if "$RSYNC_ENABLE"; then
-            echo -n "Starting rsync daemon: rsync"
+            log_begin_msg "Starting rsync daemon: rsync"
            if [ -s /var/run/rsync.pid ] && kill -0 $(cat /var/run/rsync.pid) 
>/dev/null 2>&1; then
-               echo " apparently already running."
                exit 0
            fi
             if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
-                echo " missing or empty config file $RSYNC_CONFIG_FILE"
+                log_failure_msg " missing or empty config file 
$RSYNC_CONFIG_FILE"
+               log_end_msg 1
                 exit 1
             fi
             start-stop-daemon --start --quiet --background \
                 --pidfile /var/run/rsync.pid --make-pidfile \
                 $RSYNC_NICE_PARM --exec /usr/bin/rsync \
                 -- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" 
$RSYNC_OPTS
-            echo "."
+            log_end_msg $?
         else
             if [ -s "$RSYNC_CONFIG_FILE" ]; then
                 echo "rsync daemon not enabled in /etc/default/rsync"
+               [ "$VERBOSE" != no ] && log_success_msg "rsync daemon not 
enabled in /etc/default/rsync, not starting..."
             fi
         fi
        ;;
   stop)
-        echo -n "Stopping rsync daemon: rsync"
+        log_begin_msg "Stopping rsync daemon: rsync"
        start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/rsync.pid
+        log_end_msg $?
        rm -f /var/run/rsync.pid
-        echo "."
        ;;
 
   reload|force-reload)
-        echo "Reloading rsync daemon: not needed, as the daemon"
-        echo "re-reads the config file whenever a client connects."
+        log_warning_msg "Reloading rsync daemon: not needed, as the daemon"
+        log_warning_msg "re-reads the config file whenever a client connects."
        ;;
 
   restart)
        set +e
         if $RSYNC_ENABLE; then
-            echo -n "Restarting rsync daemon: rsync"
+            log_begin_msg "Restarting rsync daemon: rsync"
            if [ -s /var/run/rsync.pid ] && kill -0 $(cat /var/run/rsync.pid) 
>/dev/null 2>&1; then
                start-stop-daemon --stop --quiet --oknodo --pidfile 
/var/run/rsync.pid || true
                sleep 1
            else
                rm -f /var/run/rsync.pid
            fi
-            if ! start-stop-daemon --start --quiet --background \
+            start-stop-daemon --start --quiet --background \
                 --pidfile /var/run/rsync.pid --make-pidfile \
                 $RSYNC_NICE_PARM --exec /usr/bin/rsync \
                 -- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" 
$RSYNC_OPTS
-           then
-               echo "start failed?"
-               rm -f /var/run/rsync.pid
-           fi
-            echo "."
+           log_end_msg $?
+           rm -f /var/run/rsync.pid
         else
-            echo "rsync daemon not enabled in /etc/default/rsync"
+            [ "$VERBOSE" != no ] && log_success_msg "rsync daemon not enabled 
in /etc/default/rsync, not starting..."
         fi
        ;;
 

Attachment: signature.asc
Description: Digital signature

Reply via email to