virt-sysprep: Don't use xmlstarlet.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 3 Nov 2011 13:09:54 +0000 (13:09 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 9 Nov 2011 22:06:50 +0000 (22:06 +0000)
Use virt-inspector --xpath option instead.
(cherry picked from commit 22998927f91f123e7c35d3ebf49e5744f3d7eafe)

README
clone/test-virt-sysprep.sh
clone/virt-sysprep.in

diff --git a/README b/README
index 510798d..2af85cf 100644 (file)
--- a/README
+++ b/README
@@ -132,9 +132,7 @@ To build the Perl tools:
 
 To run virt-sysprep:
 
-- xmlstarlet (optional)
-
-- virt-sysprep also requires FUSE support since it uses guestmount
+- virt-sysprep requires FUSE support since it uses guestmount
 
 
 Building
index 81e01f8..097f416 100755 (executable)
@@ -24,11 +24,6 @@ if [ ! -w /dev/fuse ]; then
     exit 0
 fi
 
-if ! xmlstarlet --help >/dev/null 2>&1; then
-    echo "SKIPPING virt-sysprep test, because xmlstarlet is not installed."
-    exit 0
-fi
-
 rm -f test.img guestfish
 
 qemu-img create -f qcow2 -o backing_file=../images/fedora.img test.img
index 144bad4..9150872 100644 (file)
@@ -222,18 +222,18 @@ trap cleanup EXIT ERR
 
 # Run virt-inspector and grab inspection information about this guest.
 virt-inspector "${params[@]}" > $tmpdir/xml
-xmlstarlet sel -t -c \
+virt-inspector --xpath \
     "string(/operatingsystems/operatingsystem[position()=1]/name)" \
-    $tmpdir/xml > $tmpdir/type
-xmlstarlet sel -t -c \
+    $tmpdir/xml > $tmpdir/type
+virt-inspector --xpath \
     "string(/operatingsystems/operatingsystem[position()=1]/distro)" \
-    $tmpdir/xml > $tmpdir/distro ||:
-xmlstarlet sel -t -c \
+    $tmpdir/xml > $tmpdir/distro ||:
+virt-inspector --xpath \
     "string(/operatingsystems/operatingsystem[position()=1]/package_format)" \
-    $tmpdir/xml > $tmpdir/package_format ||:
-xmlstarlet sel -t -c \
+    $tmpdir/xml > $tmpdir/package_format ||:
+virt-inspector --xpath \
     "string(/operatingsystems/operatingsystem[position()=1]/package_management)" \
-    $tmpdir/xml > $tmpdir/package_management ||:
+    $tmpdir/xml > $tmpdir/package_management ||:
 
 type="$(cat $tmpdir/type)"
 distro="$(cat $tmpdir/distro)"