-Change kernelver 'guess' to be based on /lib/modules content relative to the image first, then uname -r

-Allow -a again to override arch (for x86 builds on x86_64)


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1349 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-05-12 15:45:49 +00:00
parent cdc0e1e4c3
commit 82a04afe06

View File

@ -29,11 +29,12 @@ if ($name =~ /geninitrd/) {
}
my $rootlimit;
my $tmplimit;
my $kernelver = `uname -r`;
my $basekernelver = $kernelver;
my $installroot = "/install";
my $kernelver = ""; #`uname -r`;
my $basekernelver; # = $kernelver;
GetOptions(
#'a=s' => \$architecture,
'a=s' => \$arch,
'p=s' => \$profile,
'o=s' => \$osver,
'n=s' => \$netdriver,
@ -43,6 +44,21 @@ GetOptions(
't=s' => \$tmplimit,
'k=s' => \$kernelver
);
#Default to the first kernel found in the install image if nothing specified explicitly.
#A more accurate guess than whatever the image build server happens to be running
#If specified, that takes precedence.
#if image has one, that is used
#if all else fails, resort to uname -r like this script did before
my @KVERS= <$installroot/netboot/$osver/$arch/$profile/rootimg/lib/modules/*>;
if (scalar(@KVERS)) {
$basekernelver = basename($KVERS[0]);
}
unless ($basekernelver) {
$basekernelver = `uname -r`;
}
unless ($kernelver) {
$kernelver=$basekernelver;
}
chomp($kernelver);
unless ($osver and $profile and $netdriver and $prinic) {
print 'Usage: genimage -i <nodebootif> -n <nodenetdrivers> [-r <otherifaces>] -o <OSVER> -p <PROFILE> -k <KERNELVER>'."\n";
@ -62,7 +78,6 @@ foreach (split /,/,$netdriver) {
push @ndrivers,$_;
}
my $installroot = "/install";
unless ($onlyinitrd) {
my $srcdir = "$installroot/$osver/$arch";
@yumdirs=();