From: Kamalesh B. <kam...@li...> - 2015-06-29 07:46:58
|
This patch introduce deprecated warning on SLES 12 onwards to use supportconfig. supportconfig captures all the information collected by snap, so it safe to deprecate snap. It also rearranges check for distribution (RHEL/SLES) into common function check_distro_support(). Signed-off-by: Kamalesh Babulal <kam...@li...> Cc: Vasant Hegde <heg...@li...> Cc: Nathan Fontenot <nf...@li...> --- scripts/snap | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/scripts/snap b/scripts/snap index f7bc72a..879316c 100755 --- a/scripts/snap +++ b/scripts/snap @@ -35,16 +35,36 @@ my $cmddir = "snap_commands"; # cmd output dir. my $cmdoutdir = "$outdir/$cmddir"; # in outdir dir. my $rsxx_exists = 0; # Does an IBM Flash Adapter exist? my $distro_file = "/etc/issue"; -my $redhat_release_file = "/etc/redhat-release"; - -if (-e $redhat_release_file) { - open(RELEASE, "< $redhat_release_file") or die "open: $!\n"; - $_ = <RELEASE>; - my $redhat_version = (split / /, $_)[6]; - if ($redhat_version >= 7.0) { - print "snap is not supported on the RHEL 7 onwards..!\n"; - print "Please use sosreport to collect log data..!! \n"; - exit 1; + +sub check_distro_support { + my $redhat_release_file = "/etc/redhat-release"; + my $suse_release_file = "/etc/SuSE-release"; + + if (-e $redhat_release_file) { + open(RELEASE, "< $redhat_release_file") or die "open: $!\n"; + $_ = <RELEASE>; + my $redhat_version = (split / /, $_)[6]; + if ($redhat_version >= 7.0) { + print "snap is not supported on the RHEL 7 onwards..!\n"; + print "Please use sosreport to collect log data..!! \n"; + close(RELEASE); + exit 1; + } + close(RELEASE); + } elsif (-e $suse_release_file) { + open(RELEASE, "< $suse_release_file") or die "open: $!\n"; + while(<RELEASE>) { + if ($_ =~ /VERSION/) { + my $suse_version = (split /=/, $_)[1]; + if ($suse_version >= 12) { + print "snap is deprecated from SLES 12 onwards..!\n"; + print "Please use supportconfig to collect log data..!! \n"; + close(RELEASE); + exit 1; + } + } # if + } # while + close(RELEASE); } } @@ -333,6 +353,9 @@ sub snap_commands { $< == 0 or error(1, "Must be executed as root"); +#check for the distro version +check_distro_support(); + my $perldumpenv='perl -MData::Dumper -e '."'". '\$Data::Dumper::Terse=1;print Dumper(\%ENV);'."'"; -- 2.1.2 |