summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.version1
-rw-r--r--Makefile9
-rw-r--r--debian/changelog2
-rw-r--r--debian/control2
-rw-r--r--lib/Loadbars/Constants.pm1
-rw-r--r--lib/Loadbars/Main.pm3
-rw-r--r--lib/Loadbars/Utils.pm18
7 files changed, 30 insertions, 6 deletions
diff --git a/.version b/.version
new file mode 100644
index 0000000..a2a1a9a
--- /dev/null
+++ b/.version
@@ -0,0 +1 @@
+0.5.2.1+nmu1
diff --git a/Makefile b/Makefile
index 9f6ae13..b33c1c5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,13 @@
NAME=loadbars
-all: documentation perltidy
+all: version documentation perltidy
+version:
+ cut -d' ' -f2 debian/changelog | head -n 1 | sed 's/(//;s/)//' > .version
perltidy:
find . -name \*.pm | xargs perltidy -b
perltidy -b $(NAME)
find . -name \*.bak -delete
documentation:
- pod2man --release="$(NAME) $$(cut -d' ' -f2 debian/changelog | head -n 1 | sed 's/(//;s/)//')" \
+ pod2man --release="$(NAME) $$(cat .version)" \
--center="User Commands" ./docs/$(NAME).pod > ./docs/$(NAME).1
pod2text ./docs/$(NAME).pod > ./docs/$(NAME).txt
install:
@@ -14,8 +16,11 @@ install:
cp $(NAME) $(DESTDIR)/usr/bin
cp -r ./lib $(DESTDIR)/usr/share/$(NAME)/lib
cp -r ./fonts $(DESTDIR)/usr/share/$(NAME)/fonts
+ cp ./.version $(DESTDIR)/usr/share/$(NAME)/version
deinstall:
test ! -z "$(DESTDIR)" && test -f $(DESTDIR)/usr/bin/$(NAME) && rm $(DESTDIR)/usr/bin/$(NAME) || exit 0
test ! -z "$(DESTDIR)/usr/share/$(NAME)" && -d $(DESTDIR)/usr/share/$(NAME) && rm -r $(DESTDIR)/usr/share/$(NAME) || exit 0
+clean:
+ test -f .version && rm .version
deb:
dpkg-buildpackage
diff --git a/debian/changelog b/debian/changelog
index 08fe718..0e6318f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ loadbars (0.5.2) stable; urgency=low
* Initial .deb
+ * Heavy code refactoring (more modular code)
+
-- Paul Buetow <paul@buetow.org> Sun, 08 Apr 2012 15:23:53 +0200
loadbars (0.0.0) stable; urgency=low
diff --git a/debian/control b/debian/control
index 84c7583..89d53e5 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,6 @@ Vcs-Browser: http://web.buetow.org/git/?p=loadbars.git;a=summary
Package: loadbars
Architecture: all
-Depends: ${perl:Depends}, libsdl-perl (>= 2.2.5-1), libproc-processtable-perl (>= 0.45-1)
+Depends: ${perl:Depends}, libsdl-perl (>= 2.2.5-1), libproc-processtable-perl (>= 0.45-1), openssh-client
Description: Real time monitoring tool
Loadbars is a tool to observe loads of several remote servers at once.
diff --git a/lib/Loadbars/Constants.pm b/lib/Loadbars/Constants.pm
index adffc47..e21c93a 100644
--- a/lib/Loadbars/Constants.pm
+++ b/lib/Loadbars/Constants.pm
@@ -6,7 +6,6 @@ use warnings;
use SDL::Color;
use constant {
- VERSION => 'loadbars v0.5.2.1',
COPYRIGHT => '2010-2012 (c) Paul Buetow <loadbars@mx.buetow.org>',
CONFFILE => $ENV{HOME} . '/.loadbarsrc',
CSSH_CONFFILE => '/etc/clusters',
diff --git a/lib/Loadbars/Main.pm b/lib/Loadbars/Main.pm
index 5b8f161..199a2e4 100644
--- a/lib/Loadbars/Main.pm
+++ b/lib/Loadbars/Main.pm
@@ -295,8 +295,7 @@ sub loop ($@) {
$C{width} = $C{barwidth};
my $app = SDL::App->new(
- -title => Loadbars::Constants->VERSION
- . ' (press h for help on stdout)',
+ -title => 'Loadbars ' . get_version . ' (press h for help on stdout)',
-icon_title => Loadbars::Constants->VERSION,
-width => $C{width},
-height => $C{height},
diff --git a/lib/Loadbars/Utils.pm b/lib/Loadbars/Utils.pm
index bfb8027..df5e0f7 100644
--- a/lib/Loadbars/Utils.pm
+++ b/lib/Loadbars/Utils.pm
@@ -18,6 +18,7 @@ our @EXPORT = qw (
say
sum
trim
+ get_version
);
sub say (@) { print "$_\n" for @_; return undef }
@@ -38,4 +39,21 @@ sub display_info_no_nl ($) { print "==> " . (shift) . ' ' }
sub display_info ($) { say "==> " . shift }
sub display_warn ($) { say "!!! " . shift }
+sub get_version () {
+ my $versionfile = do {
+ if ( -f '.version' ) {
+ '.version';
+ }
+ else {
+ '/usr/share/loadbars/version';
+ }
+ };
+
+ open my $fh, $versionfile or error("$!: $versionfile");
+ my $version = <$fh>;
+ close $fh;
+
+ return $version;
+}
+
1;