aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2017-03-25 16:27:28 +0100
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2017-03-25 16:27:28 +0100
commit9e1b8f5d50385852b76773e8693a4ea30ab21fd5 (patch)
treed0b1dec4eec4c54978b866dae5e81f080d4a0afd
parent30143ebecda1e65dc72a5ff1f4e789762206b647 (diff)
downloadsbotools2-9e1b8f5d50385852b76773e8693a4ea30ab21fd5.tar.xz
sboinstall: add --reinstall commandline option.
This fixes #58.
-rw-r--r--man1/sboinstall.15
-rwxr-xr-xsboinstall14
-rwxr-xr-xt/15-usage.t2
3 files changed, 18 insertions, 3 deletions
diff --git a/man1/sboinstall.1 b/man1/sboinstall.1
index fb72e2d..b991335 100644
--- a/man1/sboinstall.1
+++ b/man1/sboinstall.1
@@ -56,6 +56,11 @@ Skip viewing of the README and the yes or no question which accompanies it. Anyt
This option causes sboinstall to skip requirement handling, but still show the README and prompt the user to proceed.
.RE
.P
+--reinstall
+.RS
+This option asks if we should reinstall anything among the requirements that is already installed.
+.RE
+.P
--create-template (FILE)
.RS
Create a template for the SlackBuilds including any optional commands or build options that you wish to set and store this in the specified FILE.
diff --git a/sboinstall b/sboinstall
index 05b493d..9df3188 100755
--- a/sboinstall
+++ b/sboinstall
@@ -44,6 +44,8 @@ Options (defaults shown first where applicable):
non-interactive; skips README and all prompts.
-R|--norequirements:
view the README but do not parse requirements, commands, or options.
+ --reinstall:
+ Ask to reinstall any already-installed packages in the requirement list.
--create-template (FILE):
create a template with specified requirements, commands, and options.
--use-template (FILE):
@@ -57,7 +59,7 @@ EOF
my $noclean = $config{NOCLEAN};
my $distclean = $config{DISTCLEAN};
my $jobs = $config{JOBS};
-my ($help, $vers, $no_install, $non_int, $no_reqs, $compat32, $ctemp, $utemp);
+my ($help, $vers, $no_install, $non_int, $no_reqs, $compat32, $ctemp, $utemp, $reinstall);
GetOptions(
'help|h' => \$help,
@@ -69,6 +71,7 @@ GetOptions(
'compat32|p' => \$compat32,
'nointeractive|r' => \$non_int,
'norequirements|R' => \$no_reqs,
+ 'reinstall' => \$reinstall,
'create-template=s' => \$ctemp,
'use-template=s' => \$utemp,
);
@@ -150,8 +153,13 @@ FIRST: for my $sbo (@$build_queue) {
my $name = $compat32 ? "$sbo-compat32" : $sbo;
if ($inst_names{$name}) {
- say sprintf "%s (%s) is already installed.", $name, $inst_names{$name}{pkg};
- next FIRST;
+ my $inst_msg = sprintf "%s (%s) is already installed.", $name, $inst_names{$name}{pkg};
+ if ($reinstall and not $non_int) {
+ next FIRST unless prompt("$inst_msg Do you want to reinstall from SBo?", default => 'no');
+ } else {
+ say $inst_msg;
+ next FIRST;
+ }
} else {
if ($sbo =~ /^perl-/) {
my $pm_name = $sbo;
diff --git a/t/15-usage.t b/t/15-usage.t
index 0e5a02a..e790a49 100755
--- a/t/15-usage.t
+++ b/t/15-usage.t
@@ -130,6 +130,8 @@ Options (defaults shown first where applicable):
non-interactive; skips README and all prompts.
-R|--norequirements:
view the README but do not parse requirements, commands, or options.
+ --reinstall:
+ Ask to reinstall any already-installed packages in the requirement list.
--create-template (FILE):
create a template with specified requirements, commands, and options.
--use-template (FILE):