-# Launch back-end, inspect for operating systems, and get the guest
-# root disk.
-root=$($gf inspect-get-roots)
-
-if [ "$root" = "" ]; then
- echo "$program: no operating system was found on this disk"
- exit 1
-fi
-
-if [ "$verbose" = "yes" ]; then
- echo root: "$root"
-fi
+# Run virt-inspector and grab inspection information about this guest.
+virt-inspector "${params[@]}" > $tmpdir/xml
+xmlstarlet sel -t -c \
+ "string(/operatingsystems/operatingsystem[position()=1]/name)" \
+ $tmpdir/xml > $tmpdir/type
+xmlstarlet sel -t -c \
+ "string(/operatingsystems/operatingsystem[position()=1]/distro)" \
+ $tmpdir/xml > $tmpdir/distro ||:
+xmlstarlet sel -t -c \
+ "string(/operatingsystems/operatingsystem[position()=1]/package_format)" \
+ $tmpdir/xml > $tmpdir/package_format ||:
+xmlstarlet sel -t -c \
+ "string(/operatingsystems/operatingsystem[position()=1]/package_management)" \
+ $tmpdir/xml > $tmpdir/package_management ||:
+
+type="$(cat $tmpdir/type)"
+distro="$(cat $tmpdir/distro)"
+package_format="$(cat $tmpdir/package_format)"
+package_management="$(cat $tmpdir/package_management)"
+
+# Mount the disk.
+mkdir $tmpdir/mnt
+guestmount --rw -i "${params[@]}" $tmpdir/mnt
+
+mnt="$tmpdir/mnt"