1
0
mirror of synced 2026-02-26 00:03:55 +00:00
Files
xen-tools.xen-tools/hooks/dapper/80-install-modules
steve d7c814c7eb 2006-12-25 22:32:04 by steve
apt-cache -> /usr/bin/apt-cache
2006-12-25 22:32:08 +00:00

69 lines
1.3 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/
prefix=$1
#
# Source our common functions
#
if [ -e /usr/lib/xen-tools/common.sh ]; then
. /usr/lib/xen-tools/common.sh
else
. ./hooks/common.sh
fi
#
# Log our start
#
logMessage Script $0 starting
#
# 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 chroot ${prefix} /usr/bin/apt-cache policy ${linux_modules_package} 2>/dev/null; then
#
# If it worked then we can install the package.
#
installDebianPackage ${prefix} ${linux_modules_package}
else
#
# Fall back to copying over modules from the host to the new
# system.
mkdir -p ${prefix}/lib/modules
cp -au /lib/modules/$(uname -r) ${prefix}/lib/modules
fi
#
# Install the module-init-tools package.
#
installDebianPackage ${prefix} module-init-tools
#
# Log our finish
#
logMessage Script $0 finished