Commit 33fee6d7 authored by sikeda's avatar sikeda
Browse files

[-bug] sympa.pl.spooler.pl: root or sympa privilege was needed to run with...

[-bug] sympa.pl.spooler.pl: root or sympa privilege was needed to run with --help or --version option.  Process these options before configuration files are read.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@9004 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 5984f5b6
......@@ -147,6 +147,16 @@ $main::options{'foreground'} = 1
$main::options{'log_to_stderr'} = 1 unless ($main::options{'batch'});
if ($main::options{'help'}) {
pod2usage(0);
} elsif ($main::options{'version'}) {
print $version_string;
exit 0;
}
## Main loop
my %loop_info;
# this loop is run foreach HUP signal received
......@@ -307,14 +317,10 @@ while ($signal ne 'term') { #as long as a SIGTERM is not received }
## Most initializations have now been done.
Log::do_log('notice', "Sympa spooler %s started",
Sympa::Constants::VERSION);
## Check for several files.
## ToDo: Check for several files.
## Prevent that 2 processes perform checks at the same time...
if ($main::options{'help'}) {
pod2usage(0);
} elsif ($main::options{'version'}) {
print $version_string;
exit 0;
}
## Do we have right access in the directory
if ($main::options{'keepcopy'}) {
if (!-d $main::options{'keepcopy'}) {
......
......@@ -309,9 +309,14 @@ $main::options{'log_to_stderr'} = 1
$main::options{'test_database_message_buffer'} ||
$main::options{'conf_2_db'});
## Health check: --health_check option
if ($main::options{'help'}) {
print pod2usage(0);
} elsif ($main::options{'version'}) {
print $version_string;
exit 0;
} elsif ($main::options{'health_check'}) {
## Health check
if (!$main::options{'help'} and $main::options{'health_check'}) {
## Load configuration file. Ignoring database config for now: it avoids
## trying to load a database that could not exist yet.
unless (Site->load('no_db' => 1, 'force_reload' => 1)) {
......@@ -590,8 +595,6 @@ while ($signal ne 'term') { #as long as a SIGTERM is not received }
}
exit 0;
} elsif ($main::options{'help'}) {
print pod2usage(0);
} elsif ($main::options{'make_alias_file'}) {
my $all_lists = List::get_lists();
......@@ -613,10 +616,6 @@ while ($signal ne 'term') { #as long as a SIGTERM is not received }
"Sympa aliases file %s was made. You probably need to install it in your SMTP engine\n",
$aliases_file;
exit 0;
} elsif ($main::options{'version'}) {
print $version_string;
exit 0;
} elsif ($main::options{'md5_digest'}) {
my $md5 = &tools::md5_fingerprint($main::options{'md5_digest'});
......
......@@ -17,9 +17,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=encoding utf-8
=head1 NAME
sympa_wizard.pl - help perform Sympa initial setup
sympa_wizard.pl - help performing Sympa initial setup
=head1 SYNOPSIS
......@@ -29,18 +31,22 @@ sympa_wizard.pl - help perform Sympa initial setup
Edit current Sympa configuration
=item sympa_wizard.pl [--target file] --create
=item sympa_wizard.pl --check
Creates a new sympa.conf configuration file
Check CPAN modules needed for running Sympa
=item sympa_wizard.pl --check
=item sympa_wizard.pl [--target file] --create
check CPAN modules needed for running Sympa
Creates a new sympa.conf configuration file
=item sympa_wizard.pl --help
Display usage instructions
=item sympa_wizard.pl --version
Print version number.
=back
=head1 AUTHORS
......@@ -75,17 +81,24 @@ BEGIN {
## sympa configuration file
my $sympa_conf = Sympa::Constants::CONFIG;
## version string.
my $version_string =
sprintf "Sympa version is %s\n", Sympa::Constants::VERSION;
my %options;
GetOptions(
\%options,
'target=s',
'create:s', # parameter is optional
'check',
'help'
'help',
'version'
);
if ($options{help}) {
pod2usage();
} elsif ($options{'version'}) {
print $version_string;
} elsif (defined $options{create}) {
create_configuration();
} elsif ($options{check}) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment