diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-07-04 13:57:45 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-07-04 13:57:45 -0500 |
commit | 64106e37b4220a24b57f98bea7306ee3c46822f2 (patch) | |
tree | 464faf374b60e8bb5d50ea301702633b8bb42ca0 /SBO-Lib/lib | |
parent | e4b0c80cdf40d26ceb865fbeabaa2ae293720ca3 (diff) | |
download | sbotools2-64106e37b4220a24b57f98bea7306ee3c46822f2.tar.xz |
modified how handle slack version, reduced code and more future-proof, much better overall
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 58e6391..0004dca 100644 --- 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 { |