Hi, The attached patch removes bashisms from libvirt-guests. TEXTDOMAINDIR is not specified, so system default will be used ("/usr/share/locale" on Debian, I don't know if it's the same on Fedora). "xgettext -L Shell" output is the same with gettext shell functions as with $"..." deprecated Bash-specific syntax. Please generate po files somewhere in the source tree. Thank you, -- Laurent Léonard
diff --git a/tools/libvirt-guests.init.in b/tools/libvirt-guests.init.in index 5dab36b..e91d196 100644 --- a/tools/libvirt-guests.init.in +++ b/tools/libvirt-guests.init.in @@ -31,6 +31,11 @@ libvirtd=@sbindir@/libvirtd # Source function library. . "$sysconfdir"/rc.d/init.d/functions +. gettext.sh + +TEXTDOMAIN=libvirt-guests +export TEXTDOMAIN + URIS=default ON_BOOT=start ON_SHUTDOWN=suspend @@ -128,7 +133,7 @@ start() { [ -f "$LISTFILE" ] || { started; return 0; } if [ "x$ON_BOOT" != xstart ]; then - echo $"libvirt-guests is configured not to start any guests on boot" + gettext "libvirt-guests is configured not to start any guests on boot"; echo rm -f "$LISTFILE" started return 0 @@ -143,20 +148,20 @@ start() { fi done if ! $configured; then - echo $"Ignoring guests on $uri URI" + eval_gettext "Ignoring guests on \$uri URI"; echo continue fi - echo $"Resuming guests on $uri URI..." + eval_gettext "Resuming guests on \$uri URI..."; echo for guest in $list; do name=$(guest_name $uri $guest) - echo -n $"Resuming guest $name: " + eval_gettext "Resuming guest \$name: " if guest_is_on $uri $guest; then if $guest_running; then - echo $"already active" + gettext "already active"; echo else retval run_virsh $uri start "$name" >/dev/null && \ - echo $"done" + gettext "done"; echo fi fi done @@ -172,7 +177,7 @@ suspend_guest() guest=$2 name=$(guest_name $uri $guest) - label=$"Suspending $name: " + label="`eval_gettext \"Suspending \\$name: \"`" echo -n "$label" run_virsh $uri managedsave $guest >/dev/null & virsh_pid=$! @@ -187,7 +192,7 @@ suspend_guest() printf '\r%s%-12s ' "$label" "..." fi done - retval wait $virsh_pid && printf '\r%s%-12s\n' "$label" $"done" + retval wait $virsh_pid && printf '\r%s%-12s\n' "$label" "`gettext \"done\"`" } shutdown_guest() @@ -196,13 +201,13 @@ shutdown_guest() guest=$2 name=$(guest_name $uri $guest) - label=$"Shutting down $name: " + label="`eval_gettext \"Shutting down \\$name: \"`" echo -n "$label" retval run_virsh $uri shutdown $guest >/dev/null || return timeout=$SHUTDOWN_TIMEOUT while [ $timeout -gt 0 ]; do sleep 1 - timeout=$[timeout - 1] + timeout=$((timeout - 1)) guest_is_on $uri $guest || return $guest_running || break printf '\r%s%-12d ' "$label" $timeout @@ -210,9 +215,9 @@ shutdown_guest() if guest_is_on $uri $guest; then if $guest_running; then - printf '\r%s%-12s\n' "$label" $"failed to shutdown in time" + printf '\r%s%-12s\n' "$label" "`gettext \"failed to shutdown in time\"`" else - printf '\r%s%-12s\n' "$label" $"done" + printf '\r%s%-12s\n' "$label" "`gettext \"done\"`" fi fi } @@ -225,7 +230,7 @@ stop() { if [ "x$ON_SHUTDOWN" = xshutdown ]; then suspending=false if [ $SHUTDOWN_TIMEOUT -le 0 ]; then - echo $"Shutdown action requested but SHUTDOWN_TIMEOUT was not set" + gettext "Shutdown action requested but SHUTDOWN_TIMEOUT was not set"; echo RETVAL=6 return fi @@ -233,10 +238,10 @@ stop() { : >"$LISTFILE" for uri in $URIS; do - echo -n $"Running guests on $uri URI: " + eval_gettext "Running guests on \$uri URI: " if [ "x$uri" = xdefault ] && [ ! -x "$libvirtd" ]; then - echo $"libvirtd not installed; skipping this URI." + gettext "libvirtd not installed; skipping this URI."; echo continue fi @@ -249,7 +254,7 @@ stop() { empty=false done if $empty; then - echo $"no running guests." + gettext "no running guests."; echo else echo echo $uri $list >>"$LISTFILE" @@ -259,9 +264,9 @@ stop() { while read uri list; do if $suspending; then - echo $"Suspending guests on $uri URI..." + eval_gettext "Suspending guests on \$uri URI..."; echo else - echo $"Shutting down guests on $uri URI..." + eval_gettext "Shutting down guests on \$uri URI..."; echo fi for guest in $list; do @@ -289,13 +294,13 @@ gueststatus() { # since there is no external daemon process matching this init script. rh_status() { if [ -f "$LISTFILE" ]; then - echo $"stopped, with saved guests" + gettext "stopped, with saved guests"; echo RETVAL=3 else if [ -f "$VAR_SUBSYS_LIBVIRT_GUESTS" ]; then - echo $"started" + gettext "started"; echo else - echo $"stopped, with no saved guests" + gettext "stopped, with no saved guests"; echo fi RETVAL=0 fi @@ -304,7 +309,8 @@ rh_status() { # usage [val] # Display usage string, then exit with VAL (defaults to 2). usage() { - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|gueststatus|shutdown}" + program_name=$0 + eval_gettext "Usage: \$program_name {start|stop|status|restart|condrestart|try-restart|reload|force-reload|gueststatus|shutdown}"; echo exit ${1-2} }
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list