From aaa6317e034bb503e855c9d2272a7759419d8f59 Mon Sep 17 00:00:00 2001 From: phamt Date: Tue, 17 Aug 2010 23:35:09 +0000 Subject: [PATCH] Handle case where the Linux distro copied is sles[xxx]sp[yyy] (e.g. sles11sp1), where xxx is the version and yyy is the service pack. In the case above, the genimage command will not recognize the Linux distro and give an error. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7115 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/genimage | 6 ++++++ xCAT-server/share/xcat/netboot/imgutils/imgutils.pm | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index 313ecc391..7684b603a 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -161,6 +161,12 @@ if($osfamily =~ /rh/){ $osfamily = "rh"; } +# OS version on s390x can contain 'sp', e.g. sles11sp1 +# If the $osfamily contains 'sles' and 'sp', the $osfamily = sles +if ($osfamily =~ /sles/ && $osfamily =~ /sp/) { + $osfamily = "sles"; +} + #print "OSfamily: $osfamily\n"; $profDir = "$::XCATROOT/share/xcat/netboot/$osfamily"; unless(-d $profDir){ diff --git a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm index fcaeec6b7..396f0ad16 100644 --- a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm +++ b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm @@ -16,7 +16,17 @@ sub get_profile_def_filename { my $base=shift; my $ext=shift; - my $dotpos = rindex($osver, "."); + + my $dotpos; + + # OS version on s390x can contain 'sp', e.g. sles11sp1 + # If OS version contains 'sp', get the index of 'sp' instead of '.' + if ($osver =~ /sles/ && $osver =~ /sp/) { + $dotpos = rindex($osver, "sp"); + } else { + $dotpos = rindex($osver, "."); + } + my $osbase = substr($osver, 0, $dotpos); if (-r "$base/$profile.$osver.$arch.$ext") { return "$base/$profile.$osver.$arch.$ext";