From: Richard W.M. Jones Date: Thu, 3 Nov 2011 13:09:54 +0000 (+0000) Subject: virt-sysprep: Don't use xmlstarlet. X-Git-Tag: 1.14.2~9 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=267ddc57545f7790faee1e107e84c9f1428c57d1;p=libguestfs.git virt-sysprep: Don't use xmlstarlet. Use virt-inspector --xpath option instead. (cherry picked from commit 22998927f91f123e7c35d3ebf49e5744f3d7eafe) --- diff --git a/README b/README index 510798d..2af85cf 100644 --- 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 diff --git a/clone/test-virt-sysprep.sh b/clone/test-virt-sysprep.sh index 81e01f8..097f416 100755 --- a/clone/test-virt-sysprep.sh +++ b/clone/test-virt-sysprep.sh @@ -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 diff --git a/clone/virt-sysprep.in b/clone/virt-sysprep.in index 144bad4..9150872 100644 --- a/clone/virt-sysprep.in +++ b/clone/virt-sysprep.in @@ -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)"