[libvirt] [PATCH 4/4] libvirt-guest.init: Use lsb-init functions

Eric Blake eblake at redhat.com
Fri Mar 11 21:22:19 UTC 2011


On 03/10/2011 10:27 PM, Philipp Hahn wrote:
> The current libvirt-guest init script only prints to stdout, which isn't
> shown when using a graphical splash screen: During a reboot the shutdown
> screen might not show any progress while the domains are suspended.
> 
> This patch mostly drops the use of gettext and gettext_eval and used the
> appropriate lsb_*-functions. Splash screens integrate with LSB compatibe
> init scripts by overwriting the lsb_*-functions defined in
> /lib/lsb/init-functions.

NACK because you dropped the gettext portions.  But I completely agree
that the standards for init scripts recommend using standard log_*
functions rather than direct output to stdout.

http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html

Furthermore, that states that logged messages should be complete lines,
no more than 60 characters; I don't know that we can fully comply with
that (a uuid takes up a lot of real estate, and we (ab)use \r for
progress messages).

A proper patch would combine the two approaches - use gettext to perform
the translation, then use log_* to output the translated strings.

Would you care to rework this patch?

> +++ b/tools/libvirt-guests.init.sh
> @@ -36,6 +36,8 @@ test ! -r "$sysconfdir"/rc.d/init.d/functions ||
>  # Make sure this file is recognized as having translations: _("dummy")
>  . "@bindir@"/gettext.sh
>  
> +. /lib/lsb/init-functions

Hmm, the Fedora init script standards:

http://fedoraproject.org/wiki/Packaging/SysVInitScript

which don't mention this file.  So we probably ought to make its
inclusion conditional, and provide fallback definitions for the log_*
functions if it is not present.

>      if [ "x$ON_BOOT" != xstart ]; then
> -        gettext "libvirt-guests is configured not to start any guests on boot"
> -        echo
> +        log_action_msg "libvirt-guests is configured not to start any guests on boot"

log_action_msg "$(gettext "libvirt-guests is configured not to start any
guests on boot")"

merges both translation and proper logging.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110311/0fed290b/attachment-0001.sig>


More information about the libvir-list mailing list