aboutsummaryrefslogtreecommitdiff
path: root/sboinstall
blob: 3e251caeb01e39e591ba3c7011357c817bc7d24a (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env perl
#
# vim: set ts=4:noet
#
# sboinstall
# script to install a SlackBuild by name
#
# author: Jacob Pipkin <j@dawnrazor.net>
# date: Pungenday, the 40th day of Discord in the YOLD 3178
# license: WTFPL <http://sam.zoy.org/wtfpl/COPYING>

use 5.16.0;
use strict;
use warnings FATAL => 'all';
use SBO::Lib;
use Getopt::Long qw(:config bundling);
use File::Basename;

my $self = basename ($0);

sub show_usage () {
	print <<EOF
Usage: $self [options] sbo

Options (defaults shown first where applicable):
  -h|--help:
    this screen.
  -v|--version:
    version information.
  -c|--noclean (FALSE|TRUE):
    set whether or not to clean working files/directories after the build.
  -d|--distclean (TRUE|FALSE):
   set whether or not to clean distfiles afterward. 
  -i|--noinstall:
    do not run installpkg at the end of the build process.
  -j|--jobs (FALSE|#):
    specify "-j" setting to make, for multicore systems; overrides conf file.
  -p|--compat32:
    install an SBo as a -compat32 pkg on a multilib x86_64 system.
  -r|--nointeractive:
    non-interactive; skips README and all prompts.
  -R|--norequirements:
    view the README but do not parse requirements, commands, or options.

EOF
}

my $noclean = $config{NOCLEAN};
my $distclean = $config{DISTCLEAN};
my $jobs = $config{JOBS};
my ($help, $vers, $no_install, $non_int, $no_reqs, $compat32);

GetOptions (
	'help|h'			=> \$help,
	'version|v'			=> \$vers,
	'noclean|c=s'		=> \$noclean,
	'distclean|d=s'		=> \$distclean,
	'noinstall|i'		=> \$no_install,
	'jobs|j=s'			=> \$jobs,
	'compat32|p'		=> \$compat32,
	'nointeractive|r'	=> \$non_int,
	'norequirements|R'	=> \$no_reqs,
);

show_usage and exit 0 if $help;
show_version and exit 0 if $vers;
show_usage and exit 0 unless exists $ARGV[0];

$noclean = $noclean eq 'TRUE' ? 1 : 0;
$distclean = $distclean eq 'TRUE' ? 1 : 0;

# setup any options
unshift @ARGV, $noclean ? '-cTRUE' : '-cFALSE';
unshift @ARGV, $distclean ? '-dTRUE' : '-dFALSE';
unshift @ARGV, '-i' if $no_install;
unshift @ARGV, '-p' if $compat32;
unshift @ARGV, '-r' if $non_int;
unshift @ARGV, '-R' if $no_reqs;
unshift @ARGV, "-j$jobs" if $jobs;

system '/usr/sbin/sboupgrade', '-oN', @ARGV;

exit 0;