diff --git a/appliance.patch b/appliance.patch new file mode 100644 index 0000000..313664d --- /dev/null +++ b/appliance.patch @@ -0,0 +1,15 @@ +Index: libguestfs-1.32.4/appliance/init +=================================================================== +--- libguestfs-1.32.4.orig/appliance/init ++++ libguestfs-1.32.4/appliance/init +@@ -182,7 +182,9 @@ else + echo + echo "Note: The contents of / are the rescue appliance." + echo "You have to mount the guest's partitions under /sysroot" +- echo "before you can examine them." ++ echo "before you can examine them. A helper script for that exists:" ++ echo "mount-rootfs-and-chroot.sh /dev/sda2" ++ + echo + bash -i + echo diff --git a/libguestfs.changes b/libguestfs.changes index bd9a67e..93d3f0a 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Jul 20 19:47:22 UTC 2016 - cbosdonnat@suse.com + +- appliance fixes (fate#316274): + * re-add helper script mount-rootfs-and-chroot.sh for virt-rescue + appliance.patch + * make guestfs-data a requirement of guestfs-tools + ------------------------------------------------------------------- Wed Jul 20 08:32:21 UTC 2016 - cbosdonnat@suse.com diff --git a/libguestfs.spec b/libguestfs.spec index 7dd9806..8f40d16 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -199,9 +199,11 @@ Summary: Compatibility package for guestfs-tools License: GPL-2.0 Group: System/Filesystems Patch0: 0000-hotfix.patch +Patch100: appliance.patch Source0: %{name}-%{version}.tar.xz Source1: libguestfs.rpmlintrc +Source100: mount-rootfs-and-chroot.sh Source789653: Pod-Simple-3.23.tar.xz # Source10001: libguestfs.test.simple.run-libugestfs-test-tool.sh @@ -256,7 +258,7 @@ Requires: perl(Win::Hivex) Requires: perl(Win::Hivex::Regedit) %endif %endif -Recommends: guestfs-data +Requires: guestfs-data Conflicts: guestfs-data < %{version} Conflicts: libguestfs0 < %{version} @@ -558,6 +560,7 @@ It can import a variety of guest operating systems from libvirt-managed hosts. : _ignore_exclusive_arch '%{?_ignore_exclusive_arch}' %setup -q -a 789653 %patch0 -p1 +%patch100 -p1 %build bison --version @@ -681,6 +684,14 @@ rm -rf $RPM_BUILD_ROOT/tmp %endif %endif +mkdir -p $RPM_BUILD_ROOT/tmp/usr/bin +cp %{S:100} $RPM_BUILD_ROOT/tmp/usr/bin +chmod a+x $RPM_BUILD_ROOT/tmp/usr/bin/* +pushd $RPM_BUILD_ROOT/tmp +tar czf $RPM_BUILD_ROOT/%{_libdir}/guestfs/supermin.d/zz-scripts.tar.gz usr +popd +rm -rf $RPM_BUILD_ROOT/tmp + %if %{with p2v} # Remove the kickstart files from p2v package rm $RPM_BUILD_ROOT/%{_datadir}/virt-p2v/p2v.ks.in diff --git a/mount-rootfs-and-chroot.sh b/mount-rootfs-and-chroot.sh new file mode 100644 index 0000000..98395cf --- /dev/null +++ b/mount-rootfs-and-chroot.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Usage: $0 /dev/sda5 +rootfs=$1 +mnt=/sysroot +mounts= + +if test -b "${rootfs}" +then + + mkdir -v -p "${mnt}" + + if mount -v "${rootfs}" "${mnt}" + then + + for i in dev dev/pts proc sys selinux + do + if test -d /${i} && test -d "${mnt}/${i}" && test "`stat -c %D /`" != "`stat -c %D ${i}`" + then + mount -v --bind /${i} "${mnt}/${i}" + fi + done + + chroot "${mnt}" su - + + while read b m rest + do + case "${m}" in + ${mnt}*) + mounts="${m} ${mounts}" + ;; + esac + done <<-EOF +` +cat < /proc/mounts +` +EOF + + for i in ${mounts} + do + umount -v "${i}" + done + + fi + +fi