From ee6b909e038036974341f38fa9539e6ba1676619b2332f95ad5e4a884d77888a Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 31 Aug 2012 10:10:06 +0000 Subject: [PATCH] add more packages to BuildRequires to reduce number of missing_commands OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=35 --- ...ect-list-of-called-external-commands.patch | 21 ++++++++-------- libguestfs.mkinitrd.boot.sh | 12 ++++++++-- libguestfs.spec | 22 +++++++++++++---- mkinitrd.patch | 24 +++++++++++++++---- 4 files changed, 58 insertions(+), 21 deletions(-) diff --git a/0002-daemon-collect-list-of-called-external-commands.patch b/0002-daemon-collect-list-of-called-external-commands.patch index a2dae24..1813c09 100644 --- a/0002-daemon-collect-list-of-called-external-commands.patch +++ b/0002-daemon-collect-list-of-called-external-commands.patch @@ -1,4 +1,4 @@ -From d6f33733cd19aab9e94cb368910ff6add50ad13d Mon Sep 17 00:00:00 2001 +From 0bd3d066eb8df3148c389d09664e16179c9a5284 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 30 Aug 2012 15:37:40 +0200 Subject: [PATCH 2/2] daemon: collect list of called external commands @@ -54,7 +54,7 @@ Signed-off-by: Olaf Hering daemon/link.c | 6 ++-- daemon/ls.c | 6 ++-- daemon/luks.c | 14 ++++---- - daemon/lvm-filter.c | 13 +++++--- + daemon/lvm-filter.c | 12 ++++--- daemon/lvm.c | 64 +++++++++++++++++++------------------ daemon/md.c | 10 +++--- daemon/mkfs.c | 7 ++-- @@ -71,7 +71,7 @@ Signed-off-by: Olaf Hering daemon/xfs.c | 16 +++++++--- daemon/zero.c | 6 ++-- daemon/zerofree.c | 6 ++-- - 51 Dateien geändert, 357 Zeilen hinzugefügt(+), 205 Zeilen entfernt(-) + 51 Dateien geändert, 356 Zeilen hinzugefügt(+), 205 Zeilen entfernt(-) diff --git a/contrib/intro/libguestfs-intro.html b/contrib/intro/libguestfs-intro.html index 380e290..52dcce5 100644 @@ -1372,22 +1372,21 @@ index 02620ef..3e3b456 100644 ADD_ARG (argv, i, "-d"); ADD_ARG (argv, i, tempfile); diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c -index 5eb2402..cde773d 100644 +index 5eb2402..52d6b3d 100644 --- a/daemon/lvm-filter.c +++ b/daemon/lvm-filter.c -@@ -31,6 +31,11 @@ +@@ -31,6 +31,10 @@ #include "daemon.h" #include "actions.h" +GUESTFSD_EXT_CMD(str_lvm, lvm); -+GUESTFSD_EXT_CMD(str_vgchange, vgchange); +GUESTFSD_EXT_CMD(str_cp, cp); +GUESTFSD_EXT_CMD(str_rm, rm); + /* This runs during daemon start up and creates a complete copy of * /etc/lvm so that we can modify it as we desire. We set * LVM_SYSTEM_DIR to point to the copy. -@@ -65,7 +70,7 @@ copy_lvm (void) +@@ -65,7 +69,7 @@ copy_lvm (void) } /* Hopefully no dotfiles in there ... XXX */ @@ -1396,7 +1395,7 @@ index 5eb2402..cde773d 100644 r = system (cmd); if (r == -1) { perror (cmd); -@@ -92,7 +97,7 @@ rm_lvm_system_dir (void) +@@ -92,7 +96,7 @@ rm_lvm_system_dir (void) { char cmd[64]; @@ -1405,16 +1404,16 @@ index 5eb2402..cde773d 100644 ignore_value (system (cmd)); } -@@ -189,7 +194,7 @@ static int +@@ -189,7 +193,7 @@ static int vgchange (const char *vgchange_flag) { char *err; - int r = command (NULL, &err, "lvm", "vgchange", vgchange_flag, NULL); -+ int r = command (NULL, &err, str_lvm, str_vgchange, vgchange_flag, NULL); ++ int r = command (NULL, &err, str_lvm, "vgchange", vgchange_flag, NULL); if (r == -1) { reply_with_error ("vgchange: %s", err); free (err); -@@ -224,7 +229,7 @@ rescan (void) +@@ -224,7 +228,7 @@ rescan (void) unlink (lvm_cache); char *err; diff --git a/libguestfs.mkinitrd.boot.sh b/libguestfs.mkinitrd.boot.sh index c665bf1..04a4f41 100644 --- a/libguestfs.mkinitrd.boot.sh +++ b/libguestfs.mkinitrd.boot.sh @@ -11,10 +11,13 @@ #%programs: cat #%programs: date #%programs: guestfsd +#%programs: lvm #%programs: ip #%programs: lsmod +#%programs: grep #@GUESTFS_EXT_CMDS@ # +missing_commands="@GUESTFS_MISSING_CMDS@" # from libguestfs-1.19.34/appliance/init: @@ -28,7 +31,7 @@ lvm vgscan --ignorelockingfailure lvm vgchange -ay --ignorelockingfailure # Improve virtio-blk performance (RHBZ#509383). -for f in /sys/block/vd*/queue/rotational; do echo 1 > $f; done +for f in /sys/block/vd*/queue/rotational; do if test -f $f ; then echo 1 > $f; fi ; done # These are useful when debugging. if grep -sq guestfs_verbose=1 /proc/cmdline; then @@ -48,6 +51,9 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then echo -n "uptime: "; cat /proc/uptime fi +echo "These commands might be called by guestfsd, but they were not available at buildtime:" +echo "missing commands: $missing_commands" +echo if ! grep -sq guestfs_rescue=1 /proc/cmdline; then # Run the daemon under valgrind if ./configure --enable-valgrind-daemon vg_channel=/dev/virtio-ports/org.libguestfs.valgrind @@ -85,5 +91,7 @@ else echo fi +echo "Leaving." echo s > /proc/sysrq-trigger -echo o > /proc/sysrq-trigger +echo b > /proc/sysrq-trigger +exit 0 diff --git a/libguestfs.spec b/libguestfs.spec index a1012df..439097f 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -65,6 +65,13 @@ BuildRequires: pcre-devel BuildRequires: pkg-config BuildRequires: readline-devel BuildRequires: util-linux +BuildRequires: xfsprogs +BuildRequires: btrfsprogs +BuildRequires: zerofree +BuildRequires: ntfsprogs +BuildRequires: rsync +BuildRequires: compress +BuildRequires: cryptsetup %if %suse_version < 1210 # perl as included in openSuSE 11.4 has this, but an older version without html_charset # Without the version the requires is ignored for some reason @@ -327,11 +334,12 @@ touch %{name}.lang %find_lang %{name} # cmds="` -objcopy -j .guestfs_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout | -strings | +objcopy -j .guestfsd_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout | +tr '\0' '\n' | sort -u `" > cmds.txt +> missing_cmds.txt for cmd in ls $cmds do if test -n "` PATH=$PATH:/sbin:/usr/sbin type -p $cmd `" @@ -339,8 +347,10 @@ do echo "#%%programs: $cmd" >> cmds.txt else echo "# missing: $cmd" >> cmds.txt + echo "$cmd" >> missing_cmds.txt fi done +head -n 1234 cmds.txt missing_cmds.txt rm -rf mkinitrd cp -av /lib/mkinitrd . if patch -p0 --dry-run < %{S:42} @@ -361,6 +371,12 @@ sed -i~ ' s@^.*@@ r cmds.txt } +/@GUESTFS_MISSING_CMDS@/ { +s@^.*@missing_commands="@ +r missing_cmds.txt +a \ +" +} ' mkinitrd/scripts/boot-guestfs.sh diff -u mkinitrd/scripts/boot-guestfs.sh~ mkinitrd/scripts/boot-guestfs.sh || : /sbin/mkinitrd_setup \ @@ -375,8 +391,6 @@ arch=i686 #? 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} \ -#bash -x \ - /sbin/mkinitrd \ -l $PWD/mkinitrd \ -k vmlinuz.${arch} \ diff --git a/mkinitrd.patch b/mkinitrd.patch index d063c84..cc516ce 100644 --- a/mkinitrd.patch +++ b/mkinitrd.patch @@ -1,11 +1,27 @@ ---- mkinitrd/scripts/setup-prepare.sh.orig 2012-08-30 18:06:04.000000000 +0000 -+++ mkinitrd/scripts/setup-prepare.sh 2012-08-30 18:14:06.000000000 +0000 -@@ -29,7 +29,7 @@ +--- 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 -a --remove-destination $lnkTarget $2/ ++ 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