[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[fedora-virt] Re: [PATCH] allow to build Debian based appliance



On Thu, Jul 02, 2009 at 01:15:59PM +0200, Guido Günther wrote:
> Hi,
> the attached 4 patches allow to build the appliance based on Debian
> based distros:
> 
> 0001-add-missing-module.patch:
> 	one more missing module from the kmod whitelist
> 0002-unconditionally-load-dm-module.patch:
>         I do need to load this one to get LVM/device mapper stuff working
> 0003-add-debirf-files.patch
> 	uses debirf to build the initramfs
> 0004-Build-Debian-based-appliance-using-debirf.patch
> 	update {make,update}.sh (best reviewed with diff -w)
> 
> If built with:
> 
> ./configure --with-repo=sid --with-mirror=http://ftp.debian.org/debian
> 
> The testsuite looks mostly good.
> 
> ***** 5 / 174 tests FAILED *****
> 
> Failures are due to missing srub in Debian as well as a 2 hexdump
> failures I'll have to look at.
> 
> Cheers,
>  -- Guido

> >From 65aca909131ec53da4032a727e1fd346b6bb7401 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
> Date: Tue, 30 Jun 2009 14:44:09 +0200
> Subject: [PATCH 1/4] add missing module
> 
> for modularized Debian kernels
> ---
>  appliance/kmod.whitelist.in |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/appliance/kmod.whitelist.in b/appliance/kmod.whitelist.in
> index 54d2f42..590285d 100644
> --- a/appliance/kmod.whitelist.in
> +++ b/appliance/kmod.whitelist.in
> @@ -26,6 +26,7 @@ ext4*.ko
>  crc16.ko
>  jbd.ko
>  jbd2.ko
> +mbcache.ko
>  
>  fuse.ko
>  
> -- 
> 1.6.3.3
> 

ACK.

> >From 5f5c75e91508f25dee8da7b5909c446b43ce3167 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
> Date: Thu, 2 Jul 2009 10:46:37 +0200
> Subject: [PATCH 2/4] unconditionally load dm module
> 
> needed for device mapper (LVM)
> ---
>  appliance/init |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/appliance/init b/appliance/init
> index b573c46..48c7c34 100755
> --- a/appliance/init
> +++ b/appliance/init
> @@ -31,9 +31,9 @@ else
>  
>    modprobe virtio_pci
>    modprobe virtio_net
> -  modprobe dm_mod ||:
>  fi
>  
> +modprobe dm_mod ||:
>  mount
>  ls -l /dev
>  
> -- 
> 1.6.3.3
> 

ACK.

> >From 6a0300f68d57a55e998db6a47874e50c2ac5f3f0 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
> Date: Tue, 16 Jun 2009 23:47:36 +0200
> Subject: [PATCH 3/4] add debirf files
> 
> ---
>  appliance/debian/debirf.conf.in              |    5 ++
>  appliance/debian/modules/a0_motd             |    1 +
>  appliance/debian/modules/a0_prep-root        |    1 +
>  appliance/debian/modules/install_kernel      |   68 ++++++++++++++++++++++++++
>  appliance/debian/modules/network             |    1 +
>  appliance/debian/modules/root-bashrc         |    1 +
>  appliance/debian/modules/serial-terminal     |    1 +
>  appliance/debian/modules/y0_install-guestfsd |   33 ++++++++++++
>  appliance/debian/modules/z0_remove-aptitude  |    1 +
>  appliance/debian/modules/z0_remove-locales   |    1 +
>  appliance/debian/modules/z1_clean-root       |    1 +
>  appliance/debian/modules/z99_final-cleanups  |    3 +
>  configure.ac                                 |    1 +
>  13 files changed, 118 insertions(+), 0 deletions(-)
>  create mode 100644 appliance/debian/debirf.conf.in
>  create mode 120000 appliance/debian/modules/a0_motd
>  create mode 120000 appliance/debian/modules/a0_prep-root
>  create mode 100755 appliance/debian/modules/install_kernel
>  create mode 120000 appliance/debian/modules/network
>  create mode 120000 appliance/debian/modules/root-bashrc
>  create mode 120000 appliance/debian/modules/serial-terminal
>  create mode 100755 appliance/debian/modules/y0_install-guestfsd
>  create mode 120000 appliance/debian/modules/z0_remove-aptitude
>  create mode 120000 appliance/debian/modules/z0_remove-locales
>  create mode 120000 appliance/debian/modules/z1_clean-root
>  create mode 100755 appliance/debian/modules/z99_final-cleanups
> 
> diff --git a/appliance/debian/debirf.conf.in b/appliance/debian/debirf.conf.in
> new file mode 100644
> index 0000000..a3dc16f
> --- /dev/null
> +++ b/appliance/debian/debirf.conf.in
> @@ -0,0 +1,5 @@
> +DEBIRF_LABEL="debirf-libguestfs"
> +DEBIRF_SUITE= REPO@
> +DEBIRF_MIRROR= MIRROR@/${DEBIRF_DISTRO}
> +DEBIRF_KERNEL_ARCH=486
> +
> diff --git a/appliance/debian/modules/a0_motd b/appliance/debian/modules/a0_motd
> new file mode 120000
> index 0000000..8e3ad2f
> --- /dev/null
> +++ b/appliance/debian/modules/a0_motd
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/a0_motd
> \ No newline at end of file
> diff --git a/appliance/debian/modules/a0_prep-root b/appliance/debian/modules/a0_prep-root
> new file mode 120000
> index 0000000..654bc70
> --- /dev/null
> +++ b/appliance/debian/modules/a0_prep-root
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/a0_prep-root
> \ No newline at end of file
> diff --git a/appliance/debian/modules/install_kernel b/appliance/debian/modules/install_kernel
> new file mode 100755
> index 0000000..c1076ce
> --- /dev/null
> +++ b/appliance/debian/modules/install_kernel
> @@ -0,0 +1,68 @@
> +#!/bin/bash -e
> +
> +# debirf module: install-kernel
> +# install a kernel package, indicated by the expected environment
> +# variables:
> +#  DEBIRF_PATH
> +#  DEBIRF_ROOT
> +#  DEBIRF_KERNEL_PACKAGE
> +#
> +# *** REQUIRED MODULE ***
> +# WARNING: this module is necessary for proper functioning of debirf.
> +#
> +# The debirf scripts were written by
> +# Jameson Rollins <jrollins fifthhorseman net>
> +# and
> +# Daniel Kahn Gillmor <dkg-debian org fifthhorseman net>.
> +#
> +# They are Copyright 2007, and are all released under the GPL,
> +# version 3 or later.
> +
> +# clear out old modules if they exist, to avoid confusion
> +rm -rf "$DEBIRF_ROOT/lib/modules"
> +
> +# download/copy in kernel package
> +if [ -z "$DEBIRF_KERNEL_PACKAGE" ] ; then
> +    # determine kernel to install. assume arch of build host.
> +
> +    # determine kernel arch.  need everything after the kernel version
> +    # and debian version
> +    if [ -z "$DEBIRF_KERNEL_ARCH" ]; then
> +	KARCH=$(uname -r | cut -d- -f3-)
> +    else
> +	KARCH="$DEBIRF_KERNEL_ARCH"
> +    fi
> +
> +    # determine the full kernel version from the dependency of the
> +    # generic 2.6-ARCH package in the debirf root (since it may be
> +    # different than what is installed on the build host)
> +    KNAME=$(debirf_exec apt-cache show linux-image-2.6-"$KARCH" | grep '^Depends: ' | sed 's/^Depends: //')
> +
> +    # download only the desired kernel package directly into the apt
> +    # cache for dpkg extraction
> +    debirf_exec sh -c "cd /var/cache/apt/archives/ && aptitude download \"$KNAME\""
> +else
> +    # install kernel deb if given at command line
> +    debirf_exec sh -c "cd /var/cache/apt/archives/ && aptitude download \"$DEBIRF_KERNEL_PACKAGE\""
> +fi
> +
> +KPKG=$(basename "$DEBIRF_ROOT"/var/cache/apt/archives/linux-image-2.6.*)
> +
> +echo "extracting kernel package $KPKG..."
> +debirf_exec dpkg --extract /var/cache/apt/archives/"$KPKG" /
> +
> +# install the module init tools, since they are needed for depmod
> +debirf_exec apt-get --assume-yes install module-init-tools
> +
> +# depmod to create module list
> +KVERS=$(ls -1 -t "$DEBIRF_ROOT/lib/modules" | head -n1)
> +echo "generating modules.dep..."
> +debirf_exec depmod -a "$KVERS"
> +
> +# extract kernel and debian stock initrd from the build root:
> +mv "$DEBIRF_ROOT"/boot/vmlinu* "$DEBIRF_BUILDD"
> +
> +# remove kernel symlinks
> +if [ -L "$DEBIRF_ROOT"/vmlinuz ] ; then
> +    rm "$DEBIRF_BUILDD"/vmlinuz
> +fi
> diff --git a/appliance/debian/modules/network b/appliance/debian/modules/network
> new file mode 120000
> index 0000000..979418d
> --- /dev/null
> +++ b/appliance/debian/modules/network
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/network
> \ No newline at end of file
> diff --git a/appliance/debian/modules/root-bashrc b/appliance/debian/modules/root-bashrc
> new file mode 120000
> index 0000000..651d030
> --- /dev/null
> +++ b/appliance/debian/modules/root-bashrc
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/root-bashrc
> \ No newline at end of file
> diff --git a/appliance/debian/modules/serial-terminal b/appliance/debian/modules/serial-terminal
> new file mode 120000
> index 0000000..a5376da
> --- /dev/null
> +++ b/appliance/debian/modules/serial-terminal
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/serial-terminal
> \ No newline at end of file
> diff --git a/appliance/debian/modules/y0_install-guestfsd b/appliance/debian/modules/y0_install-guestfsd
> new file mode 100755
> index 0000000..17bbbdc
> --- /dev/null
> +++ b/appliance/debian/modules/y0_install-guestfsd
> @@ -0,0 +1,33 @@
> +#!/bin/bash -e
> +# install guestfsd specific stuff
> +
> +# Kernel modules take up nearly half of the image.  Only include ones
> +# which are on the whitelist.
> +exec 5<../appliance/kmod.whitelist
> +whitelist=
> +while read kmod 0<&5; do
> +    whitelist="$whitelist -a -not -name $kmod"
> +done
> +exec 5<&-
> +
> +echo "Module whitelist: $whitelist"
> +find $DEBIRF_ROOT/lib/modules/*/kernel -name '*.ko' $whitelist -a -exec rm '{}' \;
> +
> +# install additional packages:
> +PKGLIST=$(< packagelist)
> +echo "Will add $PKGLIST"
> +debirf_exec aptitude -R -y install $PKGLIST
> +debirf_exec aptitude -y remove vim-tiny dhcp3-client iptables
> +
> +debirf_exec mkdir -p --mode=0777 /sysroot
> +
> +# cleanup some other heavy lifters:
> +rm -rf "$DEBIRF_ROOT"/usr/share/doc/
> +rm -rf "$DEBIRF_ROOT"/usr/share/zoneinfo/
> +rm -rf "$DEBIRF_ROOT"/usr/share/man/
> +
> +# Install the actual appliance:
> +echo $PWD
> +install -o root -g root -m 0755 ../daemon/guestfsd "$DEBIRF_ROOT"/sbin/guestfsd
> +install -o root -g root -m 0755 init "$DEBIRF_ROOT"/sbin/init
> +
> diff --git a/appliance/debian/modules/z0_remove-aptitude b/appliance/debian/modules/z0_remove-aptitude
> new file mode 120000
> index 0000000..7c56260
> --- /dev/null
> +++ b/appliance/debian/modules/z0_remove-aptitude
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/z0_remove-aptitude
> \ No newline at end of file
> diff --git a/appliance/debian/modules/z0_remove-locales b/appliance/debian/modules/z0_remove-locales
> new file mode 120000
> index 0000000..80a82fa
> --- /dev/null
> +++ b/appliance/debian/modules/z0_remove-locales
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/z0_remove-locales
> \ No newline at end of file
> diff --git a/appliance/debian/modules/z1_clean-root b/appliance/debian/modules/z1_clean-root
> new file mode 120000
> index 0000000..f0d3aad
> --- /dev/null
> +++ b/appliance/debian/modules/z1_clean-root
> @@ -0,0 +1 @@
> +/usr/share/debirf/modules/z1_clean-root
> \ No newline at end of file
> diff --git a/appliance/debian/modules/z99_final-cleanups b/appliance/debian/modules/z99_final-cleanups
> new file mode 100755
> index 0000000..ef5fac7
> --- /dev/null
> +++ b/appliance/debian/modules/z99_final-cleanups
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> +rm -rf "$DEBIRF_ROOT"/var/lib/dpkg/info
> diff --git a/configure.ac b/configure.ac
> index 1625327..03f9388 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -523,6 +523,7 @@ AC_CONFIG_FILES([appliance/libguestfs-supermin-helper],
>  AC_CONFIG_FILES([Makefile
>  		 src/Makefile fish/Makefile po/Makefile.in examples/Makefile
>  		 appliance/Makefile
> +		 appliance/debian/debirf.conf
>  		 images/Makefile
>  		 capitests/Makefile
>  		 regressions/Makefile
> -- 
> 1.6.3.3
> 

Yes, this looks fine now.  +1

> >From ef4d9afa2d958dec3c52b4d627b87245c9ba754b Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
> Date: Tue, 30 Jun 2009 15:01:14 +0200
> Subject: [PATCH 4/4] Build Debian based appliance using debirf
> 
> ---
>  appliance/make.sh.in   |  236 +++++++++++++++++++++++++-----------------------
>  appliance/update.sh.in |   26 ++++--
>  2 files changed, 139 insertions(+), 123 deletions(-)
> 
> diff --git a/appliance/make.sh.in b/appliance/make.sh.in
> index 637bd07..e98c325 100755
> --- a/appliance/make.sh.in
> +++ b/appliance/make.sh.in
> @@ -22,125 +22,131 @@ unset CDPATH
>  
>  set -e
>  
> -cd @top_builddir@
> -
> -# Decide on names for the final output.  These have to match Makefile.am.
> -output=appliance/initramfs  REPO@  host_cpu@.img
> -koutput=appliance/vmlinuz  REPO@  host_cpu@
> -rm -f $output
> -rm -f $koutput
> -
> -# Create the basic initramfs.
> -exec 5<appliance/packagelist
> -packages=
> -while read pkg 0<&5; do
> -    packages="$packages -i $pkg"
> -done
> -exec 5<&-
> -
> - FEBOOTSTRAP@ $packages -u @UPDATES@ @REPO@ initramfs @MIRROR@
> -
> -# /sysroot is where the guest root filesystem will be mounted.
> - FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0777 /sysroot
> -
> -# Create /tmp if it is missing.
> - FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0777 /tmp
> -
> -# Nuke some stuff.  The kernel pulls mkinitrd and plymouth which pulls in
> -# all of Python.  Sheez.
> -(cd initramfs && find -name '*plymouth*' -print0) |
> -  xargs -0 @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
> -(cd initramfs && find -name '*python*' -print0) |
> -  xargs -0 @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
> -
> -# In Fedora >= 11, it pulls in all of Perl from somewhere.  Nuke from orbit.
> - FEBOOTSTRAP_RUN@ initramfs -- rm -rf /usr/lib/perl5 /usr/lib64/perl5
> -
> -# Anaconda?  JPEG images?
> - FEBOOTSTRAP_RUN@ initramfs -- rm -rf /usr/lib/anaconda-runtime
> -
> -# Don't need any firmware.
> - FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/firmware
> -
> -# Don't need any keyboard maps.
> - FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/kbd
> -
> -# Remove anything in home directory.  Because this is potentially
> -# liable to monstrous fuck-ups, we don't put a slash before 'home'.
> -(cd initramfs && echo home/*) |
> -  xargs @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
> -
> -# Remove /var/lib/yum stuff.
> - FEBOOTSTRAP_RUN@ initramfs -- rm -rf /var/lib/yum
> -
> -# Remove some unreadable binaries which are incompatible with
> -# the supermin appliance.  Since these binaries can't be read
> -# from the host filesystem, they generate warnings like:
> -#   cpio: ./usr/bin/chfn: Cannot open: Permission denied
> -# These binaries are not needed for operation of the appliance.
> - FEBOOTSTRAP_RUN@ initramfs -- rm -f \
> -  /usr/bin/chfn \
> -  /usr/bin/chsh \
> -  /usr/libexec/pt_chown \
> -  /usr/sbin/groupdel \
> -  /usr/sbin/groupadd \
> -  /usr/sbin/useradd \
> -  /usr/sbin/tzdata-update \
> -  /usr/sbin/userdel \
> -  /usr/sbin/usermod \
> -  /usr/sbin/groupmod \
> -  /usr/sbin/groupmems \
> -  /sbin/unix_update \
> -  $(cd initramfs && echo usr/sbin/glibc_post_upgrade.*)
> -
> -# Kernel modules take up nearly half of the image.  Only include ones
> -# which are on the whitelist.
> -exec 5<appliance/kmod.whitelist
> -whitelist=
> -while read kmod 0<&5; do
> -    whitelist="$whitelist -a -not -name $kmod"
> -done
> -exec 5<&-
> -
> -(cd initramfs && \
> -  find lib/modules/*/kernel -name '*.ko' $whitelist -a -print0 ) |
> -  xargs -0 febootstrap-run initramfs -- rm
> -
> -# Pull the kernel out into the current directory.  We don't want it in
> -# the initramfs image.
> -cp initramfs/boot/vmlinuz* $koutput
> - FEBOOTSTRAP_RUN@ initramfs -- rm -rf boot
> -
> -# Minimize the image.
> - FEBOOTSTRAP_MINIMIZE@ initramfs
> -
> -# Add some missing configuration files.
> -if [ ! -f initramfs/etc/hosts ]; then
> -    cat > hosts.new <<'__EOF__'
> -127.0.0.1 guestfs localhost.localdomain localhost
> -::1       localhost6.localdomain6 localhost6
> +if [ "@DIST@" = "REDHAT" ]; then
> +  cd @top_builddir@
> +  # Decide on names for the final output.  These have to match Makefile.am.
> +  output=appliance/initramfs  REPO@  host_cpu@.img
> +  koutput=appliance/vmlinuz  REPO@  host_cpu@
> +  rm -f $output
> +  rm -f $koutput
> +
> +  # Create the basic initramfs.
> +  exec 5<appliance/packagelist
> +  packages=
> +  while read pkg 0<&5; do
> +      packages="$packages -i $pkg"
> +  done
> +  exec 5<&-
> +
> +  @FEBOOTSTRAP@ $packages -u @UPDATES@ @REPO@ initramfs @MIRROR@
> +
> +  # /sysroot is where the guest root filesystem will be mounted.
> +  @FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0777 /sysroot
> +
> +  # Create /tmp if it is missing.
> +  @FEBOOTSTRAP_RUN@ initramfs -- mkdir -p --mode=0777 /tmp
> +
> +  # Nuke some stuff.  The kernel pulls mkinitrd and plymouth which pulls in
> +  # all of Python.  Sheez.
> +  (cd initramfs && find -name '*plymouth*' -print0) |
> +    xargs -0 @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
> +  (cd initramfs && find -name '*python*' -print0) |
> +    xargs -0 @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
> +
> +  # In Fedora >= 11, it pulls in all of Perl from somewhere.  Nuke from orbit.
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /usr/lib/perl5 /usr/lib64/perl5
> +
> +  # Anaconda?  JPEG images?
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /usr/lib/anaconda-runtime
> +
> +  # Don't need any firmware.
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/firmware
> +
> +  # Don't need any keyboard maps.
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/kbd
> +
> +  # Remove anything in home directory.  Because this is potentially
> +  # liable to monstrous fuck-ups, we don't put a slash before 'home'.
> +  (cd initramfs && echo home/*) |
> +    xargs @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
> +
> +  # Remove /var/lib/yum stuff.
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /var/lib/yum
> +
> +  # Remove some unreadable binaries which are incompatible with
> +  # the supermin appliance.  Since these binaries can't be read
> +  # from the host filesystem, they generate warnings like:
> +  #   cpio: ./usr/bin/chfn: Cannot open: Permission denied
> +  # These binaries are not needed for operation of the appliance.
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -f \
> +    /usr/bin/chfn \
> +    /usr/bin/chsh \
> +    /usr/libexec/pt_chown \
> +    /usr/sbin/groupdel \
> +    /usr/sbin/groupadd \
> +    /usr/sbin/useradd \
> +    /usr/sbin/tzdata-update \
> +    /usr/sbin/userdel \
> +    /usr/sbin/usermod \
> +    /usr/sbin/groupmod \
> +    /usr/sbin/groupmems \
> +    /sbin/unix_update \
> +    $(cd initramfs && echo usr/sbin/glibc_post_upgrade.*)
> +
> +  # Kernel modules take up nearly half of the image.  Only include ones
> +  # which are on the whitelist.
> +  exec 5<appliance/kmod.whitelist
> +  whitelist=
> +  while read kmod 0<&5; do
> +      whitelist="$whitelist -a -not -name $kmod"
> +  done
> +  exec 5<&-
> +
> +  (cd initramfs && \
> +    find lib/modules/*/kernel -name '*.ko' $whitelist -a -print0 ) |
> +    xargs -0 febootstrap-run initramfs -- rm
> +
> +  # Pull the kernel out into the current directory.  We don't want it in
> +  # the initramfs image.
> +  cp initramfs/boot/vmlinuz* $koutput
> +  @FEBOOTSTRAP_RUN@ initramfs -- rm -rf boot
> +
> +  # Minimize the image.
> +  @FEBOOTSTRAP_MINIMIZE@ initramfs
> +
> +  # Add some missing configuration files.
> +  if [ ! -f initramfs/etc/hosts ]; then
> +      cat > hosts.new <<'__EOF__'
> +  127.0.0.1 guestfs localhost.localdomain localhost
> +  ::1       localhost6.localdomain6 localhost6
>  __EOF__
> -    @FEBOOTSTRAP_INSTALL@ initramfs hosts.new /etc/hosts 0644 root.root
> -    rm hosts.new
> -fi
> +      @FEBOOTSTRAP_INSTALL@ initramfs hosts.new /etc/hosts 0644 root.root
> +      rm hosts.new
> +  fi
>  
> -if [ ! -f initramfs/etc/fstab ]; then
> -    @FEBOOTSTRAP_RUN@ initramfs -- touch /etc/fstab
> -fi
> +  if [ ! -f initramfs/etc/fstab ]; then
> +      @FEBOOTSTRAP_RUN@ initramfs -- touch /etc/fstab
> +  fi
> +
> +  echo nameserver 10.0.2.3 > resolv.conf.new
> +  @FEBOOTSTRAP_INSTALL@ initramfs resolv.conf.new /etc/resolv.conf 0644 root.root
> +  rm resolv.conf.new
>  
> -echo nameserver 10.0.2.3 > resolv.conf.new
> - FEBOOTSTRAP_INSTALL@ initramfs resolv.conf.new /etc/resolv.conf 0644 root.root
> -rm resolv.conf.new
> +  # Create the init script.
> +  @FEBOOTSTRAP_INSTALL@ initramfs appliance/init /init 0755 root.root
>  
> -# Create the init script.
> - FEBOOTSTRAP_INSTALL@ initramfs appliance/init /init 0755 root.root
> +  # Just in case the kernel isn't looking for /init, make /sbin/init
> +  # be our script, not the real init.
> +  # FEBOOTSTRAP_RUN@ initramfs -- ln -f /init /sbin/init
>  
> -# Just in case the kernel isn't looking for /init, make /sbin/init
> -# be our script, not the real init.
> -# FEBOOTSTRAP_RUN@ initramfs -- ln -f /init /sbin/init
> +  ls -lh $koutput
>  
> -ls -lh $koutput
> +  # Now directly run the update script to copy/update the daemon in the
> +  # initramfs.
> +  cd appliance && bash update.sh
> +
> +elif [ "@DIST@" = "DEBIAN" ]; then
> +  cd @top_builddir@/appliance
> +  debirf make -n debian
> +fi
>  
> -# Now directly run the update script to copy/update the daemon in the
> -# initramfs.
> -cd appliance && bash update.sh
> diff --git a/appliance/update.sh.in b/appliance/update.sh.in
> index 3b779f8..4fbd651 100755
> --- a/appliance/update.sh.in
> +++ b/appliance/update.sh.in
> @@ -23,14 +23,24 @@ unset CDPATH
>  
>  set -e
>  
> -cd @top_builddir@
> +if [ "@DIST@" = "REDHAT" ]; then
> +  cd @top_builddir@
> +  output=appliance/initramfs  REPO@  host_cpu@.img
>  
> -output=appliance/initramfs  REPO@  host_cpu@.img
> +  # Copy the daemon into the filesystem.
> +  @FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
>  
> -# Copy the daemon into the filesystem.
> - FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
> +  # Generate final image.
> +  @FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
> +  mv $output-t $output
> +  ls -lh $output
> +elif [ "@DIST@" = "DEBIAN" ]; then
> +  cd @top_builddir@/appliance
> +
> +  output=initramfs  REPO@  host_cpu@.img
> +  vmlinuz=vmlinuz  REPO@  host_cpu@
> +
> +  ln -sf debian/debirf-libguestfs_ REPO@*.cgz $output
> +  ln -sf debian/vmlinuz-* $vmlinuz
> +fi
>  
> -# Generate final image.
> - FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
> -mv $output-t $output
> -ls -lh $output
> -- 
> 1.6.3.3
> 

Yes, also fine.

I'll apply these patches to libguestfs git repo shortly.

Thanks for your contribution!

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]