#!/bin/sh # # Configure the new image to be suitable for booting via pygrub # # Wejn # -- # http://wejn.org/ # prefix=$1 # # Source our common functions - this will let us install a Debian package. # if [ -e /usr/lib/xen-tools/common.sh ]; then . /usr/lib/xen-tools/common.sh else echo "Installation problem" fi # # Update APT lists. # chroot ${prefix} /usr/bin/apt-get update # # Install the packages # set -e installDebianPackage ${prefix} perl installDebianPackage ${prefix} libklibc installDebianPackage ${prefix} klibc-utils installDebianPackage ${prefix} initramfs-tools installDebianPackage ${prefix} linux-image-2.6-xen-amd64 # Force initrd if none exists echo ${prefix}/boot/initrd* | grep -q 2\\.6 if [ $? -ne 0 ]; then chroot ${prefix} update-initramfs -c -k `ls -1 ${prefix}/lib/modules/ | head -n 1` fi # Generate grub menu.lst LNZ=`basename \`ls -1 ${prefix}/boot/vmlinuz*|tail -n 1\`` RD=`basename \`ls -1 ${prefix}/boot/initrd*|tail -n 1\`` mkdir -p ${prefix}/boot/grub cat - <<-EOF > ${prefix}/boot/grub/menu.lst default 0 timeout 5 title Debian root (hd0,0) kernel /boot/$LNZ root=/dev/xvda2 ro initrd /boot/$RD EOF