diff --git a/xCAT-client/pods/man1/genimage.1.pod b/xCAT-client/pods/man1/genimage.1.pod index 9a65efa24..d297e6edd 100644 --- a/xCAT-client/pods/man1/genimage.1.pod +++ b/xCAT-client/pods/man1/genimage.1.pod @@ -132,7 +132,7 @@ in the install image. =item B<-g> I -This flag is for SLES only. Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES. +Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES. Generally, the value of -g is the part after B and before B<.rpm> in a kernel rpm name. =item B<-m> statelite diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 9108dec90..e2e3bb08a 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -270,14 +270,6 @@ sub process_request { return 1; } - if ($krpmver) { - if ($osfamily ne "sles") { - $krpmver=""; - $callback->({error=>["-g flag is valid for Sles only."],errorcode=>[1]}); - return 1; - } - } - my $cmd="cd $profDir; ./genimage"; if ($arch) { $cmd .= " -a $arch";} if ($osver) { $cmd .= " -o $osver";} diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 6b75afe34..a4c232542 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -48,6 +48,7 @@ my $tmplimit; my $installroot = "/install"; my $kerneldir; my $kernelver = ""; #`uname -r`; +my $krpmver; my $basekernelver; # = $kernelver; my $customdir=$fullpath; $customdir =~ s/.*share\/xcat/$installroot\/custom/; @@ -80,6 +81,7 @@ GetOptions( 'l=s' => \$rootlimit, 't=s' => \$tmplimit, 'k=s' => \$kernelver, + 'g=s' => \$krpmver, 'permission=s' => \$permission, 'kerneldir=s' => \$kerneldir, 'tempfile=s' =>\$tempfile, #internal flag @@ -266,16 +268,19 @@ unless ($onlyinitrd) { # replace the kernel package with the name has the specific version foreach my $p (@$pa) { if ($p =~ /^kernel$/ && $kernelver) { - my $kernelname = "kernel-".$kernelver; + my $kernelname; + if ($krpmver) { + $kernelname = "kernel-".$krpmver; + } else { + $kernelname = "kernel-".$kernelver; + } my $searchkern = $yumcmd . " list $kernelname -q"; my @kernpkgs = `$searchkern`; my $found = 0; foreach my $k (@kernpkgs) { if ($k =~ /\s*kernel[^\s]*\s+([\w\.-]+)/) { my $version = $1; - my $relversion = $kernelver; - $relversion =~ s/\.[^\.]+$//; - if ($version == $relversion) { + if ($kernelver =~ /$version/) { $found++; } }