~ubuntu-branches/ubuntu/maverick/libvirt/maverick

« back to all changes in this revision

Viewing changes to debian/patches/9023-virt-pki-validate_fixes.patch

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2010-04-21 15:59:49 UTC
  • Revision ID: james.westby@ubuntu.com-20100421155949-rpa38ysxx1z9sbcq
Tags: 0.7.5-5ubuntu27
* debian/libvirt-bin.postinst: ensure that the convenience feature
  of adding users to the libvirtd group does cause package setup
  failure, LP: #565380
* debian/patches/9023-virt-pki-validate_fixes.patch: fix a bashism,
  a missing autoconf substitution, and an insufficient sed call, in
  order to get this working on Ubuntu, LP: #562266; patch submitted
  upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
portability fixes to tools/virt-pki-validate.in
 
2
 
 
3
A few fixes will help make tools/virt-pki-validate.in useful on Debian and Ubuntu.  And one fix should be useful to everyone (see #4).
 
4
 
 
5
 1) note our gnutls-bin package (in addition to your gnutls-utils package) in the no-certtool error text
 
6
 
 
7
 2) adjust the ORG-setting sed regular expressions to work with both Red Hat and Ubuntu style cacert.pem Issuer format
 
8
 
 
9
 3) fix a bashism, == should be = in the case where /bin/sh is a symlink to dash
 
10
 
 
11
 4) $(SYSCONFDIR) cannot evaluate; set a single shell SYSCONFDIR variable to the autoconf @SYSCONFDIR@ value, and use $SYSCONFDIR everywhere
 
12
 
 
13
This was tested against gnutls 2.8.5.  And against both Red Hat and Ubuntu cacert.pem files.  Credit Jamie Strandboge with the regular expression changes.
 
14
 
 
15
Bug report:
 
16
 * https://bugs.edge.launchpad.net/ubuntu/+source/libvirt/+bug/562266
 
17
 
 
18
Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
 
19
 
 
20
diff -uprN libvirt-0.7.5/tools/virt-pki-validate.in libvirt-0.7.5.new/tools/virt-pki-validate.in
 
21
--- libvirt-0.7.5/tools/virt-pki-validate.in    2009-12-22 03:37:57.000000000 -0600
 
22
+++ libvirt-0.7.5.new/tools/virt-pki-validate.in        2010-04-21 15:42:04.677879001 -0500
 
23
@@ -16,8 +16,8 @@ PORT=16514
 
24
 CERTOOL=`which certtool 2>/dev/null`
 
25
 if [ ! -x $CERTOOL ]
 
26
 then
 
27
-    echo Could not locate the certtool program
 
28
-    echo make sure the gnutls-utils package is installed
 
29
+    echo "Could not locate the certtool program"
 
30
+    echo "make sure the gnutls-utils (or gnutls-bin) package is installed"
 
31
     exit 1
 
32
 fi
 
33
 echo Found $CERTOOL
 
34
@@ -25,7 +25,8 @@ echo Found $CERTOOL
 
35
 #
 
36
 # Check the directory structure
 
37
 #
 
38
-PKI="$(SYSCONFDIR)/pki"
 
39
+SYSCONFDIR="@SYSCONFDIR@"
 
40
+PKI="$SYSCONFDIR/pki"
 
41
 if [ ! -d $PKI ]
 
42
 then
 
43
     echo the $PKI directory is missing, it is usually
 
44
@@ -129,8 +130,8 @@ then
 
45
     echo "as root do: chmod 644 $CA/cacert.pem"
 
46
     exit 1
 
47
 fi
 
48
-ORG=`$CERTOOL -i --infile $CA/cacert.pem | grep Issuer | sed 's+Issuer: CN=++'`
 
49
-if [ "$ORG" == "" ]
 
50
+ORG=`$CERTOOL -i --infile $CA/cacert.pem | grep Issuer | sed -e 's+\s*Issuer: .*CN=++' -e 's+,EMAIL=.*++'`
 
51
+if [ "$ORG" = "" ]
 
52
 then
 
53
     echo the CA certificate $CA/cacert.pem does not define the organization
 
54
     echo it should probably regenerated
 
55
@@ -240,19 +241,19 @@ fi
 
56
 
 
57
 if [ "$SERVER" = "1" ]
 
58
 then
 
59
-    if [ -r $(SYSCONFDIR)/sysconfig/libvirtd ]
 
60
+    if [ -r $SYSCONFDIR/sysconfig/libvirtd ]
 
61
     then
 
62
-        if [ "`grep '^LIBVIRTD_ARGS' $(SYSCONFDIR)/sysconfig/libvirtd | grep -- '--listen'`" = "" ]
 
63
+        if [ "`grep '^LIBVIRTD_ARGS' $SYSCONFDIR/sysconfig/libvirtd | grep -- '--listen'`" = "" ]
 
64
        then
 
65
-           echo Make sure $(SYSCONFDIR)/sysconfig/libvirtd is setup to listen to
 
66
+           echo Make sure $SYSCONFDIR/sysconfig/libvirtd is setup to listen to
 
67
            echo TCP/IP connections and restart the libvirtd service
 
68
        fi
 
69
     fi
 
70
-    if [ -r $(SYSCONFDIR)/sysconfig/iptables ]
 
71
+    if [ -r $SYSCONFDIR/sysconfig/iptables ]
 
72
     then
 
73
-        if [ "`grep $PORT $(SYSCONFDIR)/sysconfig/iptables`" = "" ]
 
74
+        if [ "`grep $PORT $SYSCONFDIR/sysconfig/iptables`" = "" ]
 
75
        then
 
76
-           echo Make sure $(SYSCONFDIR)/sysconfig/iptables is setup to allow
 
77
+           echo Make sure $SYSCONFDIR/sysconfig/iptables is setup to allow
 
78
            echo incoming TCP/IP connections on port $PORT and
 
79
            echo restart the iptables service
 
80
        fi