Index: /trunk/packages/sipb-xen-guest-installer/debian/control
===================================================================
--- /trunk/packages/sipb-xen-guest-installer/debian/control	(revision 740)
+++ /trunk/packages/sipb-xen-guest-installer/debian/control	(revision 741)
@@ -1,3 +1,3 @@
-Source: sipb-xen-guest-installer
+Source: sipb-xen-autoinstaller
 Section: net
 Priority: extra
@@ -6,7 +6,13 @@
 Standards-Version: 3.7.2
 
-Package: sipb-xen-guest-installer
+Package: sipb-xen-autoinstaller-guest
 Architecture: all
-Depends: ${misc:Depends}, patch, xen-tools, kpartx
-Description: SIPB Xen automatic guest-image installer system
+Depends: ${misc:Depends}, patch, xen-tools, kpartx, lvm2
+Description: SIPB Xen automatic guest-image installer system (guest)
  This is our automatic guest-image installer system.
+
+Package: sipb-xen-autoinstaller-host
+Architecture: all
+Depends: ${misc:Depends}
+Description: SIPB Xen automatic guest-image installer system (host)
+ This is our automatic guest-image installer system.
Index: /trunk/packages/sipb-xen-guest-installer/debian/control.in
===================================================================
--- /trunk/packages/sipb-xen-guest-installer/debian/control.in	(revision 740)
+++ /trunk/packages/sipb-xen-guest-installer/debian/control.in	(revision 741)
@@ -1,3 +1,3 @@
-Source: sipb-xen-guest-installer
+Source: sipb-xen-autoinstaller
 Section: net
 Priority: extra
@@ -6,7 +6,13 @@
 Standards-Version: 3.7.2
 
-Package: sipb-xen-guest-installer
+Package: sipb-xen-autoinstaller-guest
 Architecture: all
-Depends: ${misc:Depends}, patch, xen-tools, kpartx
-Description: SIPB Xen automatic guest-image installer system
+Depends: ${misc:Depends}, patch, xen-tools
+Description: SIPB Xen automatic guest-image installer system (guest)
  This is our automatic guest-image installer system.
+
+Package: sipb-xen-autoinstaller-host
+Architecture: all
+Depends: ${misc:Depends}
+Description: SIPB Xen automatic guest-image installer system (host)
+ This is our automatic guest-image installer system.
Index: /trunk/packages/sipb-xen-guest-installer/domU/etc/init.d/rcS
===================================================================
--- /trunk/packages/sipb-xen-guest-installer/domU/etc/init.d/rcS	(revision 741)
+++ /trunk/packages/sipb-xen-guest-installer/domU/etc/init.d/rcS	(revision 741)
@@ -0,0 +1,16 @@
+#!/bin/sh
+for x in $(cat /proc/cmdline); do
+    case $x in
+    ip=*)
+      /usr/lib/klibc/bin/ipconfig -d ${x#ip=}
+      ;;
+    noinstall)
+      exit 0
+      ;;
+    esac
+done
+mount -t tmpfs none /var/log
+mount -t tmpfs none /tmp
+sipb-xen-install
+busybox poweroff
+exit 0
Index: /trunk/packages/sipb-xen-guest-installer/domU/usr/sbin/sipb-xen-install
===================================================================
--- /trunk/packages/sipb-xen-guest-installer/domU/usr/sbin/sipb-xen-install	(revision 740)
+++ /trunk/packages/sipb-xen-guest-installer/domU/usr/sbin/sipb-xen-install	(revision 741)
@@ -3,28 +3,11 @@
 TARGET=/dev/hda
 
-#For some strange reason, . $TARGET doesn't work reliably.
+# Read in the environment variables
+# For some strange reason, . $TARGET doesn't work reliably.
 eval `grep -a -m1 -B 100 ^return$ $TARGET | grep -v return`
-
-
-#HOSTNAME=foobar
-#DIST=etch
-#MIRROR=http://debian.lcs.mit.edu/debian
-#IMAGESIZE=3800
 
 ARCH=amd64
 
-#LVSIZE=`lvs --noheadings --units M --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'`
+echo ,${IMAGESIZE}$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 $TARGET
 
-# If this script is interrupted, it may not clean up after itself.
-# In particular, it may leave ${VOLUME}1 mounted somewhere in tmp.
-# Unmount it, then kpartx -d $VOLUME to clean up.
-
-###
-###  Create the device for SIPB-Xen purposes
-###
-echo ,${IMAGESIZE}$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 $TARGET
-#kpartx -a $TARGET
-
-xen-create-image --image-dev ${TARGET}1 --swap-dev ${TARGET}2 --fs ext3 --ide --arch $ARCH --dist $DIST --hostname $HOSTNAME --mirror $MIRROR --dhcp --cache=yes
-
-#kpartx -d $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
Index: /trunk/packages/sipb-xen-guest-installer/files/etc/xen/autoinstall.cfg
===================================================================
--- /trunk/packages/sipb-xen-guest-installer/files/etc/xen/autoinstall.cfg	(revision 741)
+++ /trunk/packages/sipb-xen-guest-installer/files/etc/xen/autoinstall.cfg	(revision 741)
@@ -0,0 +1,45 @@
+#
+# Configuration file for the Xen instance foobar, created
+# by xen-tools 3.7 on Sat Jun 21 16:24:54 2008.
+#
+
+#
+#  Kernel + memory size
+#
+#bootloader = '/usr/lib/xen-default/bin/pygrub'
+kernel      = '/boot/vmlinuz-2.6.24-19-xen'
+ramdisk     = '/boot/initrd.img-2.6.24-19-xen'
+memory      = '256'
+
+
+#
+#  Hostname
+#
+name        = 'd_foobar2'
+
+
+#
+#  Disk device(s).
+#
+disk        = [
+                  'phy:/dev/xenvg/%s_hda,hdb,r' % name,
+                  'phy:/dev/xenvg/d_%s_hda,hda,w' % target,
+              ]
+
+root = '/dev/hdb1'
+extra = 'ro noresume ip=18.181.0.216::18.181.0.1:255.255.0.0:foobar2:eth0:off'
+
+#
+#  Networking
+#
+vif         = [ 'ip=18.181.0.216,mac=00:16:3e:00:2c:ee,script=vif-bridge' ]
+
+#
+#  Behaviour
+#
+on_poweroff = 'destroy'
+on_reboot   = 'restart'
+on_crash    = 'destroy'
+
+
+
Index: /trunk/packages/sipb-xen-guest-installer/files/usr/sbin/sipb-xen-install
===================================================================
--- /trunk/packages/sipb-xen-guest-installer/files/usr/sbin/sipb-xen-install	(revision 740)
+++ /trunk/packages/sipb-xen-guest-installer/files/usr/sbin/sipb-xen-install	(revision 741)
@@ -1,5 +1,5 @@
-#!/bin/sh
+#!/bin/bash
 
-export PATH #WTF?
+export PATH
 
 HOSTNAME="$2"
@@ -9,33 +9,14 @@
 IP="$6"
 
-ARCH=amd64
+VOLUME=/dev/mapper/xenvg-d_${HOSTNAME}_hda
 
-#LVSIZE=`lvs --noheadings --units M --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'`
+cat > $VOLUME <<EOF
+HOSTNAME=$HOSTNAME
+DIST=$DIST
+MIRROR=$MIRROR
+IMAGESIZE=$IMAGESIZE
+IP=$IP
+return
+EOF
 
-if [ -z "$IP" ]; then
-    IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1`
-fi
-
-VOLUME=/dev/mapper/xenvg-d_$(echo "$HOSTNAME" | sed -e 's/-/--/g')_hda
-
-# If this script is interrupted, it may not clean up after itself.
-# In particular, it may leave ${VOLUME}1 mounted somewhere in tmp.
-# Unmount it, then kpartx -d $VOLUME to clean up.
-
-###
-###  Create the device for SIPB-Xen purposes
-###
-echo ,${IMAGESIZE}$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 $VOLUME
-kpartx -a $VOLUME
-
-# We use static IP addresses since dhcp doesn't work in paravm because
-# of a UDP checksum bug.
-
-xen-create-image --image-dev ${VOLUME}1 --swap-dev ${VOLUME}2 --fs ext3 --ide --arch $ARCH --dist $DIST --hostname $HOSTNAME --mirror $MIRROR --ip=$IP --netmask=255.255.0.0 --gateway=18.181.0.1 --template=/dev/null --cache
-
-# xen-create-image always creates a config file.  The
-# --template=/dev/null argument makes it empty, but it still should be
-# removed.
-rm -f /etc/xen/$HOSTNAME.cfg
-
-kpartx -d $VOLUME
+xm create autoinstall.cfg target=$HOSTNAME guestip=$IP
