blob: 94b1ce19a97b883a18227ad9c8284ecb800219f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/usr/bin/perl
#
# vim: set ts=4:noet
#
# sbosnap
# script to pull down / update a local copy of the slackbuilds.org tree.
#
# authors: Jacob Pipkin <j@dawnrazor.net>
# Luke Williams <xocel@iquidus.org>
# Andreas Guldstrand <andreas.guldstrand@gmail.com>
# license: WTFPL <http://sam.zoy.org/wtfpl/COPYING>
use 5.16.0;
use strict;
use warnings FATAL => 'all';
use SBO::Lib qw/ fetch_tree update_tree %config show_version /;
use File::Basename;
use Getopt::Long;
my $sbo_home = $config{SBO_HOME};
my $self = basename($0);
sub show_usage {
print <<EOF
Usage: $self [options|command]
Options:
-h|--help:
this screen.
-v|--version:
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 ($help, $vers);
GetOptions('help|h' => \$help, 'version|v' => \$vers);
show_usage() and exit 0 if $help;
show_version() and exit 0 if $vers;
# check for a command and, if found, execute it
my $command;
if ($ARGV[0] =~ /fetch|update/) {
$command = $ARGV[0];
} else {
show_usage() and exit 1;
}
if ($command eq 'fetch') { fetch_tree() }
elsif ($command eq 'update') { update_tree() }
exit 0;
|