From db14b0b43119ab98e74fb28bf3573c0a22d6b33033326913fd9b6b546c220dc1 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 31 Aug 2012 13:32:43 +0000 Subject: [PATCH] - add workaround for copying symlinks in mkinitrd (bnc#778149) OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=39 --- libguestfs.changes | 5 +++++ libguestfs.mkinitrd.boot.sh | 12 ++++++++---- libguestfs.spec | 34 ++++++++++++++++++++-------------- mkinitrd.patch | 27 --------------------------- 4 files changed, 33 insertions(+), 45 deletions(-) delete mode 100644 mkinitrd.patch diff --git a/libguestfs.changes b/libguestfs.changes index 1c003da..3ef33b2 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Aug 31 15:30:55 CEST 2012 - ohering@suse.de + +- add workaround for copying symlinks in mkinitrd (bnc#778149) + ------------------------------------------------------------------- Thu Aug 30 20:37:06 CEST 2012 - ohering@suse.de diff --git a/libguestfs.mkinitrd.boot.sh b/libguestfs.mkinitrd.boot.sh index 04a4f41..8f1e031 100644 --- a/libguestfs.mkinitrd.boot.sh +++ b/libguestfs.mkinitrd.boot.sh @@ -8,13 +8,17 @@ #%modules: virtio_pci #%modules: virtio_scsi # -#%programs: cat -#%programs: date -#%programs: guestfsd +#%programs: mdadm +#%programs: modprobe #%programs: lvm +#%programs: grep +#%programs: ls +#%programs: cat #%programs: ip #%programs: lsmod -#%programs: grep +#%programs: date +#%programs: guestfsd +# #@GUESTFS_EXT_CMDS@ # missing_commands="@GUESTFS_MISSING_CMDS@" diff --git a/libguestfs.spec b/libguestfs.spec index 2eb6c35..121a25c 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -146,7 +146,6 @@ Patch101: libguestfs.perl.no-rpath.patch Source0: %{name}-%{version}.tar.gz Source10: libguestfs.mkinitrd.boot.sh Source11: libguestfs.mkinitrd.setup.sh -Source42: mkinitrd.patch Recommends: %{name}-data %description @@ -333,30 +332,28 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/*.{l,}a touch %{name}.lang %find_lang %{name} # -cmds="` +ext_cmds="` objcopy -j .guestfsd_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout | tr '\0' '\n' | sort -u `" -> cmds.txt +test -n "$ext_cmds" +# +> ext_cmds.txt > missing_cmds.txt -for cmd in ls $cmds +for cmd in ls $ext_cmds do if test -n "` PATH=$PATH:/sbin:/usr/sbin type -p $cmd `" then - echo "#%%programs: $cmd" >> cmds.txt + echo "#%%programs: $cmd" >> ext_cmds.txt else - echo "# missing: $cmd" >> cmds.txt + echo "# missing: $cmd" >> ext_cmds.txt echo "$cmd" >> missing_cmds.txt fi done -head -n 1234 cmds.txt missing_cmds.txt +head -n 1234 ext_cmds.txt missing_cmds.txt rm -rf mkinitrd cp -av /lib/mkinitrd . -if patch -p0 --dry-run < %{S:42} -then - patch -p0 < %{S:42} -fi for bad in \ setup-dm.sh \ setup-storage.sh @@ -369,7 +366,7 @@ chmod 755 mkinitrd/scripts/*guestfs.sh sed -i~ ' /^#@GUESTFS_EXT_CMDS@/ { s@^.*@@ -r cmds.txt +r ext_cmds.txt } /@GUESTFS_MISSING_CMDS@/ { s@^.*@missing_commands="@ @@ -379,6 +376,7 @@ a \ } ' mkinitrd/scripts/boot-guestfs.sh diff -u mkinitrd/scripts/boot-guestfs.sh~ mkinitrd/scripts/boot-guestfs.sh || : +# /sbin/mkinitrd_setup \ -s $PWD/mkinitrd/scripts \ -i $PWD/mkinitrd @@ -390,14 +388,22 @@ arch=i686 #? %endif cp -avL /boot/vmlinuz mkinitrd/boot_tmp/vmlinuz.${arch} cp -avL /boot/System.map-${kver} mkinitrd/boot_tmp -env PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH} \ +# [Bug 778149] mkinitrd does not copy links correctly +mkdir mkinitrd/bin_tmp +for cmd in ` awk '/^#%programs:/ { print $2 }' mkinitrd/scripts/boot-guestfs.sh | sort -u ` +do + cp -v ` PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH}:/sbin:/usr/sbin type -p $cmd ` mkinitrd/bin_tmp/ || : +done +chmod -v 755 mkinitrd/bin_tmp/* +# +env PATH=$PWD/mkinitrd/bin_tmp:${PATH} \ bash -x \ /sbin/mkinitrd \ -l $PWD/mkinitrd \ -k vmlinuz.${arch} \ -i initramfs.${arch}.img \ -b $PWD/mkinitrd/boot_tmp \ - -m 'dm-mod loop' \ + -m 'loop' \ -B # mkdir -vp $RPM_BUILD_ROOT%{_libdir}/guestfs diff --git a/mkinitrd.patch b/mkinitrd.patch deleted file mode 100644 index cc516ce..0000000 --- a/mkinitrd.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- mkinitrd/scripts/setup-prepare.sh.orig 2012-08-31 09:49:26.000000000 +0000 -+++ mkinitrd/scripts/setup-prepare.sh 2012-08-31 09:51:16.000000000 +0000 -@@ -29,13 +29,13 @@ - if [ -h "$1" ]; then - lnkTarget=$(readlink $1) - if [ -e $lnkTarget ];then -- cp -a $lnkTarget $2/$lnkTarget -+ cp -v --remove-destination $lnkTarget $2/ - else - # This link points to something in the same directory - lnkSrc="$1" - # Get the base bath of the link origin - lnkSrcBase=${lnkSrc%/*} -- cp -a $lnkSrcBase/$lnkTarget $2/$lnkSrcBase/$lnkTarget -+ cp -v --remove-destination $lnkSrcBase/$lnkTarget $2/$lnkSrcBase/$lnkTarget - fi - return 1 - fi -@@ -43,7 +43,7 @@ - } - - cp_bin() { -- cp -a "$@" \ -+ cp -v --remove-destination "$@" \ - || exit_code=1 - - if [ -h "$1" ]; then