#!/usr/bin/perl -w -DL

eval 'exec /usr/bin/perl -w -DL -S $0 ${1+"$@"}'
    if 0; # not running under some shell

use strict;

use lib qw(/usr/lib/intermezzo /usr/lib/intermezzo/i386-linux);

use Lento::Bootstrap;
use Lento::Psdev;
use Lento::Debuggable;
use POE qw(Wheel::SocketFactory Wheel::ReadWrite Driver::SysRW Filter::Line);

@::ISA = qw(Lento::Debuggable);
$::level = 0;
$::global_debug = -1000;

use vars qw($VERSION);

# Generate a floating-point number from MAJOR.MINOR[.PATCH[.TEST]]
# It's a monstrosity, but it has to fit on one line for MakeMaker's sake.
$VERSION = '1.0.0.0'; $VERSION =~ s/^(\d+.\d+)(\.(\d+)(\.(\d+))?)?$/$1 . sprintf ("%02d", defined $3 && $3) . sprintf ("%02d", defined $5 && $5) + 0/e;

=pod

=head1  NAME

lento - InterMezzo cache manager and file server

=head1  SYNOPSIS

lento [--idfile=system-id ][--configdir=path]

Other arguments listed below.

=head1  DESCRIPTION

Lento is the InterMezzo cache manager and file server.  Its startup
is managed by the the Bootstrap package, which instantiates a
POE::Session which is responsible for initiating the other services
needed in Lento.  This session merely executes its _start method.
Other sessions thereby become children of the Bootstrap session.


=head1 Arguments

Command line arguments:

=over 4

# =item B<--noclient> If this machine will not act as a client with
# respect to any fileset, this flag may be set.  No servers will be
# contacted (even if those servers are in fact replicators!).  The
# presto module is not needed when this flag is set.

=item B<--noserver> Do not run an Acceptor that accepts server requests.

=item B<--idfile=path> Gives the filename of an alternate file containing
the system id of this machine (default /etc/intermezzo/sysid). 

=item B<--configdir=path> Gives the pathname of the configuration directory
of this machine (default /etc/intermezzo).

=item B<--dbdir=path> Gives the pathname of the database directory of
this machine (default /var/intermezzo).

=item B<--debuglevel=level> override the global debuglevel. 

=item B<--deletedb> causes the persistent databases to be removed before
lento starts.  This is only used to recover an inconsistent system.

=back

=cut

#' The following just stops spurious warnings.
$::level = $::level;

STDOUT->autoflush(1);
STDERR->autoflush(1);

Lento::Bootstrap->start();

LOG "\n\n>>>>> Welcome to InterMezzo version $VERSION <<<<<\n\n\n";

$poe_kernel->run();

exit;
