From: Greg Price Date: Sun, 28 Sep 2008 20:40:06 +0000 (-0400) Subject: factor out common autoinstaller code for both guest and host X-Git-Tag: sipb-xen-autoinstaller/2.5~8 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-autoinstaller.git/commitdiff_plain/04a85e82bb3cd2929c4ebb0e8df2a97c73eb4890?hp=68bf8a3793334f61d25d5b866f1e24d1746d6c6c;ds=sidebyside factor out common autoinstaller code for both guest and host svn path=/trunk/packages/sipb-xen-autoinstaller/; revision=929 --- diff --git a/guest/usr/lib/xen-tools/debian.d/91-make-fstab b/common/usr/lib/xen-tools/debian.d/91-make-fstab similarity index 100% rename from guest/usr/lib/xen-tools/debian.d/91-make-fstab rename to common/usr/lib/xen-tools/debian.d/91-make-fstab diff --git a/guest/usr/lib/xen-tools/debian.d/97-setup-grub b/common/usr/lib/xen-tools/debian.d/97-setup-grub similarity index 100% rename from guest/usr/lib/xen-tools/debian.d/97-setup-grub rename to common/usr/lib/xen-tools/debian.d/97-setup-grub diff --git a/guest/usr/lib/xen-tools/debian.d/patches/common.diff b/common/usr/lib/xen-tools/debian.d/patches/common.diff similarity index 100% rename from guest/usr/lib/xen-tools/debian.d/patches/common.diff rename to common/usr/lib/xen-tools/debian.d/patches/common.diff diff --git a/guest/usr/lib/xen-tools/debian.d/patches/inittab.diff b/common/usr/lib/xen-tools/debian.d/patches/inittab.diff similarity index 100% rename from guest/usr/lib/xen-tools/debian.d/patches/inittab.diff rename to common/usr/lib/xen-tools/debian.d/patches/inittab.diff diff --git a/guest/usr/lib/xen-tools/edgy.d/91-make-fstab b/common/usr/lib/xen-tools/edgy.d/91-make-fstab similarity index 100% rename from guest/usr/lib/xen-tools/edgy.d/91-make-fstab rename to common/usr/lib/xen-tools/edgy.d/91-make-fstab diff --git a/guest/usr/lib/xen-tools/edgy.d/97-setup-grub b/common/usr/lib/xen-tools/edgy.d/97-setup-grub similarity index 100% rename from guest/usr/lib/xen-tools/edgy.d/97-setup-grub rename to common/usr/lib/xen-tools/edgy.d/97-setup-grub diff --git a/guest/usr/lib/xen-tools/edgy.d/patches/common.diff b/common/usr/lib/xen-tools/edgy.d/patches/common.diff similarity index 100% rename from guest/usr/lib/xen-tools/edgy.d/patches/common.diff rename to common/usr/lib/xen-tools/edgy.d/patches/common.diff diff --git a/guest/usr/lib/xen-tools/edgy.d/patches/event.d.diff b/common/usr/lib/xen-tools/edgy.d/patches/event.d.diff similarity index 100% rename from guest/usr/lib/xen-tools/edgy.d/patches/event.d.diff rename to common/usr/lib/xen-tools/edgy.d/patches/event.d.diff diff --git a/guest/usr/lib/xen-tools/patches/common.diff b/common/usr/lib/xen-tools/patches/common.diff similarity index 100% rename from guest/usr/lib/xen-tools/patches/common.diff rename to common/usr/lib/xen-tools/patches/common.diff diff --git a/guest/usr/lib/xen-tools/patches/event.d.diff b/common/usr/lib/xen-tools/patches/event.d.diff similarity index 100% rename from guest/usr/lib/xen-tools/patches/event.d.diff rename to common/usr/lib/xen-tools/patches/event.d.diff diff --git a/common/usr/sbin/sipb-xen-create-image b/common/usr/sbin/sipb-xen-create-image new file mode 100644 index 0000000..f0f685a --- /dev/null +++ b/common/usr/sbin/sipb-xen-create-image @@ -0,0 +1,14 @@ +#!/bin/bash +# Usage: no command-line args. +# "arguments" come in environment: +# TARGET a device filename, IMAGESIZE its size in XXXX what unit? +# ARCH, DIST, MIRROR +# HOSTNAME, IP + +echo ,"${IMAGESIZE}"$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 "$TARGET" + +xen-create-image --image-dev "${TARGET}1" --swap-dev "${TARGET}2" --fs ext3 --ide \ + --hostname "$HOSTNAME" --ip="$IP" --netmask=255.255.0.0 --gateway=18.181.0.1 \ + --arch "$ARCH" --dist "$DIST" --mirror "$MIRROR" --cache=yes + +exit 0 diff --git a/debian/changelog b/debian/changelog index abb993d..9d6492a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +sipb-xen-autoinstaller (2.5) unstable; urgency=low + + * Add sipb-xen-autoinstaller-host binary package, to contain + autoinstaller for system VMs + * Put common files in both binary packages + + -- Greg Price Sun, 28 Sep 2008 16:36:56 -0400 + sipb-xen-autoinstaller (2.4) unstable; urgency=low * Switch to using just sipb-database options on the host diff --git a/debian/control b/debian/control index f8fee41..424ff19 100644 --- a/debian/control +++ b/debian/control @@ -5,17 +5,20 @@ Maintainer: SIPB Xen Project Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.2.0), config-package-dev (>= 4.5~) Standards-Version: 3.7.2 -Package: sipb-xen-autoinstaller-guest +Package: sipb-xen-autoinstaller-host Architecture: all Provides: ${diverted-files} Conflicts: ${diverted-files} -Depends: ${misc:Depends}, patch, xen-tools, busybox-static +Depends: ${misc:Depends}, patch, xen-tools, sipb-xen-dom0 Conflicts: sysvinit, upstart -Description: SIPB Xen automatic guest-image installer system (guest) +Description: SIPB Xen automatic guest-image installer system (host) This is our automatic guest-image installer system. -Package: sipb-xen-autoinstaller-host +Package: sipb-xen-autoinstaller-guest Architecture: all -Depends: ${misc:Depends}, sipb-xen-host-master -Description: SIPB Xen automatic guest-image installer system (host) +Provides: ${diverted-files} +Conflicts: ${diverted-files} +Depends: ${misc:Depends}, patch, xen-tools, busybox-static, lvm2 +Conflicts: sysvinit, upstart +Description: SIPB Xen automatic guest-image installer system (guest) This is our automatic guest-image installer system. diff --git a/debian/control.in b/debian/control.in index 2646c7a..0f7c4d2 100644 --- a/debian/control.in +++ b/debian/control.in @@ -5,6 +5,15 @@ Maintainer: SIPB Xen Project Build-Depends: @cdbs@ Standards-Version: 3.7.2 +Package: sipb-xen-autoinstaller-host +Architecture: all +Provides: ${diverted-files} +Conflicts: ${diverted-files} +Depends: ${misc:Depends}, patch, xen-tools, sipb-xen-dom0 +Conflicts: sysvinit, upstart +Description: SIPB Xen automatic guest-image installer system (host) + This is our automatic guest-image installer system. + Package: sipb-xen-autoinstaller-guest Architecture: all Provides: ${diverted-files} diff --git a/debian/sipb-xen-autoinstaller-guest.install b/debian/sipb-xen-autoinstaller-guest.install index 0134111..5f7689e 100644 --- a/debian/sipb-xen-autoinstaller-guest.install +++ b/debian/sipb-xen-autoinstaller-guest.install @@ -1 +1,2 @@ +common/* . guest/* . diff --git a/debian/sipb-xen-autoinstaller-host.install b/debian/sipb-xen-autoinstaller-host.install new file mode 100644 index 0000000..27acdc4 --- /dev/null +++ b/debian/sipb-xen-autoinstaller-host.install @@ -0,0 +1,2 @@ +common/* . +host/* . diff --git a/guest/etc/init.d/rcS.sipb-xen b/guest/etc/init.d/rcS.sipb-xen index 9431cd6..ff605d6 100644 --- a/guest/etc/init.d/rcS.sipb-xen +++ b/guest/etc/init.d/rcS.sipb-xen @@ -5,34 +5,33 @@ for x in $(cat /proc/cmdline); do /usr/lib/klibc/bin/ipconfig -d ${x#ip=} ;; mirror=*) - MIRROR=${x#mirror=} + export MIRROR=${x#mirror=} ;; dist=*) - DIST=${x#dist=} + export DIST=${x#dist=} ;; arch=*) - ARCH=${x#arch=} + export ARCH=${x#arch=} ;; imagesize=*) - IMAGESIZE=${x#imagesize=} + export IMAGESIZE=${x#imagesize=} ;; noinstall) exit 0 ;; esac done + mount -t tmpfs none /var/log mount -t tmpfs none /tmp +export TARGET=/dev/hda +export ARCH=${ARCH-amd64} +export IP=$(ifconfig eth0 | sed -n 's/.*inet addr:\([0-9\.]*\).*/\1/p') +export HOSTNAME=$(hostname) -TARGET=/dev/hda -ARCH=${ARCH-amd64} -IP=$(ifconfig eth0 | sed -n 's/.*inet addr:\([0-9\.]*\).*/\1/p') -HOSTNAME=$(hostname) - -echo ,${IMAGESIZE}$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 $TARGET - -xen-create-image --image-dev ${TARGET}1 --swap-dev ${TARGET}2 --fs ext3 --ide --arch $ARCH --dist $DIST --hostname $HOSTNAME --mirror $MIRROR --ip=$IP --netmask=255.255.0.0 --gateway=18.181.0.1 --cache=yes +# args passed through environment rather than as 7 positional args +/usr/sbin/sipb-xen-create-image busybox poweroff exit 0