summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Echolot/Config.pm30
-rw-r--r--NEWS4
-rw-r--r--doc/pingd.conf.pod18
-rwxr-xr-xpingd66
-rw-r--r--pingd.conf.sample1
-rwxr-xr-xtools/pingctl7
6 files changed, 81 insertions, 45 deletions
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index d90f304..8cb5237 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.32 2002/07/23 00:30:11 weasel Exp $
+# $Id: Config.pm,v 1.33 2002/08/05 17:30:09 weasel Exp $
#
=pod
@@ -23,7 +23,7 @@ The configuration file is searched in those places in that order:
=item the file pointed to by the B<ECHOLOT_CONF> environment variable
-=item `pwd`/pingd.conf
+=item <basedir>/pingd.conf
=item $HOME/echolot/pingd.conf
@@ -43,17 +43,19 @@ use English;
my $CONFIG;
-my @CONFIG_FILES =
- ( $ENV{'ECHOLOT_CONF'},
- 'pingd.conf',
- $ENV{'HOME'}.'/echolot/pingd.conf',
- $ENV{'HOME'}.'/pingd.conf',
- $ENV{'HOME'}.'/.pingd.conf',
- '/etc/pingd.conf' );
-
sub init($) {
my ($params) = @_;
-
+
+ die ("Basedir is not defined\n") unless defined $params->{'basedir'};
+
+ my @CONFIG_FILES =
+ ( $ENV{'ECHOLOT_CONF'},
+ $params->{'basedir'}.'/pingd.conf',
+ $ENV{'HOME'}.'/echolot/pingd.conf',
+ $ENV{'HOME'}.'/pingd.conf',
+ $ENV{'HOME'}.'/.pingd.conf',
+ '/etc/pingd.conf' );
+
my $DEFAULT;
$DEFAULT = {
# System Specific Options
@@ -176,6 +178,7 @@ sub init($) {
for my $filename ( @CONFIG_FILES ) {
if ( defined $filename && -e $filename ) {
$configfile = $filename;
+ print "Using config file $configfile\n" if ($params->{'verbose'});
last;
};
};
@@ -194,11 +197,12 @@ sub init($) {
confess("Evaling config code from '$configfile' returned error: $EVAL_ERROR");
}
+
for my $key (keys %$DEFAULT) {
$CONFIG->{$key} = $DEFAULT->{$key} unless defined $CONFIG->{$key};
};
-
- $CONFIG->{'verbose'} = 1 if ($params->{'verbose'});
+ $CONFIG->{'basedir'} = $params->{'basedir'} unless (defined $CONFIG->{'verbose'});
+ $CONFIG->{'verbose'} = $params->{'verbose'} if ($params->{'verbose'});
for my $key (keys %$CONFIG) {
warn ("Config option $key is not defined\n") unless defined $CONFIG->{$key};
diff --git a/NEWS b/NEWS
index 00e1bec..6345ad9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Changes in version 2.0beta21 - 2002-08-05
+ * Using a sane basedir by default. You no longer need to specify
+ it in pingd.conf.
+
Changes in version 2.0beta20 - 2002-08-02
* Added pingctl wrapper to tools.
* echolot --help now gives a brief list of commands.
diff --git a/doc/pingd.conf.pod b/doc/pingd.conf.pod
index 296beaa..298a066 100644
--- a/doc/pingd.conf.pod
+++ b/doc/pingd.conf.pod
@@ -18,15 +18,6 @@ values in the $CONFIG hash.
=over
-=item B<homedir>
-
-The base directory of the echolot installation. All other filenames and
-directorynames are local to this directory. B<pingd> changes into this
-directory upon startup.
-
- Default: none
- Example: 'homedir' => '/home/pinger/echolot',
-
=item B<sitename>
A short name for your site/pinger. Is used in the statistics produced.
@@ -341,6 +332,15 @@ After which time to expire files in the thesaurus directory.
=over
+=item B<homedir>
+
+The base directory of the echolot installation. All other filenames and
+directorynames are local to this directory. B<pingd> changes into this
+directory upon startup.
+
+ Default: The directory in which pingd is.
+ Example: 'homedir' => '/home/pinger/echolot',
+
=item B<mailindir>
The Maildir directory which is searched for new messages.
diff --git a/pingd b/pingd
index d74c8da..7627340 100755
--- a/pingd
+++ b/pingd
@@ -3,7 +3,7 @@
$| = 1;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: pingd,v 1.51 2002/08/02 02:20:47 weasel Exp $
+# $Id: pingd,v 1.52 2002/08/05 17:30:09 weasel Exp $
#
=pod
@@ -153,19 +153,24 @@ Dumps the current configuration to standard output.
=over
-=item --verbose
+=item B<--basedir>
+
+The home directory to which everything else is relative to. See the BASE
+DIRECTORY section below.
+
+=item B<--verbose>
Verbose mode. Causes B<pingd> to print debugging messages about its progress.
-=item --help
+=item B<--help>
Print a short help and exit sucessfully.
-=item --version
+=item B<--version>
Print version number and exit sucessfully.
-=item --nohup
+=item B<--nohup>
Usefull only with the B<add>, B<set>, B<setremailercaps>,
B<deleteremailercaps>, B<getkeyconf>, B<buildstats>, B<buildkeys>,
@@ -176,13 +181,13 @@ commands after adding the command to the task list.
Per default such a signal is sent.
-=item --process
+=item B<--process>
Usefull only with the B<start> command.
Read and process the commands file on startup.
-=item --detach
+=item B<--detach>
Usefull only with the B<start> command.
@@ -190,6 +195,19 @@ Tell B<pingd> to detach.
=back
+=head1 BASE DIRECTORY
+
+The home directory to which everything else is relative to.
+
+Basedir defaults to whatever directory the B<pingd> binary is located. It can
+get overridden by the B<ECHOLOT_HOME> environment variable which in turn is
+weaker than the B<--basedir> setting.
+
+This directory is then used to locate the configuration file B<pingd.conf> (see
+FILES below).
+
+The B<homedir> setting in B<pingd.conf> finally sets the base directory.
+
=head1 FILES
The configuration file is searched in those places in that order:
@@ -198,7 +216,7 @@ The configuration file is searched in those places in that order:
=item the file pointed to by the B<ECHOLOT_CONF> environment variable
-=item `pwd`/pingd.conf
+=item <basedir>/pingd.conf
=item $HOME/echolot/pingd.conf
@@ -210,6 +228,16 @@ The configuration file is searched in those places in that order:
=back
+=head1 ENVIRONMENT
+
+=over
+
+=item ECHOLOT_CONF echolot config file (see section FILES)
+
+=item ECHOLOT_HOME echolot base directory (see section BASE DIRECTORY)
+
+=back
+
=head1 SIGNALS
On B<SIGINT>, B<SIGQUIT>, and B<SIGTERM> B<pingd> will schedule a shutdown
@@ -233,10 +261,11 @@ Please report them at E<lt>URL:http://savannah.gnu.org/bugs/?group=echolotE<gt>
=cut
use strict;
+use FindBin qw{ $Bin };
+use lib ( $Bin, "$Bin/lib" );
use Getopt::Long;
use English;
use Carp;
-use lib qw{ . lib };
use Echolot::Config;
use Echolot::Globals;
use Echolot::Storage::File;
@@ -251,7 +280,7 @@ use Echolot::Thesaurus;
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
-my $VERSION = '2.0beta20';
+my $VERSION = '2.0beta21';
my $redirected_stdio = 0;
@@ -499,15 +528,18 @@ sub hup_if_wanted($) {
-my $params;
+my $params = { basedir => $Bin };
+$params->{'basedir'} = $ENV{'ECHOLOT_HOME'} if (defined $ENV{'ECHOLOT_HOME'});
+
Getopt::Long::config('bundling');
if (!GetOptions (
- 'help' => \$params->{'help'},
- 'version' => \$params->{'version'},
- 'verbose' => \$params->{'verbose'},
- 'nohup' => \$params->{'nohup'},
- 'detach' => \$params->{'detach'},
- 'process' => \$params->{'process'},
+ 'help' => \$params->{'help'},
+ 'version' => \$params->{'version'},
+ 'verbose+' => \$params->{'verbose'},
+ 'nohup' => \$params->{'nohup'},
+ 'detach' => \$params->{'detach'},
+ 'process' => \$params->{'process'},
+ 'basedir' => \$params->{'basedir'},
)) {
die ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [-fwhv]\n");
};
diff --git a/pingd.conf.sample b/pingd.conf.sample
index 256f18a..f7c2cf9 100644
--- a/pingd.conf.sample
+++ b/pingd.conf.sample
@@ -1,7 +1,6 @@
# vim:set syntax=perl:
$CONFIG = {
- 'homedir' => '/home/pinger/echolot',
'sitename' => 'unconfigured',
'my_localpart' => 'pinger',
diff --git a/tools/pingctl b/tools/pingctl
index b285d84..45a34ec 100755
--- a/tools/pingctl
+++ b/tools/pingctl
@@ -8,14 +8,13 @@ set -e
################################################################
# You perhaps want to change those items
-BASEDIR=/home/weasel/projects/echolot/devel/echolot
-USER=weasel
+USER=echolot
VERBOSE=0
+PINGD="/home/pinger/echolot/pingd"
# You probably don't want to mess with stuff below this line
################################################################
-PINGD="./pingd"
CHECKULIMIT=1
CHECKUID=1
@@ -68,8 +67,6 @@ else
fi
-cd $BASEDIR
-
case $1 in
start)