[641] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # This script sets up the ParaVM to use pygrub |
---|
| 4 | # |
---|
| 5 | |
---|
| 6 | prefix=$1 |
---|
| 7 | |
---|
| 8 | # |
---|
| 9 | # Source our common functions |
---|
| 10 | # |
---|
| 11 | if [ -e /usr/lib/xen-tools/common.sh ]; then |
---|
| 12 | . /usr/lib/xen-tools/common.sh |
---|
| 13 | else |
---|
| 14 | . ./hooks/common.sh |
---|
| 15 | fi |
---|
| 16 | |
---|
| 17 | echo SCRIPT = $0 |
---|
| 18 | dir=`dirname "$0"` |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | logMessage Script $0 starting |
---|
| 22 | |
---|
| 23 | # |
---|
| 24 | # Install the xen kernel. linux-image-xen is in ubuntu, |
---|
[1719] | 25 | # linux-image-xen-{amd64,686} in debian. |
---|
| 26 | # |
---|
[641] | 27 | |
---|
[1719] | 28 | # First we need to figure out whether we're dealing with Debian or |
---|
| 29 | # Ubuntu. Unfortunately, Debian doesn't install lsb_release by |
---|
| 30 | # default, and its lsb-release package Recommends a bunch of stuff |
---|
| 31 | installDebianPackage ${prefix} -o="Apt::Install-Recommends=false" lsb-release |
---|
| 32 | if [ "Debian" = "$(chroot ${prefix} lsb_release -si)" ]; then |
---|
| 33 | # One of these exists in the amd64 repo, and one of them exists in |
---|
| 34 | # the i386 repo. The one that doesn't exist won't get installed |
---|
| 35 | installDebianPackage ${prefix} linux-image-xen-amd64 |
---|
| 36 | installDebianPackage ${prefix} linux-image-xen-686 |
---|
| 37 | else |
---|
| 38 | installDebianPackage ${prefix} linux-image-xen |
---|
| 39 | fi |
---|
| 40 | |
---|
[641] | 41 | installDebianPackage ${prefix} grub |
---|
| 42 | |
---|
| 43 | # |
---|
| 44 | # Make the /boot/grub directory |
---|
| 45 | # |
---|
| 46 | mkdir -p ${prefix}/boot/grub |
---|
| 47 | |
---|
| 48 | # |
---|
| 49 | # Create stock menu.lst |
---|
| 50 | # |
---|
| 51 | chroot ${prefix} /usr/sbin/update-grub -y |
---|
| 52 | |
---|
| 53 | # |
---|
| 54 | # Patches to add xen kernels, use serial console, etc. |
---|
| 55 | # |
---|
| 56 | for patch in $dir/patches/*; do |
---|
| 57 | patch -l -d ${prefix} -p1 < $patch |
---|
| 58 | done |
---|
| 59 | |
---|
| 60 | # |
---|
| 61 | # Regenerate automagic kernels list |
---|
| 62 | # |
---|
| 63 | chroot ${prefix} /usr/sbin/update-grub -y |
---|
| 64 | |
---|
| 65 | # |
---|
| 66 | # Log our finish |
---|
| 67 | # |
---|
| 68 | logMessage Script $0 finished |
---|
| 69 | |
---|