Index: trunk/packages/sipb-xen-autoinstaller/common/usr/sbin/sipb-xen-create-image
===================================================================
--- trunk/packages/sipb-xen-autoinstaller/common/usr/sbin/sipb-xen-create-image	(revision 930)
+++ trunk/packages/sipb-xen-autoinstaller/common/usr/sbin/sipb-xen-create-image	(revision 931)
@@ -8,7 +8,11 @@
 echo ,"${IMAGESIZE}"$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 "$TARGET"
 
+kpartx -a "$TARGET"    # should be no-op in guest
+
 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
 
+kpartx -d $VOLUME
+
 exit 0
Index: trunk/packages/sipb-xen-autoinstaller/debian/changelog
===================================================================
--- trunk/packages/sipb-xen-autoinstaller/debian/changelog	(revision 930)
+++ trunk/packages/sipb-xen-autoinstaller/debian/changelog	(revision 931)
@@ -1,9 +1,9 @@
 sipb-xen-autoinstaller (2.5) unstable; urgency=low
 
-  * Add sipb-xen-autoinstaller-host binary package, to contain
-    autoinstaller for system VMs
+  * Add sipb-xen-autoinstaller-host binary package
   * Put common files in both binary packages
+  * Add beginnings of an installer script in -host package
 
- -- Greg Price <price@mit.edu>  Sun, 28 Sep 2008 16:36:56 -0400
+ -- Greg Price <price@mit.edu>  Sun, 28 Sep 2008 17:07:51 -0400
 
 sipb-xen-autoinstaller (2.4) unstable; urgency=low
Index: trunk/packages/sipb-xen-autoinstaller/host/usr/sbin/sipb-xen-install
===================================================================
--- trunk/packages/sipb-xen-autoinstaller/host/usr/sbin/sipb-xen-install	(revision 931)
+++ trunk/packages/sipb-xen-autoinstaller/host/usr/sbin/sipb-xen-install	(revision 931)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# If this script is interrupted, it may not clean up after itself.
+# In particular, it may leave ${TARGET}1 mounted somewhere in tmp.
+# Unmount it, then kpartx -d $TARGET to clean up.
+
+export PATH #WTF?
+
+export HOSTNAME="$2"
+export DIST="$3"
+export MIRROR="$4"
+export IMAGESIZE="$5"
+export IP="$6"
+
+export ARCH=amd64
+
+#LVSIZE=`lvs --noheadings --units M --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'`
+
+if [ -z "$IP" ]; then
+    IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1`
+fi
+
+export TARGET=/dev/mapper/xenvg-d_$(echo "$HOSTNAME" | sed -e 's/-/--/g')_hda
+
+/usr/sbin/sipb-xen-create-image
+
