-# Helper.
-gf="guestfish --remote --"
-
-# Launch back-end, inspect for operating systems, and get the guest
-# root disk.
-root=$($gf inspect-get-roots)
+# Run virt-inspector and grab inspection information about this guest.
+virt-inspector "${params[@]}" > $tmpdir/xml
+virt-inspector --xpath \
+ "string(/operatingsystems/operatingsystem[position()=1]/name)" \
+ < $tmpdir/xml > $tmpdir/type
+virt-inspector --xpath \
+ "string(/operatingsystems/operatingsystem[position()=1]/distro)" \
+ < $tmpdir/xml > $tmpdir/distro ||:
+virt-inspector --xpath \
+ "string(/operatingsystems/operatingsystem[position()=1]/package_format)" \
+ < $tmpdir/xml > $tmpdir/package_format ||:
+virt-inspector --xpath \
+ "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"