summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2012-04-20 21:48:04 +0200
committerPaul Buetow <paul@buetow.org>2012-04-20 21:48:04 +0200
commitb79cc8f9b5dc83b45db1f82933eaa55d7546351c (patch)
treee66ff2cf07bc8ebd4a32a60149af74c858ee2a27
parent07280cf0d2fd6602aa1a9d5a04b53172ad9f5a1d (diff)
initial packaging working
-rw-r--r--Makefile19
-rw-r--r--debian/README7
-rw-r--r--debian/changelog5
-rw-r--r--debian/compat1
-rw-r--r--debian/control15
-rw-r--r--debian/copyright30
-rw-r--r--debian/files1
-rw-r--r--debian/loadbars.debhelper.log45
-rw-r--r--debian/loadbars.manpages1
-rw-r--r--debian/loadbars.substvars2
-rwxr-xr-xdebian/rules13
-rw-r--r--debian/source/format1
-rw-r--r--docs/loadbars.1186
-rw-r--r--docs/loadbars.pod74
-rw-r--r--docs/loadbars.txt65
-rw-r--r--lib/Loadbars/Config.pm10
-rwxr-xr-xloadbars14
17 files changed, 483 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 585f57c..a004ff3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,21 @@
+NAME=loadbars
perltidy:
find . -name \*.pm | xargs perltidy -b
- perltidy -b loadbars
+ perltidy -b $(NAME)
find . -name \*.bak -delete
+all: documentation
+documentation:
+ pod2man --release="$(NAME) $$(cut -d' ' -f2 debian/changelog | head -n 1 | sed 's/(//;s/)//')" \
+ --center="User Commands" ./docs/$(NAME).pod > ./docs/$(NAME).1
+ pod2text ./docs/$(NAME).pod > ./docs/$(NAME).txt
+install:
+ test ! -d $(DESTDIR)/usr/bin && mkdir -p $(DESTDIR)/usr/bin || exit 0
+ test ! -d $(DESTDIR)/usr/share/$(NAME) && mkdir -p $(DESTDIR)/usr/share/$(NAME) || exit 0
+ cp $(NAME) $(DESTDIR)/usr/bin
+ cp -r ./lib $(DESTDIR)/usr/share/$(NAME)/lib
+ cp -r ./fonts $(DESTDIR)/usr/share/$(NAME)/fonts
+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
+deb:
+ dpkg-buildpackage
diff --git a/debian/README b/debian/README
new file mode 100644
index 0000000..2279588
--- /dev/null
+++ b/debian/README
@@ -0,0 +1,7 @@
+The Debian Package loadbars
+----------------------------
+
+This is just a hobby project. Not sure if everything meets the debian
+policy though.
+
+ -- Paul Buetow <paul@buetow.org> Sun, 08 Apr 2012 15:23:53 +0200
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..89110c4
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+loadbars (0.0.0) unstable; urgency=low
+
+ * Initial .deb
+
+ -- Paul Buetow <paul@buetow.org> Sun, 08 Apr 2012 15:23:53 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+8
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..c8eb5a1
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: loadbars
+Section: net
+Priority: optional
+Maintainer: Paul Buetow <paul@buetow.org>
+Build-Depends:
+Standards-Version: 3.9.2
+Homepage: http://loadbars.buetow.org
+Vcs-Git: git://git.bueto.org/loadbars
+Vcs-Browser: http://web.buetow.org/git/?p=loadbars.git;a=summary
+
+Package: loadbars
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Real time monitoring tool
+ Loadbars is a small script that can be used to observe CPU loads of several remote servers at once in real time.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..b563119
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,30 @@
+Format: http://dep.debian.net/deps/dep5
+Upstream-Name: loadbars
+Source: http://loadbars.buetow.org
+
+Files: *
+Copyright: 2012 Paul Buetow <paul@buetow.org>
+License: GPL-3.0+
+
+Files: debian/*
+Copyright: 2012 Paul Buetow <paul@buetow.org>
+License: GPL-3.0+
+
+License: GPL-3.0+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
+
diff --git a/debian/files b/debian/files
new file mode 100644
index 0000000..50aa1a4
--- /dev/null
+++ b/debian/files
@@ -0,0 +1 @@
+loadbars_0.0.0_amd64.deb net optional
diff --git a/debian/loadbars.debhelper.log b/debian/loadbars.debhelper.log
new file mode 100644
index 0000000..2d06fcd
--- /dev/null
+++ b/debian/loadbars.debhelper.log
@@ -0,0 +1,45 @@
+dh_auto_configure
+dh_auto_build
+dh_auto_test
+dh_prep
+dh_installdirs
+dh_auto_install
+dh_install
+dh_installdocs
+dh_installchangelogs
+dh_installexamples
+dh_installman
+dh_installcatalogs
+dh_installcron
+dh_installdebconf
+dh_installemacsen
+dh_installifupdown
+dh_installinfo
+dh_pysupport
+dh_installinit
+dh_installmenu
+dh_installmime
+dh_installmodules
+dh_installlogcheck
+dh_installlogrotate
+dh_installpam
+dh_installppp
+dh_installudev
+dh_installwm
+dh_installxfonts
+dh_bugfiles
+dh_lintian
+dh_gconf
+dh_icons
+dh_perl
+dh_usrlocal
+dh_link
+dh_compress
+dh_fixperms
+dh_strip
+dh_makeshlibs
+dh_shlibdeps
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
diff --git a/debian/loadbars.manpages b/debian/loadbars.manpages
new file mode 100644
index 0000000..a3155c7
--- /dev/null
+++ b/debian/loadbars.manpages
@@ -0,0 +1 @@
+docs/loadbars.1
diff --git a/debian/loadbars.substvars b/debian/loadbars.substvars
new file mode 100644
index 0000000..bcb0957
--- /dev/null
+++ b/debian/loadbars.substvars
@@ -0,0 +1,2 @@
+perl:Depends=perl
+misc:Depends=
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..b760bee
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+ dh $@
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/docs/loadbars.1 b/docs/loadbars.1
new file mode 100644
index 0000000..22015fe
--- /dev/null
+++ b/docs/loadbars.1
@@ -0,0 +1,186 @@
+.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "LOADBARS 1"
+.TH LOADBARS 1 "2012-04-20" "loadbars " "User Commands"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+httpbench \- Simple HTTP benchmarking tool
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+httpbench \-u <url or urllist.txt> \-d sec \-c concurrent \-r rps [\-t ms] [\-e expected]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\s-1HTTP\s0 Bench is a small program for Linux, \s-1UNIX\s0 and a like written in C which can be used to benchmark \s-1HTTP\s0 servers. For more infos please consult the project website.
+.SS "Arguments"
+.IX Subsection "Arguments"
+\fIMandatory\fR
+.IX Subsection "Mandatory"
+.ie n .IP """\-u url or urllist.txt""" 12
+.el .IP "\f(CW\-u url or urllist.txt\fR" 12
+.IX Item "-u url or urllist.txt"
+An \s-1URL\s0 to benchmark if argument begins with http:// or https:// or a path to a text file containing a list of all HTTP-URLs to request during a benchmark. Each line should start with http:// or https://.
+.ie n .IP """\-d seconds""" 12
+.el .IP "\f(CW\-d seconds\fR" 12
+.IX Item "-d seconds"
+Duration of the benchmark in seconds. E.g. 300 for a five minutes benchmark.
+.ie n .IP """\-c concurrent""" 12
+.el .IP "\f(CW\-c concurrent\fR" 12
+.IX Item "-c concurrent"
+Number of cuncurrent threads used by the benchmark.
+.ie n .IP """\-r rps""" 12
+.el .IP "\f(CW\-r rps\fR" 12
+.IX Item "-r rps"
+Requests per second wanted for the benchmark.
+.PP
+\fIOptional\fR
+.IX Subsection "Optional"
+.ie n .IP """\-t timeoutms""" 12
+.el .IP "\f(CW\-t timeoutms\fR" 12
+.IX Item "-t timeoutms"
+Timeout in milliseconds for each request. This timeout will actually not interrupt any requests. It's there just for statistical reasons. E.g. how many requests take longer than x milliseconds?
+.ie n .IP """\-e expectedresponsestr""" 12
+.el .IP "\f(CW\-e expectedresponsestr\fR" 12
+.IX Item "-e expectedresponsestr"
+The expected response of a request. E.g. all requests should contain \s-1HTML\s0 in its reponse. All responses not matching are counted and reported.
+.SS "\s-1EXAMPLES\s0"
+.IX Subsection "EXAMPLES"
+.ie n .IP """httpbench \-u mylist.txt \-d 60 \-c 10 \-r 1000""" 12
+.el .IP "\f(CWhttpbench \-u mylist.txt \-d 60 \-c 10 \-r 1000\fR" 12
+.IX Item "httpbench -u mylist.txt -d 60 -c 10 -r 1000"
+Iterates over each url in mylist.txt with 10 cuncurrent threads for 60 seconds and tries to reach 1000 requests per second. Each curl failure will be reported at the end of the test (total count and total %).
+.ie n .IP """httpbench \-u http://www.example.com \-d 300 \-c 1000 \-r 10000 \-t 20 \-e ""Hello World""""" 12
+.el .IP "\f(CWhttpbench \-u http://www.example.com \-d 300 \-c 1000 \-r 10000 \-t 20 \-e ``Hello World''\fR" 12
+.IX Item "httpbench -u http://www.example.com -d 300 -c 1000 -r 10000 -t 20 -e ""Hello World"""
+Benchmarks the single \s-1URL\s0 http://www.example.com with 1000 cuncurrent threads for 5 minutes and tries to reach 10000 requests per second. Each request which takes longer than 20 milliseconds will be reported at the end of the test (total count and total %) and each request which does not contain \*(L"Hello World\*(R" in its response string will also be reported (total count and total %). The curl errors will also be reported.
+.SH "LICENSE"
+.IX Header "LICENSE"
+See package description or project website.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Paul Buetow \- <http://httpbench.buetow.org>
diff --git a/docs/loadbars.pod b/docs/loadbars.pod
new file mode 100644
index 0000000..544b602
--- /dev/null
+++ b/docs/loadbars.pod
@@ -0,0 +1,74 @@
+=head1 NAME
+
+httpbench - Simple HTTP benchmarking tool
+
+=head1 SYNOPSIS
+
+httpbench -u <url or urllist.txt> -d sec -c concurrent -r rps [-t ms] [-e expected]
+
+=head1 DESCRIPTION
+
+HTTP Bench is a small program for Linux, UNIX and a like written in C which can be used to benchmark HTTP servers. For more infos please consult the project website.
+
+=head2 Arguments
+
+=head3 Mandatory
+
+=over 12
+
+=item C<-u url or urllist.txt>
+
+An URL to benchmark if argument begins with http:// or https:// or a path to a text file containing a list of all HTTP-URLs to request during a benchmark. Each line should start with http:// or https://.
+
+=item C<-d seconds>
+
+Duration of the benchmark in seconds. E.g. 300 for a five minutes benchmark.
+
+=item C<-c concurrent>
+
+Number of cuncurrent threads used by the benchmark.
+
+=item C<-r rps>
+
+Requests per second wanted for the benchmark.
+
+=back
+
+=head3 Optional
+
+=over 12
+
+=item C<-t timeoutms>
+
+Timeout in milliseconds for each request. This timeout will actually not interrupt any requests. It's there just for statistical reasons. E.g. how many requests take longer than x milliseconds?
+
+=item C<-e expectedresponsestr>
+
+The expected response of a request. E.g. all requests should contain HTML in its reponse. All responses not matching are counted and reported.
+
+=back
+
+=head2 EXAMPLES
+
+=over 12
+
+=item C<httpbench -u mylist.txt -d 60 -c 10 -r 1000>
+
+Iterates over each url in mylist.txt with 10 cuncurrent threads for 60 seconds and tries to reach 1000 requests per second. Each curl failure will be reported at the end of the test (total count and total %).
+
+=item C<httpbench -u http://www.example.com -d 300 -c 1000 -r 10000 -t 20 -e "Hello World">
+
+Benchmarks the single URL http://www.example.com with 1000 cuncurrent threads for 5 minutes and tries to reach 10000 requests per second. Each request which takes longer than 20 milliseconds will be reported at the end of the test (total count and total %) and each request which does not contain "Hello World" in its response string will also be reported (total count and total %). The curl errors will also be reported.
+
+=back
+
+
+=head1 LICENSE
+
+See package description or project website.
+
+=head1 AUTHOR
+
+Paul Buetow - <http://httpbench.buetow.org>
+
+=cut
diff --git a/docs/loadbars.txt b/docs/loadbars.txt
new file mode 100644
index 0000000..1cb9764
--- /dev/null
+++ b/docs/loadbars.txt
@@ -0,0 +1,65 @@
+NAME
+ httpbench - Simple HTTP benchmarking tool
+
+SYNOPSIS
+ httpbench -u <url or urllist.txt> -d sec -c concurrent -r rps [-t ms]
+ [-e expected]
+
+DESCRIPTION
+ HTTP Bench is a small program for Linux, UNIX and a like written in C
+ which can be used to benchmark HTTP servers. For more infos please
+ consult the project website.
+
+ Arguments
+ Mandatory
+ "-u url or urllist.txt"
+ An URL to benchmark if argument begins with http:// or
+ https:// or a path to a text file containing a list of all
+ HTTP-URLs to request during a benchmark. Each line should
+ start with http:// or https://.
+
+ "-d seconds"
+ Duration of the benchmark in seconds. E.g. 300 for a five
+ minutes benchmark.
+
+ "-c concurrent"
+ Number of cuncurrent threads used by the benchmark.
+
+ "-r rps" Requests per second wanted for the benchmark.
+
+ Optional
+ "-t timeoutms"
+ Timeout in milliseconds for each request. This timeout will
+ actually not interrupt any requests. It's there just for
+ statistical reasons. E.g. how many requests take longer than
+ x milliseconds?
+
+ "-e expectedresponsestr"
+ The expected response of a request. E.g. all requests should
+ contain HTML in its reponse. All responses not matching are
+ counted and reported.
+
+ EXAMPLES
+ "httpbench -u mylist.txt -d 60 -c 10 -r 1000"
+ Iterates over each url in mylist.txt with 10 cuncurrent
+ threads for 60 seconds and tries to reach 1000 requests per
+ second. Each curl failure will be reported at the end of the
+ test (total count and total %).
+
+ "httpbench -u http://www.example.com -d 300 -c 1000 -r 10000 -t 20 -e
+ "Hello World""
+ Benchmarks the single URL http://www.example.com with 1000
+ cuncurrent threads for 5 minutes and tries to reach 10000
+ requests per second. Each request which takes longer than 20
+ milliseconds will be reported at the end of the test (total
+ count and total %) and each request which does not contain
+ "Hello World" in its response string will also be reported
+ (total count and total %). The curl errors will also be
+ reported.
+
+LICENSE
+ See package description or project website.
+
+AUTHOR
+ Paul Buetow - <http://httpbench.buetow.org>
+
diff --git a/lib/Loadbars/Config.pm b/lib/Loadbars/Config.pm
index e9c7218..57fad2f 100644
--- a/lib/Loadbars/Config.pm
+++ b/lib/Loadbars/Config.pm
@@ -41,7 +41,8 @@ our %I : shared;
sub read () {
return unless -f Loadbars::Constants->CONFFILE;
- display_info("Reading configuration from " . Loadbars::Constants->CONFFILE);
+ display_info(
+ "Reading configuration from " . Loadbars::Constants->CONFFILE );
open my $conffile, Loadbars::Constants->CONFFILE
or die "$!: " . Loadbars::Constants->CONFFILE . "\n";
@@ -67,7 +68,8 @@ sub read () {
}
else {
display_info(
-"Setting $key=$val, it might be overwritten by command line params.");
+"Setting $key=$val, it might be overwritten by command line params."
+ );
$C{$key} = $val;
}
}
@@ -76,11 +78,11 @@ sub read () {
}
sub write () {
- display_warn("Overwriting config file " . Loadbars::Constants->CONFFILE)
+ display_warn( "Overwriting config file " . Loadbars::Constants->CONFFILE )
if -f Loadbars::Constants->CONFFILE;
open my $conffile, '>', Loadbars::Constants->CONFFILE or do {
- display_warn("$!: " . Loadbars::Constants->CONFFILE);
+ display_warn( "$!: " . Loadbars::Constants->CONFFILE );
return undef;
};
diff --git a/loadbars b/loadbars
index 8dccbe2..ea1ea06 100755
--- a/loadbars
+++ b/loadbars
@@ -9,7 +9,19 @@ use warnings;
use Getopt::Long;
-use lib 'lib';
+my $lib;
+
+BEGIN {
+ if ( -d './lib/Loadbars' ) {
+ $lib = 'lib';
+
+ }
+ else {
+ $lib = '/usr/share/loadbars/lib';
+ }
+}
+
+use lib $lib;
use Loadbars::Main;
use Loadbars::Constants;