summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2012-05-01 12:27:45 +0200
committerPaul Buetow <paul@buetow.org>2012-05-01 12:27:45 +0200
commit673067fd0d1cda4c06659e9c4dd909a786098deb (patch)
tree84df1f29121e1db4676faaf09545b2f2ae676eef
parentb7416c5136a2b021473fb09843aa012b943ddde4 (diff)
some fixes and also introduce --hasagent param
-rw-r--r--lib/Loadbars/Config.pm28
-rw-r--r--lib/Loadbars/HelpDispatch.pm6
-rw-r--r--lib/Loadbars/Shared.pm1
-rw-r--r--lib/Loadbars/Utils.pm1
-rwxr-xr-xloadbars7
5 files changed, 14 insertions, 29 deletions
diff --git a/lib/Loadbars/Config.pm b/lib/Loadbars/Config.pm
index 57fad2f..2c91739 100644
--- a/lib/Loadbars/Config.pm
+++ b/lib/Loadbars/Config.pm
@@ -4,6 +4,7 @@ use strict;
use warnings;
use Loadbars::Utils;
+use Loadbars::Shared;
use Exporter;
@@ -11,33 +12,6 @@ use base 'Exporter';
our @EXPORT = qw ( %C %I );
-# Global configuration hash
-our %C : shared;
-
-# Global configuration hash for internal settings (not configurable)
-our %I : shared;
-
-# Setting defaults
-%C = (
- average => 15,
- barwidth => 35,
- extended => 0,
- factor => 1,
- height => 230,
- maxwidth => 1280,
- samples => 1000,
- showcores => 0,
- showmem => 0,
- showtext => 1,
- showtexthost => 0,
- sshopts => '',
-);
-
-%I = (
- cpuregexp => 'cpu',
- showtextoff => 0,
-);
-
sub read () {
return unless -f Loadbars::Constants->CONFFILE;
diff --git a/lib/Loadbars/HelpDispatch.pm b/lib/Loadbars/HelpDispatch.pm
index dfee7f5..8d008da 100644
--- a/lib/Loadbars/HelpDispatch.pm
+++ b/lib/Loadbars/HelpDispatch.pm
@@ -155,6 +155,12 @@ END
mode => 1
},
+ hasagent => {
+ menupos => 10,
+ help => 'SSH key is already known by the SSH agent (0 or 1)',
+ mode => 6,
+ type => 'i'
+ },
height => {
menupos => 10,
help => 'Set windows height',
diff --git a/lib/Loadbars/Shared.pm b/lib/Loadbars/Shared.pm
index 0f02b7e..fbaea54 100644
--- a/lib/Loadbars/Shared.pm
+++ b/lib/Loadbars/Shared.pm
@@ -35,6 +35,7 @@ our %I : shared;
barwidth => 35,
extended => 0,
factor => 1,
+ hasagent => 0,
height => 230,
maxwidth => 1280,
samples => 1000,
diff --git a/lib/Loadbars/Utils.pm b/lib/Loadbars/Utils.pm
index df5e0f7..050ff89 100644
--- a/lib/Loadbars/Utils.pm
+++ b/lib/Loadbars/Utils.pm
@@ -53,6 +53,7 @@ sub get_version () {
my $version = <$fh>;
close $fh;
+ chomp $version;
return $version;
}
diff --git a/loadbars b/loadbars
index ea1ea06..af43c97 100755
--- a/loadbars
+++ b/loadbars
@@ -32,7 +32,7 @@ use Loadbars::Utils;
my ( $hosts, $dispatch ) = Loadbars::HelpDispatch::create;
my $usage;
-say( Loadbars::Constants->VERSION . ' ' . Loadbars::Constants->COPYRIGHT );
+say( 'Loadbars ' . get_version . ' ' . Loadbars::Constants->COPYRIGHT );
Loadbars::Config::read;
@@ -53,8 +53,11 @@ my @hosts = map {
if ( @hosts || defined $Loadbars::Main::C{cluster} ) {
push @hosts, Loadbars::Config::get_cluster_hosts $C{cluster}
if defined $C{cluster};
- system 'ssh-add';
+ print "SSH_ADD\n"
+ if $C{hasagent} == 0;
+ system 'ssh-add'
+ if $C{hasagent} == 0
}
else {
Loadbars::Main::say $dispatch->('usage');