Re: [libvirt] [PATCH] portability fixes to tools/virt-pki-validate.in

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

 



On 04/21/2010 03:52 PM, Dustin Kirkland wrote:
> -ORG=`$CERTOOL -i --infile $CA/cacert.pem | grep Issuer | sed 's+Issuer: CN=++'`
> -if [ "$ORG" == "" ]
> +ORG=`$CERTOOL -i --infile $CA/cacert.pem | grep Issuer | sed -e 's+\s*Issuer: .*CN=++' -e 's+,EMAIL=.*++'`

Using \s in sed is not portable; I'm not even sure what it was supposed
to match to help rewrite it to something in POSIX, since I don't see it
documented in 'info sed'.

> -        if [ "`grep '^LIBVIRTD_ARGS' $(SYSCONFDIR)/sysconfig/libvirtd | grep -- '--listen'`" = "" ]
> +        if ! grep -qs "^LIBVIRTD_ARGS.*--listen" "$SYSCONFDIR"/sysconfig/libvirtd

'if !' is not portable to Solaris /bin/sh.  And 'grep -qs' is not
portable.  A better rewrite would be:

if grep "^LIBVIRTD_ARGS.*--listen" "$SYSCONFDIR"/sysconfig/libvirtd \
    >/dev/null 2>&1 ; then
    :
else
    echo ...
fi

> -        if [ "`grep $PORT $(SYSCONFDIR)/sysconfig/iptables`" = "" ]
> +        if ! grep -qs $PORT "$SYSCONFDIR"/sysconfig/iptables

Likewise:

if grep $PORT "$SYSCONFDIR"/sysconfig/iptables >/dev/null 2>&1 ; then
    :
else
    echo ...
fi

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]