+#!/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 </usr/lib/xen-tools/etch.d/patches/update-grub.patch
+
+#
+# Update Grub
+#
+chroot ${prefix} /usr/sbin/update-grub -y
+
+#
+# Patch Grub menu
+#
+patch -l ${prefix}/boot/grub/menu.lst </usr/lib/xen-tools/etch.d/patches/menu.lst.patch
+# --- menu.lst.orig2008-04-22 05:41:32.000000000 -0400
+# +++ menu.lst2008-04-22 05:42:15.000000000 -0400
+# @@ -59,7 +59,7 @@
+# ## e.g. kopt=root=/dev/hda1 ro
+# ## kopt_2_6_8=root=/dev/hdc1 ro
+# ## kopt_2_6_8_2_686=root=/dev/hdc2 ro
+# -# kopt=root=/dev/hda1 ro
+# +# kopt=root=/dev/hda1 ro console=ttyS0,9600,8n1
+
+# ## default grub root device
+# ## e.g. groot=(hd0,0)
+# EOF
+
+#
+# Patch inittab
+#
+patch -l ${prefix}/etc/inittab </usr/lib/xen-tools/etch.d/patches/inittab.patch
+# --- inittab.orig2008-04-22 05:42:50.000000000 -0400
+# +++ inittab2008-04-22 05:43:04.000000000 -0400
+# @@ -60,7 +60,7 @@
+
+# # Example how to put a getty on a serial line (for a terminal)
+# #
+# -#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
+# +T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
+# #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
+
+# # Example how to put a getty on a modem line.
+# EOF
+
+#
+# Log our finish
+#
+logMessage Script $0 finished
+