[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv3 2/2] spec: don't use chkconfig --list



On 12/07/2011 07:53 PM, Daniel Veillard wrote:
>>>>   # We check this by looking to see if the daemon is already installed
>>>> -/sbin/chkconfig --list libvirtd 1>/dev/null 2>&1
>>>> -if test $? != 0&&  test ! -f
>>>> %{_sysconfdir}/libvirt/qemu/networks/default.xml
>>>> +if ! /sbin/chkconfig&&  test ! -f
>>
>> Actually, in my testing, I realized this has to be '/bin/chkconfig
>> libvirtd', not '/sbin/chkconfig'.
>>
>>>
>>> ACK.
>>
>> I'll push the corrected version.
> 
>   Humm ... here on Fedora 14 it's definitely /sbin/chkconfig there
> is no /bin/chkconfig,
> 

Aargh - I typo'd my typo correction.

>   let's wait after the release to get a definitive fix,

/sbin/chkconfig is what is actually in the commit, and I see no reason
to defer it.  For the record, here's the patch that I actually tested
(rather than fat-fingering my email):

commit c4a387fdd8f3d86df7815d9a8bfca57baa3f14f1
Author: Eric Blake <eblake redhat com>
Date:   Tue Dec 6 16:16:34 2011 -0700

    spec: don't use chkconfig --list

    https://bugzilla.redhat.com/show_bug.cgi?id=694403 reports that
    the specfile is incorrectly checking for a running libvirt-guests
    service.  For example,

    $ LC_ALL=es_ES chkconfig --list libvirt-guests
    libvirt-guests 	  0:desactivado		 1:desactivado	   2:desactivado
   3:activo	 4:activo  5:activo	    6:desactivado

    will fail to find 5:on, even though it is active.  But chkconfig
    already has a mode where you can silently use the exit status to
    check for an active service.

    * libvirt.spec.in (%post): Use simpler chkconfig options, to avoid
    issues with localization.

diff --git a/libvirt.spec.in b/libvirt.spec.in
index c2c926d..3a5363d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -887,8 +887,7 @@ getent passwd qemu >/dev/null || \
 # We want to install the default network for initial RPM installs
 # or on the first upgrade from a non-network aware libvirt only.
 # We check this by looking to see if the daemon is already installed
-/sbin/chkconfig --list libvirtd 1>/dev/null 2>&1
-if test $? != 0 && test ! -f
%{_sysconfdir}/libvirt/qemu/networks/default.xml
+if ! /sbin/chkconfig libvirtd && test ! -f
%{_sysconfdir}/libvirt/qemu/networks/default.xml
 then
     UUID=`/usr/bin/uuidgen`
     sed -e "s,</name>,</name>\n  <uuid>$UUID</uuid>," \
@@ -1021,8 +1020,7 @@ fi
 /sbin/chkconfig --add libvirt-guests
 if [ $1 -ge 1 ]; then
     level=$(/sbin/runlevel | /bin/cut -d ' ' -f 2)
-    if /sbin/chkconfig --list libvirt-guests 2>/dev/null \
-        | /bin/grep -q $level:on ; then
+    if /sbin/chkconfig --levels $level libvirt-guests; 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


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]