diff options
-rwxr-xr-x | sbocheck | 20 | ||||
-rwxr-xr-x | sboconfig | 30 | ||||
-rwxr-xr-x | sbosnap | 21 |
3 files changed, 35 insertions, 36 deletions
@@ -15,32 +15,32 @@ use warnings FATAL => 'all'; use strict; my %config = %SBO::Lib::config; -my $self = basename($0); +my $self = basename ($0); my %options; -getopts('v',\%options); +getopts ('v',\%options); -show_version() && exit(0) if (exists $options{v}); +show_version () && exit (0) if (exists $options{v}); -update_tree(); +update_tree (); print "Checking for updated SlackBuilds...\n"; -my @updates = get_available_updates(); +my @updates = get_available_updates (); my @listing; for (keys @updates) { my $string = "$updates[$_]{name}-$updates[$_]{installed}"; $string .= " < needs updating (SBo has $updates[$_]{update})\n"; - push(@listing,$string); + push (@listing,$string); } if (exists $listing[0]) { - my $tab = new Text::Tabulate(); - $tab->configure(tab => '\s'); - my $output = $tab->format(@listing); + my $tab = new Text::Tabulate (); + $tab->configure (tab => '\s'); + my $output = $tab->format (@listing); print "\n". $output ."\n"; } else { print "\nNo updates available.\n"; } -exit(0); +exit 0; @@ -17,7 +17,7 @@ use File::Path qw(make_path); use Fcntl; my %config = %SBO::Lib::config; -my $self = basename($0); +my $self = basename ($0); sub show_usage { print <<EOF @@ -44,10 +44,10 @@ EOF } my %options; -getopts('hvlc:d:p:s:',\%options); +getopts ('hvlc:d:p:s:',\%options); -show_usage() and exit(0) if exists $options{h}; -show_version() and exit(0) if exists $options{v}; +show_usage () and exit (0) if exists $options{h}; +show_version () and exit (0) if exists $options{v}; if (exists $options{l}) { while (my ($key,$value) = each %config) { @@ -55,7 +55,7 @@ if (exists $options{l}) { } } -show_usage() unless %options; +show_usage () unless %options; my %changes; $changes{NOCLEAN} = $options{c} if exists $options{c}; @@ -67,26 +67,26 @@ my $conf_dir = $SBO::Lib::conf_dir;; my $conf_file = $SBO::Lib::conf_file; sub make_temp_file { - make_path('/tmp/sbotools') unless -d '/tmp/sbotools'; + make_path ('/tmp/sbotools') unless -d '/tmp/sbotools'; my $temp_dir = -d '/tmp/sbotools' ? '/tmp/sbotools' : $ENV{TMPDIR} || $ENV{TEMP}; my $filename = sprintf "%s/%d-%d-0000", $temp_dir, $$, time; - sysopen my($fh), $filename, O_WRONLY|O_EXCL|O_CREAT; + sysopen my ($fh), $filename, O_WRONLY|O_EXCL|O_CREAT; return ($fh,$filename); } sub config_write { - script_error('config_write requires two arguments.') unless $_[1]; + script_error ('config_write requires two arguments.') unless exists $_[1]; my ($key,$val) = @_; if (! -d $conf_dir) { mkdir($conf_dir) - or print "Unable to create $conf_dir. Exiting.\n" and exit(1); + or print "Unable to create $conf_dir. Exiting.\n" and exit (1); } if (-f $conf_file) { my ($fh,$filename) = make_temp_file(); open my $reader, '<', $conf_file; print {$fh} <$reader>; - close($fh); + close ($fh); tie my @temp, 'Tie::File', $filename; my $has = 'FALSE'; my $regex = qr/\A\Q$key\E=/; @@ -101,19 +101,19 @@ sub config_write { if ($has eq 'FALSE') { open (my $writer, '>>', $filename); print {$writer} "$key=$val\n"; - close($writer); + close ($writer); } - move($filename,$conf_file); + move ($filename,$conf_file); } else { open my $writer, '>', $conf_file; print {$writer} "$key=$val\n"; - close($writer); + close ($writer); } } while (my ($key,$value) = each %changes) { print "Setting $key to $value...\n"; - config_write($key,$value); + config_write ($key,$value); } -exit(0); +exit 0; @@ -20,7 +20,7 @@ use strict; my %config = %SBO::Lib::config; my $sbo_home = $config{SBO_HOME}; -my $self = basename($0); +my $self = basename ($0); sub show_usage { print <<EOF @@ -38,13 +38,13 @@ Commands: EOF } -show_usage() and exit(1) unless exists $ARGV[0]; +show_usage () and exit (1) unless exists $ARGV[0]; my %options; -getopts('hv',\%options); +getopts ('hv',\%options); -show_usage() and exit(0) if exists $options{h}; -show_version() and exit(0) if exists $options{v}; +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 # @@ -52,13 +52,12 @@ my $command; if ($ARGV[0] =~ /fetch|update/) { $command = $ARGV[0]; } else { - show_usage(); - exit(1); + show_usage () and exit (1); } -given($command) { - when('fetch') { fetch_tree() } - when('update') { update_tree() } +given ($command) { + when ('fetch') { fetch_tree () } + when ('update') { update_tree () } } -exit(0); +exit 0; |