From 0d0b6587c5d55462ed4fcae062e492f1cd8cf594 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Sun, 28 Sep 2008 17:11:53 -0400 Subject: [PATCH] first cut at on-host installer svn path=/trunk/packages/sipb-xen-autoinstaller/; revision=931 --- common/usr/sbin/sipb-xen-create-image | 4 ++++ debian/changelog | 6 +++--- host/usr/sbin/sipb-xen-install | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 host/usr/sbin/sipb-xen-install diff --git a/common/usr/sbin/sipb-xen-create-image b/common/usr/sbin/sipb-xen-create-image index f0f685a..ffba79d 100644 --- a/common/usr/sbin/sipb-xen-create-image +++ b/common/usr/sbin/sipb-xen-create-image @@ -7,8 +7,12 @@ 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 diff --git a/debian/changelog b/debian/changelog index 9d6492a..d8000a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ 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 Sun, 28 Sep 2008 16:36:56 -0400 + -- Greg Price Sun, 28 Sep 2008 17:07:51 -0400 sipb-xen-autoinstaller (2.4) unstable; urgency=low diff --git a/host/usr/sbin/sipb-xen-install b/host/usr/sbin/sipb-xen-install new file mode 100644 index 0000000..b7d9c66 --- /dev/null +++ b/host/usr/sbin/sipb-xen-install @@ -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 + -- 1.7.9.5