1
0
mirror of synced 2026-02-17 04:27:02 +00:00
Files
xen-tools.xen-tools/hooks/karmic/80-install-kernel
Axel Beckert cc2a6d4e41 Change all occurrences of $prefix in hooks and roles with $TARGET
"target" is also the name used in the debian installer for the
installation target while "prefix" is too ambiguous.
2013-04-18 21:01:19 +02:00

77 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
#
# If the pygrub flag is set, this script will install the necessary
# packages to boot the VM from the dom0 via pygrub. This script installs
# the kernel and modules and generates a grub menu.lst in the newly
# created maschine.
#
# Dmitry Nedospasov
# --
# http://nedos.net
TARGET=$1
#
# Source our common functions
#
if [ -e /usr/share/xen-tools/common.sh ]; then
. /usr/share/xen-tools/common.sh
else
. ./hooks/common.sh
fi
#
# Log our start
#
logMessage Script $0 starting
if [ "${pygrub}" ]; then
#
# The type of kernel that we will be installing
#
# linux_kernel_type="desktop"
#
linux_kernel_type="virtual"
linux_kernel_package="linux-image-${linux_kernel_type}"
logMessage "Installing the ${linux_kernel_package} kernel image"
if chroot ${TARGET} /usr/bin/apt-cache show ${linux_kernel_package} >/dev/null 2>/dev/null; then
logMessage "Package '${linux_kernel_package}' is available - installing"
installDebianPackage ${TARGET} initramfs-tools
installDebianPackage ${TARGET} ${linux_kernel_package}
# Force initrd if none exists
echo ${TARGET}/boot/initrd* | grep -q 2\\.6
if [ $? -ne 0 ]; then
chroot ${TARGET} update-initramfs -c -k `ls -1 ${TARGET}/lib/modules/ | head -n 1`
fi
# Generate grub menu.lst
DOMU_KERNEL=$(basename $(ls -1 ${TARGET}/boot/vmlinuz* | tail -n 1))
DOMU_RAMDISK=$(basename $(ls -1 ${TARGET}/boot/initrd*|tail -n 1))
DOMU_ISSUE=$(head -n 1 ${TARGET}/etc/issue | awk -F '\' '{ print $1 }' | sed 's/[ \t]*$//')
#
# Generate a menu.lst for pygrub
#
generateDebianGrubMenuLst "${TARGET}" "$DOMU_ISSUE" "$DOMU_KERNEL" "$DOMU_RAMDISK"
else
logMessage "Package '${linux_kernel_package}' is not available"
fi
else
logMessage pygrub not set, skipping kernel install
fi # if pygrub
#
# Log our finish
#
logMessage Script $0 finished