"target" is also the name used in the debian installer for the installation target while "prefix" is too ambiguous.
82 lines
1.8 KiB
Bash
Executable File
82 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Install modules from the host system into the new image, and
|
|
# ensure that 'module-init-tools' is setup.
|
|
#
|
|
# This is most likely required if you're using a custom kernel
|
|
# for your Xen system. But even if it isn't required it can't
|
|
# really do anything bad; just waste a bit of space.
|
|
#
|
|
# Steve
|
|
# --
|
|
# http://www.steve.org.uk/
|
|
|
|
|
|
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
|
|
logMessage "pygrub set, skipping module install"
|
|
else
|
|
#
|
|
# The name of the package containing the correct modules.
|
|
#
|
|
linux_modules_package="linux-modules-$(uname -r)"
|
|
|
|
#
|
|
# Attempt to install that package. This will either work on an Etch
|
|
# system, or fail on a Sarge/custom kernel.
|
|
#
|
|
if [ -n "${modules}" -a -d "${modules}" ]; then
|
|
|
|
#
|
|
# Modules path was specified during install
|
|
#
|
|
logMessage "Copying modules from ${modules}"
|
|
|
|
mkdir -p ${TARGET}/lib/modules
|
|
cp -au ${modules} ${TARGET}/lib/modules
|
|
elif chroot ${TARGET} /usr/bin/apt-cache show ${linux_modules_package} >/dev/null 2>/dev/null; then
|
|
|
|
logMessage "Package '${linux_modules_package}' is available - installing"
|
|
|
|
#
|
|
# If it worked then we can install the package.
|
|
#
|
|
installDebianPackage ${TARGET} ${linux_modules_package}
|
|
else
|
|
|
|
#
|
|
# Fall back to copying over modules from the host to the new
|
|
# system.
|
|
#
|
|
logMessage "Package '${linux_modules_package}' is not available"
|
|
logMessage "Copying modules from /lib/modules/$(uname -r)"
|
|
|
|
mkdir -p ${TARGET}/lib/modules
|
|
cp -au /lib/modules/$(uname -r) ${TARGET}/lib/modules
|
|
fi
|
|
|
|
fi # if pygrub
|
|
|
|
#
|
|
# Log our finish
|
|
#
|
|
logMessage Script $0 finished
|