summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorOliver Tappe2007-05-13 19:22:27 +0200
committerOliver Tappe2007-05-13 19:22:27 +0200
commit304e8df5559677ff57d39f9091f5b00925334c8b (patch)
tree26df61c0812551b7c47530df8bc1a7dff15f0492 /installer
parentMake mkdxsinitrd able to follow symlinks in kernel module directory (diff)
downloadcore-304e8df5559677ff57d39f9091f5b00925334c8b.tar.gz
core-304e8df5559677ff57d39f9091f5b00925334c8b.tar.xz
core-304e8df5559677ff57d39f9091f5b00925334c8b.zip
* added utility function followLink() and made use of it
* reworked search for required kernel modules to be able to return the matching paths to the caller (not currently used though) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1069 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
-rw-r--r--installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm39
1 files changed, 24 insertions, 15 deletions
diff --git a/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm b/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm
index d5782b59..a581bfcc 100644
--- a/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm
+++ b/installer/OpenSLX/OSExport/ExportType/NBD_Squash.pm
@@ -23,6 +23,7 @@ use File::Basename;
use OpenSLX::Basics;
use OpenSLX::ConfigDB qw(:support);
use OpenSLX::OSExport::ExportType::Base 1.01;
+use OpenSLX::Utils;
################################################################################
### interface methods
@@ -68,34 +69,38 @@ sub checkRequirements
my $self = shift;
my $vendorOSPath = shift;
my $kernel = shift || 'vmlinuz';
+ my $info = shift;
- while (-l "$vendorOSPath/boot/$kernel") {
- $kernel = readlink "$vendorOSPath/boot/$kernel";
- }
- if ($kernel !~ m[^vmlinuz-(.+)$]) {
+ $kernel = basename(followLink("$vendorOSPath/boot/$kernel"));
+ if ($kernel !~ m[-(.+)$]) {
die _tr("unable to determine version of kernel '%s'!", $kernel);
}
my $kernelVer = $1;
- if (!locateKernelModule(
+ my $nbdMod = locateKernelModule(
$vendorOSPath,
'nbd.ko',
- ["$vendorOSPath/lib/modules/$kernelVer/kernel/drivers/block"])
- ) {
+ ["$vendorOSPath/lib/modules/$kernelVer/kernel/drivers/block"]
+ );
+ if (!defined $nbdMod) {
warn _tr("unable to find nbd-module for kernel version '%s'.",
$kernelVer);
- return 0;
+ return undef;
}
- if (!locateKernelModule(
+ my $squashfsMod = locateKernelModule(
$vendorOSPath,
'squashfs.ko',
["$vendorOSPath/lib/modules/$kernelVer/kernel/fs/squashfs",
- "$vendorOSPath/lib/modules/$kernelVer/kernel/fs"])
- ) {
+ "$vendorOSPath/lib/modules/$kernelVer/kernel/fs"]
+ );
+ if (!defined $squashfsMod) {
warn _tr("unable to find squashfs-module for kernel version '%s'.",
$kernelVer);
- return 0;
+ return undef;
}
- 1;
+ if (defined $info) {
+ $info->{'kernel-mods'} = [ $nbdMod, $squashfsMod ];
+ };
+ return 1;
}
sub addExportToConfigDB
@@ -232,7 +237,8 @@ sub locateKernelModule
# check default paths first:
foreach my $defPath (@$defaultPaths) {
vlog 2, "trying $defPath/$moduleName";
- return "$defPath/$moduleName" if -e "$defPath/$moduleName";
+ my $target = followLink("$defPath/$moduleName", $vendorOSPath);
+ return $target unless !-e $target;
}
# use brute force to search for the newest incarnation of the module:
use File::Find;
@@ -247,7 +253,10 @@ sub locateKernelModule
vlog 2, "located at $location (age=$locationAge days)";
}
}, "$vendorOSPath/lib/modules";
- return $location;
+ if (defined $location) {
+ return followLink($location, $vendorOSPath);
+ }
+ return undef;
}
1;