diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-07 02:28:13 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-07 02:28:13 +0100 |
commit | a0e0d61f2ffa60943a396b4c390a159a518a6ad1 (patch) | |
tree | 37549683d512c3c3756c8c33aaeb9fa380ca3069 /SBO-Lib/lib/SBO/Lib.pm | |
parent | 7e32ff2bbdd632c8ba14c45ab91128c626047231 (diff) | |
download | sbotools2-a0e0d61f2ffa60943a396b4c390a159a518a6ad1.tar.xz |
Alert that a local override is being used
This fixes #13
This fixes #15
Yay, 2 fixes for the price of one commit!
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index fcd0d39..ac551a3 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -54,6 +54,7 @@ our @EXPORT_OK = qw( print_failures usage_error uniq + is_local $tempdir $conf_dir $conf_file @@ -310,6 +311,7 @@ sub get_inst_names { { # a state variable for get_sbo_location and get_sbo_locations my $store = {}; + my %local; sub get_sbo_location { exists $_[0] or script_error('get_sbo_location requires an argument.'); @@ -360,11 +362,20 @@ sub get_sbo_locations { next unless -d $loc; $$store{$sbo} = $loc; $locations{$sbo} = $loc; + $local{$sbo} = $local; } } return %locations; } + +sub is_local { + exists $_[0] or script_error('is_local requires an argument.'); + my $sbo = shift; + # Make sure we have checked for the slackbuild in question: + get_sbo_location($sbo); + return !!$local{$sbo}; +} } # pull the sbo name from a $location: $config{SBO_HOME}/system/wine, etc. @@ -1125,6 +1136,7 @@ sub user_prompt { exists $_[1] or script_error('user_prompt requires two arguments.'); my ($sbo, $location) = @_; my ($readme, $exit) = get_readme_contents($location); + if (is_local($sbo)) { print "Found $sbo in local overrides.\n\n"; $exit = 0; } return $readme, undef, $exit if $exit; # check for user/group add commands, offer to run any found my $user_group = get_user_group($readme); |