sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit 64106e37b4220a24b57f98bea7306ee3c46822f2
parent e4b0c80cdf40d26ceb865fbeabaa2ae293720ca3
Author: Jacob Pipkin <j@dawnrazor.net>
Date:   Wed,  4 Jul 2012 13:57:45 -0500

modified how handle slack version, reduced code and more future-proof, much better overall

Diffstat:
MSBO-Lib/lib/SBO/Lib.pm | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm @@ -102,15 +102,19 @@ sub show_version { print "<http://sam.zoy.org/wtfpl/COPYING>\n"; } +# %supported maps what's in /etc/slackware-version to what's at SBo sub get_slack_version { + my %supported = ( + 13.37.0 => '13.37', + 14.0 => '13.37', + ); my $fh = open_read ('/etc/slackware-version'); chomp (my $line = <$fh>); close $fh; my $version = ($line =~ /\s+(\d+[^\s]+)$/)[0]; - my $ret_ver; - $ret_ver = '13.37' if ($version eq '13.37.0' || $version eq '14.0'); - $ret_ver eq '13.37' or die "Unsupported Slackware version: $version\n"; - return $ret_ver; + die "Unsupported Slackware version: $version\n" + unless $version ~~ %supported; + return $supported{$version}; } sub check_slackbuilds_txt {