diff options
author | Oliver Tappe | 2007-05-01 13:48:13 +0200 |
---|---|---|
committer | Oliver Tappe | 2007-05-01 13:48:13 +0200 |
commit | 2bed3b5796d1304ee05f3bad3ca1578597882705 (patch) | |
tree | 901b8835beee1f06dabac12c759e4751bfa8544b /installer | |
parent | * improved error handling during installation and execution in case the DB-mo... (diff) | |
download | core-2bed3b5796d1304ee05f3bad3ca1578597882705.tar.gz core-2bed3b5796d1304ee05f3bad3ca1578597882705.tar.xz core-2bed3b5796d1304ee05f3bad3ca1578597882705.zip |
* improved mechanism used for locating the required kernel modules such that it correctly
handles the case of a module being linked into a newer kernel via weak-update.
Closes ticket #119.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@972 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
-rw-r--r-- | installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm b/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm index 85b72b05..3d2d10fa 100644 --- a/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm +++ b/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm @@ -76,12 +76,21 @@ sub checkRequirements die _tr("unable to determine version of kernel '%s'!", $kernel); } my $kernelVer = $1; - if (!-e "$vendorOSPath/lib/modules/$kernelVer/kernel/drivers/block/nbd.ko") { + if (!locateKernelModule( + $vendorOSPath, + 'nbd.ko', + ["$vendorOSPath/lib/modules/$kernelVer/kernel/drivers/block"]) + ) { warn _tr("unable to find nbd-module for kernel version '%s'.", $kernelVer); return 0; } - if (!-e "$vendorOSPath/lib/modules/$kernelVer/kernel/fs/squashfs.ko") { + if (!locateKernelModule( + $vendorOSPath, + 'squashfs.ko', + ["$vendorOSPath/lib/modules/$kernelVer/kernel/fs/squashfs", + "$vendorOSPath/lib/modules/$kernelVer/kernel/fs"]) + ) { warn _tr("unable to find squashfs-module for kernel version '%s'.", $kernelVer); return 0; @@ -178,4 +187,32 @@ sub mapRsyncFilter2Regex split "\n", shift; } +sub locateKernelModule +{ + my $vendorOSPath = shift; + my $moduleName = shift; + my $defaultPaths = shift; + + vlog 1, _tr("locating kernel-module '%s'", $moduleName); + # check default paths first: + foreach my $defPath (@$defaultPaths) { + vlog 2, "trying $defPath/$moduleName"; + return "$defPath/$moduleName" if -e "$defPath/$moduleName"; + } + # use brute force to search for the newest incarnation of the module: + use File::Find; + my $location; + my $locationAge = 9999999; + vlog 2, "searching in $vendorOSPath/lib/modules"; + find sub { + return unless $_ eq $moduleName; + if (-M _ < $locationAge) { + $locationAge = -M _; + $location = $File::Find::name; + vlog 2, "located at $location (age=$locationAge days)"; + } + }, "$vendorOSPath/lib/modules"; + return $location; +} + 1; |