source: trunk/packages/invirt-autoinstaller/common/usr/lib/xen-tools/debian.d/93-setup-grub @ 2333

Last change on this file since 2333 was 2333, checked in by broder, 15 years ago

In invirt-autoinstaller:

  • Create the shell of a menu.lst file needed to successfully parse indomU=true out of it.
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/bin/sh
2#
3#  This script sets up the ParaVM to use pygrub
4#
5
6prefix=$1
7
8#
9#  Source our common functions
10#
11if [ -e /usr/lib/xen-tools/common.sh ]; then
12    . /usr/lib/xen-tools/common.sh
13else
14    . ./hooks/common.sh
15fi
16
17echo SCRIPT = $0
18dir=`dirname "$0"`
19
20
21logMessage Script $0 starting
22
23#
24# Install the xen kernel.  linux-image-xen is in ubuntu,
25# linux-image-xen-{amd64,686} in debian.
26#
27
28installDebianPackage ${prefix} lsb-release
29
30if [ "$(chroot ${prefix} lsb_release -is)" = "Ubuntu" ]; then
31    if dpkg --compare-versions "$(chroot ${prefix} lsb_release -rs)" ge 8.10; then
32        installDebianPackage ${prefix} linux-image-virtual
33    else
34        installDebianPackage ${prefix} linux-image-xen
35    fi
36else
37    installDebianPackage ${prefix} linux-image-xen-amd64
38    installDebianPackage ${prefix} linux-image-xen-686
39fi
40
41installDebianPackage ${prefix} grub
42
43#
44# Make the /boot/grub directory
45#
46mkdir -p ${prefix}/boot/grub
47
48#
49# Create stock menu.lst
50#
51chroot ${prefix} /usr/sbin/update-grub -y
52
53#
54# Patches to add xen kernels, use serial console, etc.
55#
56for patch in $dir/patches/*; do
57    patch -l -d ${prefix} -p1 < $patch
58done
59
60#
61# If this is a pv_ops kernel, then we need to make some more changes
62# to make the console work right
63#
64if [ "$(chroot ${prefix} lsb_release -is)" = "Ubuntu" ] && \
65    dpkg --compare-versions "$(chroot ${prefix} lsb_release -rs)" ge 8.10; then
66    sed -i -e 's/xvc0/hvc0/' /etc/event.d/tty1
67    sed -i -e 's/console=ttyS0[^ ]*/console=hvc0/' /boot/grub/menu.lst
68fi
69
70#
71# If this is a Jaunty machine, the fix from LP #291256 caused our
72# patch to update-grub to not work, so let's use that mechanism
73# instead.
74#
75# Since we haven't run update-grub yet, we need to generate the
76# skeleton of a Debian menu.lst so that update-grub extracts the
77# options correctly
78#
79cat >/boot/grub/menu.lst <<EOF
80### BEGIN AUTOMAGIC KERNELS LIST
81## ## Start Default Options ##
82# indomU=true
83## ## End Default Options ##
84### END DEBIAN AUTOMAGIC KERNELS LIST
85EOF
86sed -i -e 's/indomU=detect/indomU=true/' /boot/grub/menu.lst
87
88#
89# Regenerate automagic kernels list
90#
91chroot ${prefix} /usr/sbin/update-grub -y
92
93#
94# Log our finish
95#
96logMessage Script $0 finished
97
Note: See TracBrowser for help on using the repository browser.