Package: preload Version: 0.6.4-1 Severity: wishlist Tags: patch The initscript for preload does its printing directly with echo, rather than using the log_daemon_msg etc functions in the LSB init-functions library. This means it doesn't get the pretty treatment offered by the updated versions of these functions, with coloured [ ok ] / [FAIL] etc. I've updated the script to use these functions, patch attached.
-- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-2-amd64 (SMP w/8 CPU cores) Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages preload depends on: ii libc6 2.13-26 Embedded GNU C Library: Shared lib ii libglib2.0-0 2.32.3-1 GLib library of C routines preload recommends no packages. preload suggests no packages. -- no debconf information
--- preload.orig 2012-05-18 16:39:52.000000000 +1200 +++ preload.new 2012-05-18 19:07:00.000000000 +1200 @@ -16,9 +16,11 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/preload NAME=preload -DESC=preload +DESC="Adaptive readahead daemon" DAEMON_OPTS="-s /var/lib/preload/preload.state $DAEMON_OPTS" +. /lib/lsb/init-functions + # Include preload defaults if available if [ -f /etc/default/preload ] ; then . /etc/default/preload @@ -30,36 +32,40 @@ set -e +ret=0 case "$1" in start) - echo -n "Starting $DESC: " - if start-stop-daemon --start --quiet -u 0 $PRELOAD_IOSCHED --exec $DAEMON -- $DAEMON_OPTS; then - echo "$NAME." - else - echo "already running." + log_daemon_msg "Starting $DESC" "$NAME" + start-stop-daemon --start --quiet -u 0 $PRELOAD_IOSCHED --exec $DAEMON -- $DAEMON_OPTS || ret=$? + if [ "$ret" = 1 ]; then + log_progress_msg "already running" + ret=0 fi + log_end_msg $ret ;; stop) - echo -n "Stopping $DESC: " - if start-stop-daemon --stop --retry 1 --quiet -u 0 --exec $DAEMON ; then - echo "$NAME." - else - echo "not running." + log_daemon_msg "Stopping $DESC" "$NAME" + start-stop-daemon --stop --retry 1 --quiet -u 0 --exec $DAEMON || ret=$? + if [ "$ret" = 1 ]; then + log_progress_msg "not running" + ret=0 fi + log_end_msg $ret ;; reload|force-reload) - echo "Reloading $DESC configuration files." - start-stop-daemon --stop $PRELOAD_IOSCHED --signal 1 --quiet -u 0 --exec $DAEMON + log_daemon_msg "$DESC" "Reloading configuration files" + start-stop-daemon --stop $PRELOAD_IOSCHED --signal 1 --quiet -u 0 --exec $DAEMON || ret=$? + log_end_msg $ret ;; restart) - echo -n "Restarting $DESC: " - start-stop-daemon --stop --oknodo --retry 1 --quiet -u 0 --exec $DAEMON - start-stop-daemon --start --quiet -u 0 $PRELOAD_IOSCHED --exec $DAEMON -- $DAEMON_OPTS - echo "$NAME." + log_daemon_msg "Restarting $DESC" "$NAME" + start-stop-daemon --stop --oknodo --retry 1 --quiet -u 0 --exec $DAEMON && \ + start-stop-daemon --start --quiet -u 0 $PRELOAD_IOSCHED --exec $DAEMON -- $DAEMON_OPTS || ret=$? + log_end_msg $ret ;; *) N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + log_success_msg "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac