aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib/SBO
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 /SBO-Lib/lib/SBO
parentc40e1f35dfe8dcaaa2a4006f8f1dd59806a41334 (diff)
downloadsbotools2-89dd7c08681e81f5d7f36c642f39821dd1759b33.tar.xz
fix bug where no sbosnap fetch caused script failure
Diffstat (limited to 'SBO-Lib/lib/SBO')
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm25
1 files changed, 18 insertions, 7 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) {