[libvirt] [PATCH] spec: do not start libvirt-guests if that service is off

Eric Blake eblake at redhat.com
Fri Dec 10 00:00:38 UTC 2010


On 12/07/2010 09:05 AM, Dan Kenigsberg wrote:
> starting a service during rpm installation is impolite. It is even worse if done
> during upgrade, for a service that was explicitly turned off.
> ---
>  libvirt.spec.in |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index 48453d7..e0cab78 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -700,9 +700,11 @@ fi
>  /sbin/ldconfig
>  /sbin/chkconfig --add libvirt-guests
>  if [ $1 -ge 1 ]; then
> -    # this doesn't do anything but allowing for libvirt-guests to be
> -    # stopped on the first shutdown
> -    /sbin/service libvirt-guests start > /dev/null 2>&1 || true
> +    if /sbin/chkconfig --list libvirt-guests | /bin/grep -q :on ; then

grep -q is not POSIX, but then again, in a spec file, where you can
assume chkconfig exists, you can assume grep -q exists.  I was going to
suggest saving a process:

case $(/sbin/chkconfig --list libvirt-guests) in
  *:on*) ...
esac

but it's not worth it, for how seldom the shell code in a spec file is run.

> +        # this doesn't do anything but allowing for libvirt-guests to be
> +        # stopped on the first shutdown
> +        /sbin/service libvirt-guests start > /dev/null 2>&1 || true
> +    fi
>  fi

ACK, and pushed as-is.

-- 
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/20101209/2e3bf748/attachment-0001.sig>


More information about the libvir-list mailing list