From 00633d289386a03b3f8f240f46ba4c961595d4e368656cfbded66cc113a56750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Thu, 21 Jul 2016 06:26:49 +0000 Subject: [PATCH 1/2] Accepting request 412484 from home:cbosdonnat:branches:Virtualization - appliance fixes (fate#316274): * re-add helper script mount-rootfs-and-chroot.sh for virt-rescue * make guestfs-data a requirement of guestfs-tools OBS-URL: https://build.opensuse.org/request/show/412484 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=369 --- appliance.patch | 15 +++++++++++++ libguestfs.changes | 7 ++++++ libguestfs.spec | 13 ++++++++++- mount-rootfs-and-chroot.sh | 45 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 appliance.patch create mode 100644 mount-rootfs-and-chroot.sh 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..41ebb13 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +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 + * 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 From e4aa6170d0e59c64c84a137e11d078847f08e4f85b6536f99281de4865a55119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Thu, 21 Jul 2016 06:42:34 +0000 Subject: [PATCH 2/2] Add missing patch name in changelog OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=370 --- libguestfs.changes | 1 + 1 file changed, 1 insertion(+) diff --git a/libguestfs.changes b/libguestfs.changes index 41ebb13..93d3f0a 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -3,6 +3,7 @@ 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 -------------------------------------------------------------------