#!/usr/bin/env perl # # vim: set ts=4:noet # # sbocheck # script to update the local sbo tree and check for updates # # author: Jacob Pipkin # date: Sweetmorn, the 38th day of Discord in the YOLD 3178 # license: WTFPL use 5.16.0; use SBO::Lib; use File::Basename; use Getopt::Std; use Text::Tabulate; use warnings FATAL => 'all'; use strict; my %config = %SBO::Lib::config; my $self = basename ($0); my %options; getopts ('v',\%options); show_version && exit 0 if (exists $options{v}); update_tree; print "Checking for updated SlackBuilds...\n"; my $updates = get_available_updates; # pretty formatting. my @listing; for my $key (keys @$updates) { my $string = "$$updates[$key]{name}-$$updates[$key]{installed}"; $string .= " < needs updating (SBo has $$updates[$key]{update})\n"; push @listing, $string; } if (exists $listing[0]) { my $tab = new Text::Tabulate (); $tab->configure (tab => '\s'); my $output = $tab->format (@listing); say "\n". $output; } else { say "\nNo updates available."; } exit 0;