summaryrefslogtreecommitdiffstats
path: root/appliance
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-06-16 23:47:36 +0200
committerRichard W.M. Jones <rjones@redhat.com>2009-07-02 14:12:24 +0100
commitbcd7bd3aabf4a28bca24bf5d22ed3a68322ec637 (patch)
treebcf20b788a2c60d1de0dbffcb4bb88005780a424 /appliance
parent4e8884823caef364d271075fb9df7dbe450b892c (diff)
downloadlibguestfs-bcd7bd3aabf4a28bca24bf5d22ed3a68322ec637.tar.gz
libguestfs-bcd7bd3aabf4a28bca24bf5d22ed3a68322ec637.tar.xz
libguestfs-bcd7bd3aabf4a28bca24bf5d22ed3a68322ec637.zip
add debirf files
Diffstat (limited to 'appliance')
-rw-r--r--appliance/debian/debirf.conf.in5
l---------appliance/debian/modules/a0_motd1
l---------appliance/debian/modules/a0_prep-root1
-rwxr-xr-xappliance/debian/modules/install_kernel68
l---------appliance/debian/modules/network1
l---------appliance/debian/modules/root-bashrc1
l---------appliance/debian/modules/serial-terminal1
-rwxr-xr-xappliance/debian/modules/y0_install-guestfsd33
l---------appliance/debian/modules/z0_remove-aptitude1
l---------appliance/debian/modules/z0_remove-locales1
l---------appliance/debian/modules/z1_clean-root1
-rwxr-xr-xappliance/debian/modules/z99_final-cleanups3
12 files changed, 117 insertions, 0 deletions
diff --git a/appliance/debian/debirf.conf.in b/appliance/debian/debirf.conf.in
new file mode 100644
index 00000000..a3dc16fe
--- /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 00000000..8e3ad2f4
--- /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 00000000..654bc70a
--- /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 00000000..c1076ce1
--- /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 00000000..979418d5
--- /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 00000000..651d030a
--- /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 00000000..a5376dae
--- /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 00000000..17bbbdc0
--- /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 00000000..7c56260c
--- /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 00000000..80a82fab
--- /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 00000000..f0d3aad9
--- /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 00000000..ef5fac79
--- /dev/null
+++ b/appliance/debian/modules/z99_final-cleanups
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rm -rf "$DEBIRF_ROOT"/var/lib/dpkg/info