SHA256
1
0
forked from pool/libguestfs

- add workaround for copying symlinks in mkinitrd (bnc#778149)

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=39
This commit is contained in:
Olaf Hering 2012-08-31 13:32:43 +00:00 committed by Git OBS Bridge
parent 1281aa499f
commit db14b0b431
4 changed files with 33 additions and 45 deletions

View File

@ -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

View File

@ -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@"

View File

@ -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

View File

@ -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