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

[fedora-virt] Re: [RFC/PATCH] libguestfs: build Debian based appliance



On Wed, Jun 17, 2009 at 12:11:05AM +0200, Guido Günther wrote:
> Hi Rich,
> attached patches allows to build the appliance based on Debian (or any
> Debian based distribution supported by debirf) by using e.g.:
> 
> ./configure --with-repo=squeeze --with-mirror=http://apt:9999/debian
> 
> Please note that the third patch isn't to be applied yet, it simply
> overwrites the contents of make/update.sh.in with the stuff we need for
> Debian. Also when building a fixed (#509381) debirf is needed which has
> just been uploded to unstable.
> Cheers,
>  -- Guido

> >From c2fbd2f953147c4320a158878955f099af45e409 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
> Date: Mon, 15 Jun 2009 20:27:52 +0200
> Subject: [PATCH 1/3] check for Debian tools
> 
> ---
>  configure.ac |   46 ++++++++++++++++++++++++++++------------------
>  1 files changed, 28 insertions(+), 18 deletions(-)

First patch is fine.  I will apply it anyway.

> >From 1b3c0224bd33c394bf1ae9144ae8c0c8bcff51e7 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 2/3] 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 |   56 +++++++++++++++++++++
>  appliance/debian/modules/z0_remove-aptitude  |    1 +
>  appliance/debian/modules/z0_remove-locales   |    1 +
>  appliance/debian/modules/z1_clean-root       |    1 +
>  configure.ac                                 |    2 +-
>  12 files changed, 138 insertions(+), 1 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

This patch duplicates things unnecessarily, I think.

List of kernel modules (commented out), which are now in a separate
file called kmod.whitelist{,in}:

> +#(cd "$DEBIRF_ROOT" && find lib/modules/*/kernel \
> +#  -name '*.ko' \
> +#  -a ! -name 'virtio.ko' \
> +#  -a ! -name 'virtio_net.ko' \
> +#  -a ! -name 'virtio_pci.ko' \
> +#  -a ! -name 'virtio_ring.ko' \
> +#  -a ! -name 'ext2.ko' \
> +#  -a ! -name 'ext4.ko' \
> +#  -a ! -name 'crc16.ko' \
> +#  -a ! -name 'jbd2.ko' \
> +#  -a ! -name 'fuse.ko' \
> +#  -a ! -name 'vfat.ko' \
> +#  -a ! -name 'fat.ko' \
> +#  -a ! -name 'udf.ko' \
> +#  -a ! -name 'crc_itu_t.ko' \
> +#  -a ! -name 'nls_utf8.ko' \
> +#  -a ! -name 'dm-*.ko' \
> +#  -a -exec rm "{}" \; )
> +
> +rm -rf "$DEBIRF_ROOT"/usr/share/doc
> +rm -rf "$DEBIRF_ROOT"/usr/share/zoneinfo

List of packages.  Although package names are slightly different
between Fedora and Debian, I think we should aim to unify this list as
far as possible.  How about adding a file similar to the kernel module
whitelist which lists packages, albeit with either wildcards or
#if DEBIAN ... #endif markup?

> +debirf_exec aptitude -R -y install libaugeas0 lvm2 binutils dosfstools grub iproute module-init-tools ntfs-3g strace util-linux zerofree bsdmainutils
> +debirf_exec aptitude -y remove vim-tiny dhcp3-client

The /init script should also be moved out to a separate file.  I don't
want to have to maintain it twice, and it should be the same or very
similar for both appliances:

> +rm -f "$DEBIRF_ROOT"/sbin/init
> +cat > "$DEBIRF_ROOT"/sbin/init <<__EOF__
> +#!/bin/sh
> +export PATH=/sbin:/usr/sbin:$PATH
> +cd /dev
> +MAKEDEV hda hdb hdc hdd sda sdb sdc sdd sd
> +cd /
> +mount -t proc /proc /proc
> +mount -t sysfs /sys /sys
> +mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
> +modprobe virtio_pci
> +modprobe virtio_net
> +modprobe dm_mod ||:
> +/sbin/ifconfig lo 127.0.0.1
> +/sbin/ifconfig eth0 10.0.2.10
> +/sbin/route add default gw 10.0.2.2
> +lvm vgscan --ignorelockingfailure
> +lvm vgchange -ay --ignorelockingfailure
> +exec guestfsd -f
> +__EOF__

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


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