Hello community,

here is the log from the commit of package libguestfs for openSUSE:Factory 
checked in at 2014-01-22 23:19:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libguestfs (Old)
 and      /work/SRC/openSUSE:Factory/.libguestfs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libguestfs"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libguestfs/libguestfs.changes    2014-01-08 
20:07:51.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libguestfs.new/libguestfs.changes       
2014-01-23 15:47:36.000000000 +0100
@@ -1,0 +2,38 @@
+Wed Jan 22 10:13:00 UTC 2014 - [email protected]
+
+- add libguestfs-test subpackage, /usr/share/guestfs (fate#316275)
+  libguestfs.test.simple.run-libugestfs-test-tool.sh
+  libguestfs.test.simple.create-opensuse-guest.sh
+  libguestfs.test.simple.create-opensuse-guest-crypt-on-lvm.sh
+
+-------------------------------------------------------------------
+Mon Jan 20 23:09:24 CET 2014 - [email protected]
+
+- Update to version 1.24.5
+  * launch: Allow backend = "appliance" for backwards compatibility 
(RHBZ#1055452).
+  * daemon: Use wipefs_has_force_option to decide whether to add wipefs 
--force option.
+  * init: Display clocksource (only when debugging is enabled).
+  * launch: direct: Make sure we pass lpj= parameter when using TCG.
+  * Use recommended timer settings for KVM (RHBZ#1053847).
+  * fuse: clear stat structs (RHBZ#660687).
+  * fuse: remove extra trailing \n in debug messages
+
+-------------------------------------------------------------------
+Mon Jan 20 19:41:24 CET 2014 - [email protected]
+
+- Include crypto modules in appliance to enable luks related commands
+
+-------------------------------------------------------------------
+Mon Jan 20 11:34:25 CET 2014 - [email protected]
+
+- Resolve also library dependencies of libnss in mkinitrd (bnc#847785)
+- BuildRequire nfs-utils to get mount.nfs, for virt-rescue
+
+-------------------------------------------------------------------
+Thu Jan 16 21:29:47 CET 2014 - [email protected]
+
+- Include mkinitrd from 13.1 when building appliance for 13.2 or
+  later because dracut can not be used as replacement for mkinitrd
+  and supermin is not ready yet
+
+-------------------------------------------------------------------

Old:
----
  libguestfs-1.24.4.tar.xz

New:
----
  libguestfs-1.24.5.tar.xz
  libguestfs.mkinitrd.tar.bz2
  libguestfs.test.simple.create-opensuse-guest-crypt-on-lvm.sh
  libguestfs.test.simple.create-opensuse-guest.sh
  libguestfs.test.simple.run-libugestfs-test-tool.sh

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libguestfs.spec ++++++
--- /var/tmp/diff_new_pack.yhI0yS/_old  2014-01-23 15:47:38.000000000 +0100
+++ /var/tmp/diff_new_pack.yhI0yS/_new  2014-01-23 15:47:38.000000000 +0100
@@ -17,7 +17,7 @@
 #
 
 
-Version:        1.24.4
+Version:        1.24.5
 Release:        0
 
 %define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
@@ -69,6 +69,11 @@
 %define _configure_python --disable-python
 %define _configure_ruby --disable-ruby
 
+%if %suse_version > 1310
+%define use_included_mkinitrd 1
+%else
+%define use_included_mkinitrd 0
+%endif
 # /lib/udev is a symlink in 12.3+, package the full directory
 %if %suse_version > 1220
 %define udevrulesdir /usr/lib/udev/rules.d
@@ -148,12 +153,18 @@
 Group:          System/Filesystems
 Patch1000:      1000-force-virtio_blk-in-old-guest-kernel.patch
 Source0:        %{name}-%{version}.tar.xz
+Source42:       libguestfs.mkinitrd.tar.bz2
 Source789653:   Pod-Simple-3.23.tar.xz
 Source10:       libguestfs.mkinitrd.boot.sh
 Source11:       libguestfs.mkinitrd.setup.sh
 Source1220:     libguestfs.mkinitrd.1220.patch
 Source1210:     libguestfs.mkinitrd.1210.patch
 Source1110:     libguestfs.mkinitrd.1110.patch
+#
+Source10001:    libguestfs.test.simple.run-libugestfs-test-tool.sh
+Source10002:    libguestfs.test.simple.create-opensuse-guest.sh
+Source10003:    libguestfs.test.simple.create-opensuse-guest-crypt-on-lvm.sh
+#
 Requires:       guestfs-tools
 
 %description
@@ -321,6 +332,14 @@
 Allows Ruby scripts to directly use libguestfs.
 %endif
 
+%package test
+Summary:        Testcases for libguestfs
+License:        GPL-2.0
+Group:          System/Filesystems
+
+%description test
+This package contains testcases to verify libguestfs functionality.
+
 %package -n guestfs-data
 # kernel-default needs that
 %if %{?sles_version}0 > 0
@@ -353,8 +372,11 @@
 BuildRequires:  kernel-default
 BuildRequires:  lvm2
 BuildRequires:  mdadm
+%if !%{use_included_mkinitrd}
 BuildRequires:  mkinitrd
+%endif
 BuildRequires:  module-init-tools
+BuildRequires:  nfs-client
 BuildRequires:  ntfs-3g
 BuildRequires:  ntfsprogs
 BuildRequires:  parted
@@ -432,7 +454,7 @@
 
 %prep
 : _ignore_exclusive_arch '%{?_ignore_exclusive_arch}'
-%setup -q -a 789653
+%setup -q -a 789653 -a 42
 %patch1000 -p1
 
 %build
@@ -511,6 +533,13 @@
 %endif
 %makeinstall udevrulesdir=%{udevrulesdir}
 rm -rfv $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d
+#
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/guestfs
+cp -avLt $RPM_BUILD_ROOT%{_datadir}/guestfs \
+       %{S:10003} \
+       %{S:10002} \
+       %{S:10001}
+chmod 0755 $RPM_BUILD_ROOT%{_datadir}/guestfs/*
 #remove ocaml bindings files if they are disable via rpm macro
 %if !%{with ocaml_bindings}
 rm -rfv $RPM_BUILD_ROOT%{_libdir}/ocaml
@@ -589,8 +618,20 @@
        fi
 done
 head -n  1234 ext_cmds.txt missing_cmds.txt
+%if %{use_included_mkinitrd}
+ln -sfvbn mkinitrd-2.8.1 mkinitrd
+ln -sfvbn mkinitrd/sbin/mkinitrd_setup mkinitrd_setup.sh
+ln -sfvbn mkinitrd/sbin/mkinitrd mkinitrd.sh
+cp -avb /lib/mkinitrd/scripts/* mkinitrd/scripts
+mkdir -vp mkinitrd/setup mkinitrd/boot
+ln -sfvbn lib/mkinitrd/bin mkinitrd/bin
+sed -i~ "s@^INITRD_PATH=/lib/mkinitrd@INITRD_PATH=$PWD/mkinitrd@" 
mkinitrd/sbin/mkinitrd
+%else
 rm -rf mkinitrd
 cp -av /lib/mkinitrd .
+ln -sfvbn /sbin/mkinitrd_setup mkinitrd_setup.sh
+ln -sfvbn /sbin/mkinitrd mkinitrd.sh
+%endif
 for bad in \
        setup-storage.sh \
        boot-storage.sh \
@@ -637,7 +678,7 @@
 test -n "$patched"
 %endif
 
-/sbin/mkinitrd_setup  \
+./mkinitrd_setup.sh  \
        -s $PWD/mkinitrd/scripts \
        -i $PWD/mkinitrd
 mkdir mkinitrd/boot_tmp
@@ -663,7 +704,7 @@
 "
 env PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH} \
 bash -x \
-/sbin/mkinitrd \
+./mkinitrd.sh \
        -l $PWD/mkinitrd \
        -k vmlinuz.${arch} \
        -i initramfs.${arch}.img \
@@ -683,6 +724,10 @@
 %post -n libguestfs0 -p /sbin/ldconfig
 %postun -n libguestfs0 -p /sbin/ldconfig
 
+%files test
+%defattr(-,root,root)
+%{_datadir}/guestfs
+
 %files -n guestfs-data
 %defattr(-,root,root)
 %{_libdir}/guestfs

++++++ libguestfs-1.24.4.tar.xz -> libguestfs-1.24.5.tar.xz ++++++
++++ 98626 lines of diff (skipped)

++++++ libguestfs.mkinitrd.1110.patch ++++++
--- /var/tmp/diff_new_pack.yhI0yS/_old  2014-01-23 15:47:41.000000000 +0100
+++ /var/tmp/diff_new_pack.yhI0yS/_new  2014-01-23 15:47:41.000000000 +0100
@@ -1,7 +1,8 @@
 ---
- mkinitrd/scripts/setup-prepare.sh |   94 
+++++++++++++++++++++++++++++++-------
- mkinitrd/scripts/setup-progs.sh   |    4 -
- 2 files changed, 79 insertions(+), 19 deletions(-)
+ mkinitrd/scripts/setup-prepare.sh    |   94 
++++++++++++++++++++++++++++-------
+ mkinitrd/scripts/setup-progs.sh      |    4 -
+ mkinitrd/scripts/setup-sharedlibs.sh |   60 +++++++++++++---------
+ 3 files changed, 114 insertions(+), 44 deletions(-)
 
 Index: 1110/mkinitrd/scripts/setup-prepare.sh
 ===================================================================
@@ -192,3 +193,101 @@
  
  [ -e "bin/sh" ] || ln -s /bin/bash bin/sh
  
+Index: 1110/mkinitrd/scripts/setup-sharedlibs.sh
+===================================================================
+--- 1110.orig/mkinitrd/scripts/setup-sharedlibs.sh
++++ 1110/mkinitrd/scripts/setup-sharedlibs.sh
+@@ -54,58 +54,68 @@ shared_object_files() {
+         while [ -L "/$lib" ]; do
+             echo $lib
+             link="$(readlink "/$lib")"
+             if [ x"${link:0:1}" == x"/" ]; then
+                 lib=${link#/}
+             else
+                 lib="${lib%/*}/$link"
+             fi
+         done
+         echo $lib
+     done
+ }
+ 
+-verbose -ne "Shared libs:\t"
+-# Copy all required shared libraries and the symlinks that
+-# refer to them.
+-lib_files=$(shared_object_files "${initrd_bins[@]}")
+-[ $? -eq 0 ] || return 1
+-if [ -n "$lib_files" ]; then
+-    for lib in $lib_files; do
+-        [ -L $root_dir/$lib ] || verbose -n "$lib "
+-        ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
+-    done
+-    lib_files=
++copy_shared_libs() {
++    local bins=( "$@" )
++    local extra_lib_files lib_files lib i
++
++    # First see what nss and other libs are required. This can be 64bit or 
32bit,
++    # depending on the host and the already copied binaries.
+     case "$(uname -m)" in
+         alpha|ia64)
++            # this is a known location
+             mkdir -p $tmp_mnt/lib
+-            lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* 
$root_dir/lib/lib{gcc_s,unwind}.so*`"
++            extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* 
$root_dir/lib/lib{gcc_s,unwind}.so*`"
+             ;;
+         *)
+-            # no symlinks, most point into the running system
+-            for i in `LANG=C LC_ALL=C file -b 
$tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) 
.*/\1/p' | sort -u`
++            # Skip symlinks, they may point into the running system instead 
of $tmp_mnt
++            for i in `LANG=C LC_ALL=C file -b 
$tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) 
.*/\1/p' | sort -u`
+             do
+                 case "$i" in
+                     32-bit)
+                         mkdir -p $tmp_mnt/lib
+-                        lib_files="$lib_files `echo 
$root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
++                        extra_lib_files="$extra_lib_files `echo 
$root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
+                         ;;
+                     64-bit)
+                         mkdir -p $tmp_mnt/lib64
+-                        lib_files="$lib_files `echo 
$root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
++                        extra_lib_files="$extra_lib_files `echo 
$root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
+                         ;;
+                 esac
+             done
+             ;;
+     esac
+ 
+-    for lib in $lib_files ; do
+-        if [ -f $lib ] ; then
+-            verbose -n "${lib##$root_dir/} "
+-            cp -dp --parents $lib $tmp_mnt
++    verbose -ne "Shared libs:\t"
++
++    # Now collect a list of libraries on which the binaries and extra libs 
depend on
++    lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
++    if [ $? -eq 0 ]
++    then
++        if [ -n "$lib_files" ]
++        then
++            # Finally copy dependencies and extra libs
++            for lib in $lib_files $extra_lib_files
++            do
++                [ -L $root_dir/$lib ] || verbose -n "$lib "
++                ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
++            done
++            verbose
++        else
++            verbose "none"
+         fi
+-    done
+-    verbose
+-else
+-    verbose "none"
+-fi
++    else
++        return 1
++    fi
++}
+ 
++# Copy all required shared libraries and the symlinks that refer to them.
++copy_shared_libs "${initrd_bins[@]}"

++++++ libguestfs.mkinitrd.1210.patch ++++++
--- /var/tmp/diff_new_pack.yhI0yS/_old  2014-01-23 15:47:41.000000000 +0100
+++ /var/tmp/diff_new_pack.yhI0yS/_new  2014-01-23 15:47:41.000000000 +0100
@@ -1,7 +1,8 @@
 ---
- mkinitrd/scripts/setup-prepare.sh |   94 
+++++++++++++++++++++++++++++++-------
- mkinitrd/scripts/setup-progs.sh   |   17 +-----
- 2 files changed, 80 insertions(+), 31 deletions(-)
+ mkinitrd/scripts/setup-prepare.sh    |   94 
++++++++++++++++++++++++++++-------
+ mkinitrd/scripts/setup-progs.sh      |   17 +-----
+ mkinitrd/scripts/setup-sharedlibs.sh |   60 +++++++++++++---------
+ 3 files changed, 115 insertions(+), 56 deletions(-)
 
 Index: 1210/mkinitrd/scripts/setup-prepare.sh
 ===================================================================
@@ -212,3 +213,101 @@
  
  [ -e "bin/sh" ] || ln -s /bin/bash bin/sh
  
+Index: 1210/mkinitrd/scripts/setup-sharedlibs.sh
+===================================================================
+--- 1210.orig/mkinitrd/scripts/setup-sharedlibs.sh
++++ 1210/mkinitrd/scripts/setup-sharedlibs.sh
+@@ -54,58 +54,68 @@ shared_object_files() {
+         while [ -L "/$lib" ]; do
+             echo $lib
+             link="$(readlink "/$lib")"
+             if [ x"${link:0:1}" == x"/" ]; then
+                 lib=${link#/}
+             else
+                 lib="${lib%/*}/$link"
+             fi
+         done
+         echo $lib
+     done
+ }
+ 
+-verbose -ne "Shared libs:\t"
+-# Copy all required shared libraries and the symlinks that
+-# refer to them.
+-lib_files=$(shared_object_files "${initrd_bins[@]}")
+-[ $? -eq 0 ] || return 1
+-if [ -n "$lib_files" ]; then
+-    for lib in $lib_files; do
+-        [ -L $root_dir/$lib ] || verbose -n "$lib "
+-        ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
+-    done
+-    lib_files=
++copy_shared_libs() {
++    local bins=( "$@" )
++    local extra_lib_files lib_files lib i
++
++    # First see what nss and other libs are required. This can be 64bit or 
32bit,
++    # depending on the host and the already copied binaries.
+     case "$(uname -m)" in
+         ia64)
++            # this is a known location
+             mkdir -p $tmp_mnt/lib
+-            lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* 
$root_dir/lib/lib{gcc_s,unwind}.so*`"
++            extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* 
$root_dir/lib/lib{gcc_s,unwind}.so*`"
+             ;;
+         *)
+-            # no symlinks, most point into the running system
+-            for i in `LANG=C LC_ALL=C file -b 
$tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) 
.*/\1/p' | sort -u`
++            # Skip symlinks, they may point into the running system instead 
of $tmp_mnt
++            for i in `LANG=C LC_ALL=C file -b 
$tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) 
.*/\1/p' | sort -u`
+             do
+                 case "$i" in
+                     32-bit)
+                         mkdir -p $tmp_mnt/lib
+-                        lib_files="$lib_files `echo 
$root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
++                        extra_lib_files="$extra_lib_files `echo 
$root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
+                         ;;
+                     64-bit)
+                         mkdir -p $tmp_mnt/lib64
+-                        lib_files="$lib_files `echo 
$root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
++                        extra_lib_files="$extra_lib_files `echo 
$root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
+                         ;;
+                 esac
+             done
+             ;;
+     esac
+ 
+-    for lib in $lib_files ; do
+-        if [ -f $lib ] ; then
+-            verbose -n "${lib##$root_dir/} "
+-            cp -dp --parents $lib $tmp_mnt
++    verbose -ne "Shared libs:\t"
++
++    # Now collect a list of libraries on which the binaries and extra libs 
depend on
++    lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
++    if [ $? -eq 0 ]
++    then
++        if [ -n "$lib_files" ]
++        then
++            # Finally copy dependencies and extra libs
++            for lib in $lib_files $extra_lib_files
++            do
++                [ -L $root_dir/$lib ] || verbose -n "$lib "
++                ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
++            done
++            verbose
++        else
++            verbose "none"
+         fi
+-    done
+-    verbose
+-else
+-    verbose "none"
+-fi
++    else
++        return 1
++    fi
++}
+ 
++# Copy all required shared libraries and the symlinks that refer to them.
++copy_shared_libs "${initrd_bins[@]}"

++++++ libguestfs.mkinitrd.1220.patch ++++++
--- /var/tmp/diff_new_pack.yhI0yS/_old  2014-01-23 15:47:41.000000000 +0100
+++ /var/tmp/diff_new_pack.yhI0yS/_new  2014-01-23 15:47:41.000000000 +0100
@@ -1,7 +1,8 @@
 ---
- mkinitrd/scripts/setup-prepare.sh |  126 
++++++++++++++++++++++----------------
- mkinitrd/scripts/setup-progs.sh   |   17 -----
- 2 files changed, 79 insertions(+), 64 deletions(-)
+ mkinitrd/scripts/setup-prepare.sh    |  126 
+++++++++++++++++++++--------------
+ mkinitrd/scripts/setup-progs.sh      |   17 ----
+ mkinitrd/scripts/setup-sharedlibs.sh |   60 +++++++++-------
+ 3 files changed, 114 insertions(+), 89 deletions(-)
 
 Index: 1220/mkinitrd/scripts/setup-prepare.sh
 ===================================================================
@@ -217,3 +218,101 @@
  
  [ -e "bin/sh" ] || ln -s /bin/bash bin/sh
  
+Index: 1220/mkinitrd/scripts/setup-sharedlibs.sh
+===================================================================
+--- 1220.orig/mkinitrd/scripts/setup-sharedlibs.sh
++++ 1220/mkinitrd/scripts/setup-sharedlibs.sh
+@@ -54,58 +54,68 @@ shared_object_files() {
+         while [ -L "/$lib" ]; do
+             echo $lib
+             link="$(readlink "/$lib")"
+             if [ x"${link:0:1}" == x"/" ]; then
+                 lib=${link#/}
+             else
+                 lib="${lib%/*}/$link"
+             fi
+         done
+         echo $lib
+     done
+ }
+ 
+-verbose -ne "Shared libs:\t"
+-# Copy all required shared libraries and the symlinks that
+-# refer to them.
+-lib_files=$(shared_object_files "${initrd_bins[@]}")
+-[ $? -eq 0 ] || return 1
+-if [ -n "$lib_files" ]; then
+-    for lib in $lib_files; do
+-        [ -L $root_dir/$lib ] || verbose -n "$lib "
+-        ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
+-    done
+-    lib_files=
++copy_shared_libs() {
++    local bins=( "$@" )
++    local extra_lib_files lib_files lib i
++
++    # First see what nss and other libs are required. This can be 64bit or 
32bit,
++    # depending on the host and the already copied binaries.
+     case "$(uname -m)" in
+         ia64)
++            # this is a known location
+             mkdir -p $tmp_mnt/lib
+-            lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* 
$root_dir/lib/lib{gcc_s,unwind}.so*`"
++            extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* 
$root_dir/lib/lib{gcc_s,unwind}.so*`"
+             ;;
+         *)
+-            # no symlinks, most point into the running system
+-            for i in `LANG=C LC_ALL=C file -b 
$tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) 
.*/\1/p' | sort -u`
++            # Skip symlinks, they may point into the running system instead 
of $tmp_mnt
++            for i in `LANG=C LC_ALL=C file -b 
$tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) 
.*/\1/p' | sort -u`
+             do
+                 case "$i" in
+                     32-bit)
+                         mkdir -p $tmp_mnt/lib
+-                        lib_files="$lib_files `echo 
$root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
++                        extra_lib_files="$extra_lib_files `echo 
$root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
+                         ;;
+                     64-bit)
+                         mkdir -p $tmp_mnt/lib64
+-                        lib_files="$lib_files `echo 
$root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
++                        extra_lib_files="$extra_lib_files `echo 
$root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
+                         ;;
+                 esac
+             done
+             ;;
+     esac
+ 
+-    for lib in $lib_files ; do
+-        if [ -f $lib ] ; then
+-            verbose -n "${lib##$root_dir/} "
+-            cp -dp --parents $lib $tmp_mnt
++    verbose -ne "Shared libs:\t"
++
++    # Now collect a list of libraries on which the binaries and extra libs 
depend on
++    lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
++    if [ $? -eq 0 ]
++    then
++        if [ -n "$lib_files" ]
++        then
++            # Finally copy dependencies and extra libs
++            for lib in $lib_files $extra_lib_files
++            do
++                [ -L $root_dir/$lib ] || verbose -n "$lib "
++                ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
++            done
++            verbose
++        else
++            verbose "none"
+         fi
+-    done
+-    verbose
+-else
+-    verbose "none"
+-fi
++    else
++        return 1
++    fi
++}
+ 
++# Copy all required shared libraries and the symlinks that refer to them.
++copy_shared_libs "${initrd_bins[@]}"

++++++ libguestfs.mkinitrd.boot.sh ++++++
--- /var/tmp/diff_new_pack.yhI0yS/_old  2014-01-23 15:47:41.000000000 +0100
+++ /var/tmp/diff_new_pack.yhI0yS/_new  2014-01-23 15:47:41.000000000 +0100
@@ -83,6 +83,114 @@
 #%udevmodules: nfsv4
 #%udevmodules: ipv6
 #
+#%udevmodules: dm-crypt
+#
+#%udevmodules: ablk_helper
+#%udevmodules: aes-i586
+#%udevmodules: aes-x86_64
+#%udevmodules: aes_s390
+#%udevmodules: aesni-intel
+#%udevmodules: af_alg
+#%udevmodules: algif_hash
+#%udevmodules: algif_skcipher
+#%udevmodules: ansi_cprng
+#%udevmodules: anubis
+#%udevmodules: arc4
+#%udevmodules: asymmetric_keys
+#%udevmodules: async_memcpy
+#%udevmodules: async_pq
+#%udevmodules: async_raid6_recov
+#%udevmodules: async_tx
+#%udevmodules: async_xor
+#%udevmodules: authenc
+#%udevmodules: authencesn
+#%udevmodules: blowfish-x86_64
+#%udevmodules: blowfish_common
+#%udevmodules: blowfish_generic
+#%udevmodules: camellia-aesni-avx-x86_64
+#%udevmodules: camellia-x86_64
+#%udevmodules: camellia_generic
+#%udevmodules: cast5-avx-x86_64
+#%udevmodules: cast5_generic
+#%udevmodules: cast6-avx-x86_64
+#%udevmodules: cast6_generic
+#%udevmodules: cast_common
+#%udevmodules: cbc
+#%udevmodules: ccm
+#%udevmodules: cmac
+#%udevmodules: crc32
+#%udevmodules: crc32-pclmul
+#%udevmodules: crc32c-intel
+#%udevmodules: cryptd
+#%udevmodules: crypto_null
+#%udevmodules: crypto_user
+#%udevmodules: ctr
+#%udevmodules: cts
+#%udevmodules: deflate
+#%udevmodules: des_generic
+#%udevmodules: des_s390
+#%udevmodules: ecb
+#%udevmodules: fcrypt
+#%udevmodules: gcm
+#%udevmodules: geode-aes
+#%udevmodules: gf128mul
+#%udevmodules: ghash-clmulni-intel
+#%udevmodules: ghash-generic
+#%udevmodules: glue_helper
+#%udevmodules: hifn_795x
+#%udevmodules: khazad
+#%udevmodules: lrw
+#%udevmodules: lz4
+#%udevmodules: lz4hc
+#%udevmodules: md4
+#%udevmodules: md5
+#%udevmodules: michael_mic
+#%udevmodules: padlock-aes
+#%udevmodules: padlock-sha
+#%udevmodules: pcbc
+#%udevmodules: pcrypt
+#%udevmodules: prng
+#%udevmodules: public_key
+#%udevmodules: raid6test
+#%udevmodules: rmd128
+#%udevmodules: rmd160
+#%udevmodules: rmd256
+#%udevmodules: rmd320
+#%udevmodules: rsa
+#%udevmodules: salsa20-i586
+#%udevmodules: salsa20-x86_64
+#%udevmodules: salsa20_generic
+#%udevmodules: seed
+#%udevmodules: seqiv
+#%udevmodules: serpent-avx-x86_64
+#%udevmodules: serpent-sse2-i586
+#%udevmodules: serpent-sse2-x86_64
+#%udevmodules: serpent_generic
+#%udevmodules: sha1-ssse3
+#%udevmodules: sha1_generic
+#%udevmodules: sha1_s390
+#%udevmodules: sha256-ssse3
+#%udevmodules: sha256_generic
+#%udevmodules: sha256_s390
+#%udevmodules: sha512-ssse3
+#%udevmodules: sha512_generic
+#%udevmodules: sha512_s390
+#%udevmodules: sha_common
+#%udevmodules: tea
+#%udevmodules: tgr192
+#%udevmodules: twofish-avx-x86_64
+#%udevmodules: twofish-i586
+#%udevmodules: twofish-x86_64
+#%udevmodules: twofish-x86_64-3way
+#%udevmodules: twofish_common
+#%udevmodules: vmac
+#%udevmodules: wp512
+#%udevmodules: x509_key_parser
+#%udevmodules: xcbc
+#%udevmodules: xor
+#%udevmodules: xts
+#%udevmodules: zlib
+#
 #%programs: mdadm
 #%programs: modprobe
 #%programs: lvm
@@ -113,6 +221,12 @@
 # run_all.sh will load them after this script is sourced
 load_modules
 
+# load various modules for cryptsetup
+for i in 512 384 256 224 1
+do
+       modprobe -v sha$i
+done
+
 ln -sfbn ../proc/self/mounts /etc/mtab
 
 # from libguestfs-1.19.34/appliance/init:
@@ -162,6 +276,8 @@
     ip a
     ip r
     date
+    echo -n "clocksource: "
+    cat /sys/devices/system/clocksource/clocksource0/current_clocksource
     echo "These commands might be called by guestfsd, but they were not 
available at buildtime:"
     echo "missing commands: $missing_commands"
     echo

++++++ libguestfs.mkinitrd.setup.sh ++++++
--- /var/tmp/diff_new_pack.yhI0yS/_old  2014-01-23 15:47:41.000000000 +0100
+++ /var/tmp/diff_new_pack.yhI0yS/_new  2014-01-23 15:47:41.000000000 +0100
@@ -5,6 +5,11 @@
 # copy daemon manually because it is located in RPM_BUILD_ROOT
 mkdir -vp $tmp_mnt/usr/sbin
 cp_bin $(type -p guestfsd) $tmp_mnt/usr/sbin
+# required for mount.nfs inside the appliance
+for i in /etc/netconfig /etc/protocols /etc/rpc /etc/services
+do
+       cp $i $tmp_mnt$i
+done
 
 # many guestfish commands need a mount point
 # in guestfsd the mount point defaults to /sysroot

++++++ libguestfs.test.simple.create-opensuse-guest-crypt-on-lvm.sh ++++++
#!/bin/bash
# Create an openSUSE image with lvm on dm-crypt partition
# 
# Theory of operation:
#  This script uses zypper from the host to resolve dependencies 
#  for zypper which runs within the appliance. If zypper on the host
#  is too old, it will be unable to handle repo data from 13.1:
#    http://lists.opensuse.org/zypp-devel/2013-11/msg00000.html
#    "[zypp-devel] Package conflicting with itself"
#  For this reason zypper from 12.3 can be used to install the pattern
#  of the final repo.
#  First the dependencies of zypper are resolved, the required packages
#  are downloaded and extracted with unrpm. Now the guest is started and
#  the partitions in the diskimage are prepared. Then the extracted
#  package content is copied into the guest. Once that is done zypper
#  inside the guest will install the base pattern and a few extra packages.
#  Finally the bootloader grub is configured. Once all that is done
#  kvm is started. If all goes well a login prompt appears.
#  The password for the crypted partition is "123456".
#  The password for root is "root".
#  The guest has also network access to the outside.
#
# Expected runtime: ca. 200 seconds
# Requires at least 1.24.5 because this includes the required crypt modules
#
# Expected output:
# guest should start
# no "obvious" errors should be shown during the disk operation
# at the end kvm is started with the generated disk image
# login should be possible
#
set -e
unset LANG
unset ${!LC_*}
cpus=`grep -Ec 'cpu[0-9]' /proc/stat || echo 1`

output_diskimage=/dev/shm/$LOGNAME/testcase.img
final_repo=http://download.opensuse.org/distribution/13.1/repo/oss/
initial_repo=http://download.opensuse.org/distribution/12.3/repo/oss/
force=false
guest_zypper_in__pattern_name="base"
guest_zypper_in__package_list="
grub
less
master-boot-code
nfs-utils
parted
vim
"
guest_root_password="root"
guest_crypt_password="123456"
diskname_inside_vm=/dev/sda

case "$0" in
        /*) progname="$0" ;;
        *) progname="$PWD/$0" ;;
esac

_exit() {
        echo "Exiting '$0 $*'."
        exit 1
}

_unrpm() {
        CPIO_OPTS="--extract --unconditional --preserve-modification-time 
--make-directories"
        FILES="$@"
        for f in $FILES; do
                echo -ne "$f:\t"
                rpm2cpio $f | cpio ${CPIO_OPTS}
        done
}

until test $# -lt 1
do
        case "$1" in
                --unrpm) shift ; _unrpm "$@" ; exit 0 ;;
                -n) diskname_inside_vm="$2" ; shift ;;
                -o) output_diskimage="$2" ; shift ;;
                -R) initial_repo="$2" ; shift ;;
                -r) final_repo="$2" ; shift ;;
                -f) force=true ;;
                -x) set -x ;;
                *) echo "Unknown option '$1'" ; exit 1 ;;
        esac
        shift
done
if test -z "${initial_repo}"
then
        echo "URL to initial repo required. Wrong -R option."
        _exit
fi
if test -z "${final_repo}"
then
        echo "URL to final repo required. Wrong -r option."
        _exit
fi
if test -z "${output_diskimage}"
then
        echo "Filename for temporary disk image required. Wrong -o option."
        _exit
fi
if test -e "${output_diskimage}"
then
        if test "${force}" = "false"
        then
                echo "Output diskimage '${output_diskimage}' exists."
                echo "It will not be overwritten. Option '-f' exists to force 
overwrite."
                _exit
        fi
fi
zypper --version
cpio --version
guestfish --version
kvm="qemu-system-`uname -m`"
if $kvm --version
then
        : good
else
        kvm="qemu-kvm"
        if $kvm --version
        then
                :
        else
                echo "No qemu-kvm found."
                _exit
        fi
fi
guestfish_version="`guestfish --version | awk '{print \$2}'`"
case "${guestfish_version}" in
        1.20*) _exit ;;
        1.21*) _exit ;;
        1.22*) _exit ;;
        1.23*) _exit ;;
        1.24.[0-4]) _exit ;;
        *) ;;
esac

mkdir -vp "${output_diskimage%/*}"
td=`mktemp -d --tmpdir=/dev/shm/${LOGNAME}`
tf=`mktemp    --tmpdir=/dev/shm/${LOGNAME}`
_exit() {
rm -rf "$tf"
rm -rf "$td"
}
trap _exit EXIT
dir_repo=${td}/repos.d
dir_root=${td}/root
dir_cache=${td}/cache
mkdir -vp \
        ${dir_root} \
        ${dir_cache} \
        ${dir_repo}
cat > ${tf} <<EOF
[main]
reposdir = ${dir_repo}
EOF
cat > ${dir_repo}/tmp.repo <<EOF
[tmp]
name=tmp
enabled=1
autorefresh=1
keeppackages=0
baseurl=${initial_repo}
EOF
packages="
curl
zypper
"
head ${dir_repo}/tmp.repo ${tf}
zypper \
        --verbose \
        --verbose \
        --config ${tf} \
        --root ${dir_root} \
        --reposd-dir ${dir_repo} \
        --cache-dir ${dir_cache} \
        --gpg-auto-import-keys \
        --no-gpg-checks \
        --non-interactive \
        lr -d
zypper \
        --verbose \
        --verbose \
        --config ${tf} \
        --root ${dir_root} \
        --reposd-dir ${dir_repo} \
        --cache-dir ${dir_cache} \
        --gpg-auto-import-keys \
        --no-gpg-checks \
        --non-interactive \
        install \
        --auto-agree-with-licenses \
        --no-recommends \
        --dry-run \
        --download-only \
        ${packages}
cd ${dir_root}
find ${dir_cache} -xdev -name "*.rpm" -print0 | sort -z | xargs -0 -n 1 -P 
${cpus} bash "${progname}" --unrpm
mkdir -vp etc/zypp/repos.d
grep -w search /etc/resolv.conf >> etc/resolv.conf
echo nameserver 169.254.2.3 >> etc/resolv.conf
grep -w root /etc/passwd > etc/passwd
grep -w root /etc/group  > etc/group
echo 'root::15209::::::' > etc/shadow
cat > etc/fstab <<EOF
LABEL=SWAP swap swap  defaults 0 0
LABEL=ROOT /    ext4  noatime  1 2
EOF
mkdir -p boot/grub
cat > etc/grub.conf <<EOF
setup --stage2=/boot/grub/stage2 --force-lba (hd0,1) (hd0,1)
quit
EOF
echo "(hd0) ${diskname_inside_vm}" > boot/grub/device.map
cat > boot/grub/menu.lst <<EOF
serial --unit=0 --speed=115200
terminal --timeout=10 console serial
title ${0} $*
        kernel /boot/vmlinuz panic=9 quiet video=800x600
        initrd /boot/initrd
EOF
du -sm .
find ${dir_cache} -xdev -name "*.rpm" -delete
(
echo "${guest_crypt_password}"
echo "${guest_crypt_password}"
) | \
guestfish \
        -x \
        --keys-from-stdin \
        \
sparse ${output_diskimage} 2048M : \
set-smp 2 : \
set-memsize 1024 : \
set-network true : \
run : \
list-devices : \
part-init          ${diskname_inside_vm} mbr : \
part-add           ${diskname_inside_vm} primary 1                             
$(( ((1024*1024)* 256)/512 - 1)) : \
part-add           ${diskname_inside_vm} primary $(( ((1024*1024)* 256)/512 )) 
$(( ((1024*1024)*1024)/512 - 1)) : \
part-add           ${diskname_inside_vm} primary $(( ((1024*1024)*1024)/512 )) 
$(( ((1024*1024)*1555)/512 - 1)) : \
part-add           ${diskname_inside_vm} primary $(( ((1024*1024)*1555)/512 )) 
$(( ((1024*1024)*2024)/512 - 1)) : \
part-list          ${diskname_inside_vm} : \
mkswap-opts        ${diskname_inside_vm}1 label:SWAP : \
mke2fs             ${diskname_inside_vm}2 label:ROOT fstype:ext4 blocksize:1024 
: \
pvcreate           ${diskname_inside_vm}3 : \
vgcreate uncrypted ${diskname_inside_vm}3 : \
luks-format        ${diskname_inside_vm}4 0 : \
luks-open          ${diskname_inside_vm}4 crypt_part4 : \
pvcreate           /dev/mapper/crypt_part4 : \
vgcreate   crypted /dev/mapper/crypt_part4 : \
lvcreate-free root uncrypted 50 : \
lvcreate-free work uncrypted 50 : \
lvcreate-free home   crypted 50 : \
lvcreate-free mail   crypted 50 : \
list-devices : \
list-partitions : \
pvs-full : \
vgs-full : \
lvs-full : \
mke2fs /dev/uncrypted/root label:LV_ROOT fstype:ext4 blocksize:1024 : \
mke2fs /dev/uncrypted/work label:LV_WORK fstype:ext4 blocksize:1024 : \
mke2fs /dev/crypted/home   label:LV_HOME fstype:ext4 blocksize:1024 : \
mke2fs /dev/crypted/mail   label:LV_MAIL fstype:ext4 blocksize:1024 : \
part-set-bootable ${diskname_inside_vm} 2 true : \
list-filesystems : \
swapon-label SWAP : \
mount-options discard ${diskname_inside_vm}2 / : \
set-verbose false : \
copy-in `echo *` / : \
set-verbose true : \
command /sbin/ldconfig : \
cat /etc/resolv.conf : \
command "ip a" : \
command "curl google.com" : \
command "zypper help" : \
command "zypper -v -v ar -c -K -f ${final_repo} tmp" : \
sh "(set -x -e ; z_in='zypper -v -v --gpg-auto-import-keys --no-gpg-checks 
--non-interactive in --auto-agree-with-licenses --no-recommends' ; \$z_in -t 
pattern ${guest_zypper_in__pattern_name} ; chkstat --set /etc/permissions 
/etc/permissions.easy ; echo root:${guest_root_password} | chpasswd ; \$z_in 
`eval echo ${guest_zypper_in__package_list}` ) 2>&1 " : \
sh "depmod -a \$(get_kernel_version /boot/vmlinuz) ; mkinitrd -B" : \
sh "dd if=/usr/lib/boot/MBR of=${diskname_inside_vm}" : \
sh "cp --verbose --sparse=never --remove-destination 
--target-directory=/boot/grub /usr/lib/grub/*" : \
sh "grub --batch --verbose < /etc/grub.conf" : \
sh "echo crypt_part4 ${diskname_inside_vm}4 none luks,timeout=0 >> 
/etc/crypttab" : \
mkdir /LV_ROOT : \
sh "echo LABEL=LV_ROOT /LV_ROOT ext4 noatime 1 2 >> /etc/fstab" : \
mkdir /LV_WORK : \
sh "echo LABEL=LV_WORK /LV_WORK ext4 noatime 1 2 >> /etc/fstab" : \
mkdir /LV_HOME : \
sh "echo LABEL=LV_HOME /LV_HOME ext4 noatime 1 2 >> /etc/fstab" : \
mkdir /LV_MAIL : \
sh "echo LABEL=LV_MAIL /LV_MAIL ext4 noatime 1 2 >> /etc/fstab" : \
sh "echo BOOTPROTO='dhcp' >> /etc/sysconfig/network/ifcfg-eth0"  : \
sh "echo STARTMODE='auto' >> /etc/sysconfig/network/ifcfg-eth0" : \
sh "echo 'Password for User root is: ${guest_root_password}' >> /etc/issue" : \
cat /etc/fstab : \
quit
ls -lhsS "${output_diskimage}"

: ${diskname_inside_vm}
case "${diskname_inside_vm}" in
        *vda*)
        qemu_drive_options="
        -drive file=${output_diskimage},cache=writeback,id=hd0,if=none \
        -device virtio-blk-pci,drive=hd0 \
        "
        ;;
        *sda*)
        qemu_drive_options="
        -device virtio-scsi-pci,id=scsi \
        -drive file=${output_diskimage},cache=unsafe,format=raw,id=hd0,if=none \
        -device scsi-hd,drive=hd0 \
        "
        ;;
        *)
        echo "${diskname_inside_vm} not handled"
        _exit
esac
$kvm -enable-kvm \
        -global virtio-blk-pci.scsi=off \
        -enable-fips \
        -machine accel=kvm:tcg \
        -cpu host,+kvmclock \
        -m 500 \
        -no-reboot \
        -no-hpet \
        ${qemu_drive_options} \
        -device virtio-serial-pci \
        -serial stdio \
        -device sga \
        -netdev user,id=usernet,net=169.254.0.0/16 \
        -device virtio-net-pci,netdev=usernet

exit 0
++++++ libguestfs.test.simple.create-opensuse-guest.sh ++++++
#!/bin/bash
# Create an openSUSE image with just enough packages to allow boot to login 
prompt
#
# Theory of operation:
#  This script uses zypper from the host to resolve dependencies 
#  for zypper which runs within the appliance. If zypper on the host
#  is too old, it will be unable to handle repo data from 13.1:
#    http://lists.opensuse.org/zypp-devel/2013-11/msg00000.html
#    "[zypp-devel] Package conflicting with itself"
#  For this reason zypper from 12.3 can be used to install the pattern
#  of the final repo.
#  First the dependencies of zypper are resolved, the required packages
#  are downloaded and extracted with unrpm. Now the guest is started and
#  the partitions in the diskimage are prepared. Then the extracted
#  package content is copied into the guest. Once that is done zypper
#  inside the guest will install the base pattern and a few extra packages.
#  Finally the bootloader grub is configured. Once all that is done
#  kvm is started. If all goes well a login prompt appears.
#  The password for root is "root".
#  The guest has also network access to the outside.
#
# Expected runtime: ca. 180 seconds
#
# Expected output:
# guest should start
# no "obvious" errors should be shown during the disk operation
# at the end kvm is started with the generated disk image
# login should be possible
#
set -e
unset LANG
unset ${!LC_*}
cpus=`grep -Ec 'cpu[0-9]' /proc/stat || echo 1`

output_diskimage=/dev/shm/$LOGNAME/testcase.img
final_repo=http://download.opensuse.org/distribution/13.1/repo/oss/
initial_repo=http://download.opensuse.org/distribution/12.3/repo/oss/
force=false
guest_zypper_in__pattern_name="base"
guest_zypper_in__package_list="
grub
less
master-boot-code
nfs-utils
parted
vim
"
guest_root_password="root"
diskname_inside_vm=/dev/sda

case "$0" in
        /*) progname="$0" ;;
        *) progname="$PWD/$0" ;;
esac

_exit() {
        echo "Exiting '$0 $*'."
        exit 1
}

_unrpm() {
        CPIO_OPTS="--extract --unconditional --preserve-modification-time 
--make-directories"
        FILES="$@"
        for f in $FILES; do
                echo -ne "$f:\t"
                rpm2cpio $f | cpio ${CPIO_OPTS}
        done
}

until test $# -lt 1
do
        case "$1" in
                --unrpm) shift ; _unrpm "$@" ; exit 0 ;;
                -n) diskname_inside_vm="$2" ; shift ;;
                -o) output_diskimage="$2" ; shift ;;
                -R) initial_repo="$2" ; shift ;;
                -r) final_repo="$2" ; shift ;;
                -f) force=true ;;
                -x) set -x ;;
                *) echo "Unknown option '$1'" ; exit 1 ;;
        esac
        shift
done
if test -z "${initial_repo}"
then
        echo "URL to initial repo required. Wrong -R option."
        _exit
fi
if test -z "${final_repo}"
then
        echo "URL to final repo required. Wrong -r option."
        _exit
fi
if test -z "${output_diskimage}"
then
        echo "Filename for temporary disk image required. Wrong -o option."
        _exit
fi
if test -e "${output_diskimage}"
then
        if test "${force}" = "false"
        then
                echo "Output diskimage '${output_diskimage}' exists."
                echo "It will not be overwritten. Option '-f' exists to force 
overwrite."
                _exit
        fi
fi
zypper --version
cpio --version
guestfish --version
kvm="qemu-system-`uname -m`"
if $kvm --version
then
        : good
else
        kvm="qemu-kvm"
        if $kvm --version
        then
                :
        else
                echo "No qemu-kvm found."
                _exit
        fi
fi

mkdir -vp "${output_diskimage%/*}"
td=`mktemp -d --tmpdir=/dev/shm/${LOGNAME}`
tf=`mktemp    --tmpdir=/dev/shm/${LOGNAME}`
_exit() {
rm -rf "$tf"
rm -rf "$td"
}
trap _exit EXIT
dir_repo=${td}/repos.d
dir_root=${td}/root
dir_cache=${td}/cache
mkdir -vp \
        ${dir_root} \
        ${dir_cache} \
        ${dir_repo}
cat > ${tf} <<EOF
[main]
reposdir = ${dir_repo}
EOF
cat > ${dir_repo}/tmp.repo <<EOF
[tmp]
name=tmp
enabled=1
autorefresh=1
keeppackages=0
baseurl=${initial_repo}
EOF
packages="
curl
zypper
"
head ${dir_repo}/tmp.repo ${tf}
zypper \
        --verbose \
        --verbose \
        --config ${tf} \
        --root ${dir_root} \
        --reposd-dir ${dir_repo} \
        --cache-dir ${dir_cache} \
        --gpg-auto-import-keys \
        --no-gpg-checks \
        --non-interactive \
        lr -d
zypper \
        --verbose \
        --verbose \
        --config ${tf} \
        --root ${dir_root} \
        --reposd-dir ${dir_repo} \
        --cache-dir ${dir_cache} \
        --gpg-auto-import-keys \
        --no-gpg-checks \
        --non-interactive \
        install \
        --auto-agree-with-licenses \
        --no-recommends \
        --dry-run \
        --download-only \
        ${packages}
cd ${dir_root}
find ${dir_cache} -xdev -name "*.rpm" -print0 | sort -z | xargs -0 -n 1 -P 
${cpus} bash "${progname}" --unrpm
mkdir -vp etc/zypp/repos.d
grep -w search /etc/resolv.conf >> etc/resolv.conf
echo nameserver 169.254.2.3 >> etc/resolv.conf
grep -w root /etc/passwd > etc/passwd
grep -w root /etc/group  > etc/group
echo 'root::15209::::::' > etc/shadow
cat > etc/fstab <<EOF
LABEL=SWAP swap swap  defaults 0 0
LABEL=ROOT /    ext4  noatime  1 2
EOF
mkdir -p boot/grub
cat > etc/grub.conf <<EOF
setup --stage2=/boot/grub/stage2 --force-lba (hd0,1) (hd0,1)
quit
EOF
echo "(hd0) ${diskname_inside_vm}" > boot/grub/device.map
cat > boot/grub/menu.lst <<EOF
serial --unit=0 --speed=115200
terminal --timeout=10 console serial
title ${0} $*
        kernel /boot/vmlinuz panic=9 quiet video=800x600
        initrd /boot/initrd
EOF
du -sm .
find ${dir_cache} -xdev -name "*.rpm" -delete
guestfish \
        -x \
        \
sparse ${output_diskimage} 1024M : \
set-smp 2 : \
set-memsize 1024 : \
set-network true : \
run : \
list-devices : \
part-init          ${diskname_inside_vm} mbr : \
part-add           ${diskname_inside_vm} primary 1                             
$(( ((1024*1024)* 256)/512 - 1)) : \
part-add           ${diskname_inside_vm} primary $(( ((1024*1024)* 256)/512 )) 
$(( ((1024*1024)*1024)/512 - 1)) : \
part-list          ${diskname_inside_vm} : \
mkswap-opts        ${diskname_inside_vm}1 label:SWAP : \
mke2fs             ${diskname_inside_vm}2 label:ROOT fstype:ext4 blocksize:1024 
: \
list-devices : \
list-partitions : \
part-set-bootable ${diskname_inside_vm} 2 true : \
list-filesystems : \
swapon-label SWAP : \
mount-options discard ${diskname_inside_vm}2 / : \
set-verbose false : \
copy-in `echo *` / : \
set-verbose true : \
command /sbin/ldconfig : \
cat /etc/resolv.conf : \
command "ip a" : \
command "curl google.com" : \
command "zypper help" : \
command "zypper -v -v ar -c -K -f ${final_repo} tmp" : \
sh "(set -x -e ; z_in='zypper -v -v --gpg-auto-import-keys --no-gpg-checks 
--non-interactive in --auto-agree-with-licenses --no-recommends' ; \$z_in -t 
pattern ${guest_zypper_in__pattern_name} ; chkstat --set /etc/permissions 
/etc/permissions.easy ; echo root:${guest_root_password} | chpasswd ; \$z_in 
`eval echo ${guest_zypper_in__package_list}` ) 2>&1 " : \
sh "depmod -a \$(get_kernel_version /boot/vmlinuz) ; mkinitrd -B" : \
sh "dd if=/usr/lib/boot/MBR of=${diskname_inside_vm}" : \
sh "cp --verbose --sparse=never --remove-destination 
--target-directory=/boot/grub /usr/lib/grub/*" : \
sh "grub --batch --verbose < /etc/grub.conf" : \
sh "echo BOOTPROTO='dhcp' >> /etc/sysconfig/network/ifcfg-eth0"  : \
sh "echo STARTMODE='auto' >> /etc/sysconfig/network/ifcfg-eth0" : \
sh "echo 'Password for User root is: ${guest_root_password}' >> /etc/issue" : \
cat /etc/fstab : \
quit
ls -lhsS "${output_diskimage}"

: ${diskname_inside_vm}
case "${diskname_inside_vm}" in
        *vda*)
        qemu_drive_options="
        -drive file=${output_diskimage},cache=writeback,id=hd0,if=none \
        -device virtio-blk-pci,drive=hd0 \
        "
        ;;
        *sda*)
        qemu_drive_options="
        -device virtio-scsi-pci,id=scsi \
        -drive file=${output_diskimage},cache=unsafe,format=raw,id=hd0,if=none \
        -device scsi-hd,drive=hd0 \
        "
        ;;
        *)
        echo "${diskname_inside_vm} not handled"
        _exit
esac
$kvm -enable-kvm \
        -global virtio-blk-pci.scsi=off \
        -enable-fips \
        -machine accel=kvm:tcg \
        -cpu host,+kvmclock \
        -m 500 \
        -no-reboot \
        -no-hpet \
        ${qemu_drive_options} \
        -device virtio-serial-pci \
        -serial stdio \
        -device sga \
        -netdev user,id=usernet,net=169.254.0.0/16 \
        -device virtio-net-pci,netdev=usernet

exit 0
++++++ libguestfs.test.simple.run-libugestfs-test-tool.sh ++++++
#!/bin/bash
# libguestfs-test-tool starts its temporary guest using a dummy disk image
# It creates a partition, a filesystem, mounts it and touches a file
# Once it is done the dummy image is removed again
# Per default it runs in --verbose mode, and our version trace the API calls
#
# Expected runtime: ca. 10 seconds
#
# Expected output:
# guest should start
# no "obvious" errors should be shown during the disk operation
# Somewhere at the end of the verbose output lines like this are expected:
# ...
# libguestfs: trace: touch "/hello"
# ...
# libguestfs: trace: touch = 0
#
#
set -x
set -e
unset LANG
unset ${!LC_*}
cpus=`grep -Ec 'cpu[0-9]' /proc/stat || echo 1`

libguestfs-test-tool -V
time libguestfs-test-tool
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to