From: Tao Ben Schardl Date: Sun, 4 May 2008 07:52:53 +0000 (-0400) Subject: xen-create-image frobbing for deboostrap-commands X-Git-Tag: sipb-xen-guest-installer/1.2~3 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-autoinstaller.git/commitdiff_plain/14f8989ad3bf29df30aa6f325fe925f44345f4ae xen-create-image frobbing for deboostrap-commands svn path=/trunk/packages/sipb-xen-guest-installer/; revision=496 --- diff --git a/partial/xen-create-image-mods/90-make-fstab b/partial/xen-create-image-mods/90-make-fstab new file mode 100755 index 0000000..fca0527 --- /dev/null +++ b/partial/xen-create-image-mods/90-make-fstab @@ -0,0 +1,95 @@ +#!/bin/sh +# +# This script is responsible for setting up /etc/fstab upon the +# new instance. +# +# This should be a simple job, but it is complicated by some of the +# differences between filesystems - some root filesystems will require +# the installation of new packages, and we have to handle that here. +# +# Steve +# -- +# http://www.steve.org.uk/ + +prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Make sure we use ide style device names if required +# +device=sda +if [ "${ide}" ]; then + device=hda +fi + +# +# Now we have the options we can create the fstab. +# +has_xfs=0 +has_reiserfs=0 +cat < ${prefix}/etc/fstab +# /etc/fstab: static file system information. +# +# +proc /proc proc defaults 0 0 +E_O_FSTAB +for part in `seq 1 ${NUMPARTITIONS}`; do + eval "PARTITION=\"\${PARTITION${part}}\"" + OLDIFS="${IFS}" + IFS=: + x=0 + for partdata in ${PARTITION}; do + eval "partdata${x}=\"${partdata}\"" + x=$(( $x+1 )) + done + IFS="${OLDIFS}" + + case "${partdata2}" in + xfs) + has_xfs=1 + ;; + reiserfs) + has_reiserfs=1 + ;; + esac + + # This assumes a particular partition table for our ParaVM's (SIPB) + if [ "${partdata2}" = "swap" ]; then + echo "/dev/${device}2 none swap sw 0 0" >> ${prefix}/etc/fstab + else + echo "/dev/${device}1 ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab + fi +done + + +# +# Finally we can install any required packages for the given root +# filesystem +# +if [ $has_xfs -eq 1 ]; then + installDebianPackage ${prefix} xfsprogs +fi +if [ $has_reiserfs -eq 1 ]; then + installDebianPackage ${prefix} reiserfsprogs +fi + + +# +# Log our finish +# +logMessage Script $0 finished diff --git a/partial/xen-create-image-mods/97-setup-grub b/partial/xen-create-image-mods/97-setup-grub new file mode 100755 index 0000000..f01ebec --- /dev/null +++ b/partial/xen-create-image-mods/97-setup-grub @@ -0,0 +1,88 @@ +#!/bin/sh +# +# This script sets up the ParaVM to use pygrub +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + +# +# Install the xen kernel +# +installDebianPackage ${prefix} linux-image-xen-amd64 + +# +# Install grub package +# +installDebianPackage ${prefix} grub + +# +# Make the /boot/grub directory +# +mkdir -p ${prefix}/boot/grub + +# +# Patch update-grub to see xen kernels +# +patch -l ${prefix}/usr/sbin/update-grub