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

Hi,

the attached patch changes the rsync init.d script(s) to use lsb
logging functions.

Regards,
David

--
David Härdeman
diff -ur ./rsync-2.6.8.orig/debian/control ./rsync-2.6.8/debian/control
--- ./rsync-2.6.8.orig/debian/control   2006-09-03 18:12:58.000000000 +0200
+++ ./rsync-2.6.8/debian/control        2006-09-03 18:21:16.000000000 +0200
@@ -7,7 +7,7 @@
 
 Package: rsync
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, lsb-base (>= 3.0-10)
 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 -ur ./rsync-2.6.8.orig/debian/init.d ./rsync-2.6.8/debian/init.d
--- ./rsync-2.6.8.orig/debian/init.d    2006-09-03 18:12:58.000000000 +0200
+++ ./rsync-2.6.8/debian/init.d 2006-09-03 18:20:31.000000000 +0200
@@ -11,6 +11,7 @@
 RSYNC_NICE_PARM=''
 
 test -x $DAEMON || exit 0
+. /lib/lsb/init-functions
 
 if [ -s $RSYNC_DEFAULTS_FILE ]; then
     . $RSYNC_DEFAULTS_FILE
@@ -18,8 +19,7 @@
         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_warning_msg "Value of RSYNC_ENABLE in 
$RSYNC_DEFAULTS_FILE must be either 'true' or 'false'; not starting rsync 
daemon."
                         exit 1
                         ;;
     esac
@@ -27,8 +27,7 @@
         x[0-9])         RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";;
         x[1-9][0-9])    RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";;
         x)              ;;
-        *)              echo "Value of RSYNC_NICE in $RSYNC_DEFAULTS_FILE must 
be a value"
-                        echo "between 0 and 19 (inclusive); ignoring 
RSYNC_NICE now."
+        *)              log_warning_msg "Value of RSYNC_NICE in 
$RSYNC_DEFAULTS_FILE must be a value between 0 and 19 (inclusive); ignoring 
RSYNC_NICE now."
                         ;;
     esac
 fi
@@ -38,42 +37,40 @@
 case "$1" in
   start)
        if "$RSYNC_ENABLE"; then
-            echo -n "Starting rsync daemon: rsync"
+           log_daemon_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
+               log_progress_msg "apparently already running"
+               log_end_msg 0
            fi
             if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
-                echo " missing or empty config file $RSYNC_CONFIG_FILE"
-                exit 1
+                log_progress_msg "missing or empty config file 
$RSYNC_CONFIG_FILE"
+                log_end_msg 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 0
         else
             if [ -s "$RSYNC_CONFIG_FILE" ]; then
-                echo "rsync daemon not enabled in /etc/default/rsync"
+                [ "$VERBOSE" != "no" ] && log_warning_msg "rsync daemon not 
enabled in /etc/default/rsync"
             fi
         fi
        ;;
   stop)
-        echo -n "Stopping rsync daemon: rsync"
+       log_daemon_msg "Stopping rsync daemon" "rsync"
        start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/rsync.pid
        rm -f /var/run/rsync.pid
-        echo "."
+       log_end_msg 0
        ;;
 
   reload|force-reload)
-        echo "Reloading rsync daemon: not needed, as the daemon"
-        echo "re-reads the config file whenever a client connects."
        ;;
 
   restart)
        set +e
         if $RSYNC_ENABLE; then
-            echo -n "Restarting rsync daemon: rsync"
+            log_daemon_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
@@ -85,12 +82,12 @@
                 $RSYNC_NICE_PARM --exec /usr/bin/rsync \
                 -- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" 
$RSYNC_OPTS
            then
-               echo "start failed?"
+               log_end_msg 1
                rm -f /var/run/rsync.pid
            fi
-            echo "."
+           log_end_msg 0
         else
-            echo "rsync daemon not enabled in /etc/default/rsync"
+           [ "$VERBOSE" != "no" ] && log_warning_msg "rsync daemon not enabled 
in /etc/default/rsync"
         fi
        ;;
 

Reply via email to