aboutsummaryrefslogtreecommitdiff
path: root/sbosnap
diff options
context:
space:
mode:
Diffstat (limited to 'sbosnap')
-rwxr-xr-xsbosnap64
1 files changed, 64 insertions, 0 deletions
diff --git a/sbosnap b/sbosnap
new file mode 100755
index 0000000..62d1141
--- /dev/null
+++ b/sbosnap
@@ -0,0 +1,64 @@
+#!/usr/bin/env perl
+#
+# sbosnap
+# script to pull down / update a local copy of the
+# slackbuilds.org tree.
+#
+# author: Jacob Pipkin <j@dawnrazor.net>
+# date: Setting Orange, the 37th day of Discord in the YOLD 3178
+# license: WTFPL <http://sam.zoy.org/wtfpl/COPYING>
+# changelog:
+# .01: initial creation.
+
+use SBO::Lib;
+use File::Basename;
+use Getopt::Std;
+use File::Path qw(make_path);
+use feature switch;
+use warnings FATAL => 'all';
+use strict;
+
+my %config = %SBO::Lib::config;
+my $sbo_home = $config{SBO_HOME};
+my $self = basename($0);
+
+sub show_usage {
+ print <<EOF
+Usage: $self [options|command]
+
+Options:
+ -h: this screen.
+ -v: version information.
+
+Commands:
+ fetch: initialize a local copy of the slackbuilds.org tree.
+ update: update an existing local copy of the slackbuilds.org tree.
+ (generally, you may prefer "sbocheck" over "$self update")
+
+EOF
+}
+
+show_usage() and exit(1) unless exists $ARGV[0];
+
+my %options;
+getopts('hv',\%options);
+
+show_usage() and exit(0) if exists $options{h};
+show_version() and exit(0) if exists $options{v};
+
+# check for a command and, if found, execute it
+#
+my $command;
+if ($ARGV[0] =~ /fetch|update/) {
+ $command = $ARGV[0];
+} else {
+ show_usage();
+ exit(1);
+}
+
+given($command) {
+ when('fetch') { fetch_tree() }
+ when('update') { update_tree() }
+}
+
+exit(0);