From a4ae557e2a8179f6ec8fede4f20488a0c878fc4f Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 25 Dec 2006 22:21:53 +0000 Subject: [PATCH] 2006-12-25 22:21:52 by steve Updated to install a linux package if available. See #404508 --- hooks/dapper/80-install-modules | 25 +++++++++++++++++++++---- hooks/debian/80-install-modules | 24 ++++++++++++++++++++---- hooks/edgy/80-install-modules | 25 +++++++++++++++++++++---- 3 files changed, 62 insertions(+), 12 deletions(-) diff --git a/hooks/dapper/80-install-modules b/hooks/dapper/80-install-modules index 9ea1a55..76380fe 100755 --- a/hooks/dapper/80-install-modules +++ b/hooks/dapper/80-install-modules @@ -33,11 +33,28 @@ logMessage Script $0 starting # -# Copy the modules from the host to the new system - we should only -# really copy the *correct* modules, but we don't know what they are. +# The name of the package containing the correct modules. # -mkdir -p ${prefix}/lib/modules -cp -au /lib/modules/*/ ${prefix}/lib/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} 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. diff --git a/hooks/debian/80-install-modules b/hooks/debian/80-install-modules index 9ea1a55..71e8ce1 100755 --- a/hooks/debian/80-install-modules +++ b/hooks/debian/80-install-modules @@ -33,11 +33,27 @@ logMessage Script $0 starting # -# Copy the modules from the host to the new system - we should only -# really copy the *correct* modules, but we don't know what they are. +# The name of the package containing the correct modules. # -mkdir -p ${prefix}/lib/modules -cp -au /lib/modules/*/ ${prefix}/lib/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} 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. diff --git a/hooks/edgy/80-install-modules b/hooks/edgy/80-install-modules index 9ea1a55..76380fe 100755 --- a/hooks/edgy/80-install-modules +++ b/hooks/edgy/80-install-modules @@ -33,11 +33,28 @@ logMessage Script $0 starting # -# Copy the modules from the host to the new system - we should only -# really copy the *correct* modules, but we don't know what they are. +# The name of the package containing the correct modules. # -mkdir -p ${prefix}/lib/modules -cp -au /lib/modules/*/ ${prefix}/lib/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} 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.