aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Pipkin <d4wnr4z0r@yahoo.com>2012-05-10 21:19:48 -0500
committerJacob Pipkin <d4wnr4z0r@yahoo.com>2012-05-10 21:19:48 -0500
commit89dd7c08681e81f5d7f36c642f39821dd1759b33 (patch)
treec09add389c553747109963fd8f232f2167520363
parentc40e1f35dfe8dcaaa2a4006f8f1dd59806a41334 (diff)
downloadsbotools2-89dd7c08681e81f5d7f36c642f39821dd1759b33.tar.xz
fix bug where no sbosnap fetch caused script failure
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm25
-rwxr-xr-xsbofind2
-rwxr-xr-xsboupgrade2
3 files changed, 21 insertions, 8 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index dfa0ff1..2746621 100644
--- a/SBO-Lib/lib/SBO/Lib.pm
+++ b/SBO-Lib/lib/SBO/Lib.pm
@@ -18,6 +18,7 @@ require Exporter;
show_version
get_slack_version
check_slackbuilds_txt
+ slackbuilds_or_fetch
fetch_tree
update_tree
get_installed_sbos
@@ -111,12 +112,22 @@ sub get_slack_version {
}
sub check_slackbuilds_txt {
- if (-f $slackbuilds_txt) {
- return 1;
- } else {
- print "I am unable to find SLACKBUILDS.TXT.\n";
- print "Perhaps you need to \"sbosnap fetch\"?\n";
- exit 1;
+ return 1 if -f $slackbuilds_txt;
+ return;
+}
+
+sub slackbuilds_or_fetch {
+ if (! check_slackbuilds_txt () ) {
+ print "It looks like you haven't run \"sbosnap fetch\" yet.\n";
+ print "Would you like me to do this now? [y] ";
+ my $fetch = <STDIN>;
+ $fetch = 'y' if $fetch eq "\n";
+ if ($fetch =~ /^[Yy]/) {
+ fetch_tree ();
+ } else {
+ print "Please run \"sbosnap fetch\"\n";
+ exit 0;
+ }
}
}
@@ -418,7 +429,7 @@ sub rewrite_slackbuild {
my ($slackbuild,%changes) = @_;
copy ($slackbuild,"$slackbuild.orig");
tie my @sb_file,'Tie::File',$slackbuild;
- FIRST: for (my $line = @sb_file) {
+ FIRST: for my $line (@sb_file) {
SECOND: while (my ($key,$value) = each %changes) {
if ($key eq 'arch_out') {
if (index ($line,'makepkg') != -1) {
diff --git a/sbofind b/sbofind
index 9b885b0..a1bb492 100755
--- a/sbofind
+++ b/sbofind
@@ -40,7 +40,7 @@ show_version () and exit (0) if (exists $options{v});
show_usage () and exit (1) unless exists $ARGV[0];
my $search = $ARGV[0];
-check_slackbuilds_txt ();
+slackbuilds_or_fetch ();
my (@findings,$name);
my $found = 'FALSE';
diff --git a/sboupgrade b/sboupgrade
index a41bf60..b4616b1 100755
--- a/sboupgrade
+++ b/sboupgrade
@@ -58,6 +58,8 @@ my $only_new = exists $options{o} ? 'TRUE' : 'FALSE';
show_usage () and exit (1) unless exists $ARGV[0];
+slackbuilds_or_fetch ();
+
my %locations;
for my $sbo_name (@ARGV) {