From 32d62c3cfd5e43ab6c5a90382b1dabedd09921c3 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Fri, 21 Sep 2012 07:01:16 -0500 Subject: sboinstall converted to long options and fixes added from 0.8 --- sboinstall | 72 ++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/sboinstall b/sboinstall index 2aa76cb..3e251ca 100755 --- a/sboinstall +++ b/sboinstall @@ -13,7 +13,7 @@ use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; -use Getopt::Std; +use Getopt::Long qw(:config bundling); use File::Basename; my $self = basename ($0); @@ -22,39 +22,61 @@ sub show_usage () { print < \$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]; -# setup any options which do not require arguments -my @opts1 = ('c', 'd', 'r', 'i', 'p', 'R'); -for my $opt (@opts1) { - unshift @ARGV, "-$opt" if exists $options{$opt}; -} +$noclean = $noclean eq 'TRUE' ? 1 : 0; +$distclean = $distclean eq 'TRUE' ? 1 : 0; -# setup any options which do require arguments -my @opts2 = ('j'); -for my $opt (@opts2) { - unshift @ARGV, "-$opt $options{$opt}" if exists $options{$opt}; -} +# 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; -- cgit v1.2.3