[libvirt] [PATCH 1/2] libvirtd.init: improve portability

Eric Blake eblake at redhat.com
Wed Apr 14 15:53:30 UTC 2010


This patch kills translation of the daemon messages, but being a
daemon, the messages probably didn't need translation in the first
place.  Other alternatives would be to make the script require

* daemon/libvirtd.init.in (start, stop, reload): Drop bash-ism of
$"".  Use printf instead of echo -n.
---

Just as 'echo -e' is non-portable, so is 'echo -n'.  Plus, $"" and
#!/bin/sh don't mix.  Any opinions on the issue of translating the
output of the libvirt daemon, or is this patch okay as-is?

 daemon/libvirtd.init.in |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/daemon/libvirtd.init.in b/daemon/libvirtd.init.in
index 4c8821b..22f3305 100644
--- a/daemon/libvirtd.init.in
+++ b/daemon/libvirtd.init.in
@@ -54,7 +54,7 @@ fi
 RETVAL=0

 start() {
-    echo -n $"Starting $SERVICE daemon: "
+    printf "Starting $SERVICE daemon: "
     mkdir -p @localstatedir@/cache/libvirt
     rm -rf @localstatedir@/cache/libvirt/*
     KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
@@ -64,7 +64,7 @@ start() {
 }

 stop() {
-    echo -n $"Stopping $SERVICE daemon: "
+    printf "Stopping $SERVICE daemon: "

     killproc -p $PIDFILE $PROCESS
     RETVAL=$?
@@ -82,7 +82,7 @@ restart() {
 }

 reload() {
-    echo -n $"Reloading $SERVICE configuration: "
+    printf "Reloading $SERVICE configuration: "

     killproc -p $PIDFILE $PROCESS -HUP
     RETVAL=$?
@@ -106,7 +106,7 @@ case "$1" in
         [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
         ;;
     *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
+        echo "Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
 	exit 2
         ;;
 esac
-- 
1.6.6.1




More information about the libvir-list mailing list