From f53580f49eab1577853aa3fe41e86dde386016f5 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 5 Aug 2002 17:30:09 +0000 Subject: Using a sane basedir by default Beta21 --- pingd | 66 +++++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 17 deletions(-) (limited to 'pingd') diff --git a/pingd b/pingd index d74c8da..7627340 100755 --- a/pingd +++ b/pingd @@ -3,7 +3,7 @@ $| = 1; # (c) 2002 Peter Palfrader -# $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 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, B, B, B, B, B, B, @@ -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 command. Read and process the commands file on startup. -=item --detach +=item B<--detach> Usefull only with the B command. @@ -190,6 +195,19 @@ Tell B to detach. =back +=head1 BASE DIRECTORY + +The home directory to which everything else is relative to. + +Basedir defaults to whatever directory the B binary is located. It can +get overridden by the B environment variable which in turn is +weaker than the B<--basedir> setting. + +This directory is then used to locate the configuration file B (see +FILES below). + +The B setting in B 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 environment variable -=item `pwd`/pingd.conf +=item /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, B, and B B will schedule a shutdown @@ -233,10 +261,11 @@ Please report them at EURL:http://savannah.gnu.org/bugs/?group=echolotE =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"); }; -- cgit v1.2.3