aboutsummaryrefslogtreecommitdiffstats
path: root/apanel.pl
blob: 98838a222c03cc828fce0b1ccc37e68117ec539d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/perl
# vim: set et ts=4 sw=4:
#    Copyright 2012 Steven Tucker
#
#    This file is part of AdminPanel
#
#    AdminPanel 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 2 of the License, or
#    (at your option) any later version.
#
#    AdminPanel 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 AdminPanel.  If not, see <http://www.gnu.org/licenses/>.

use strict;
use warnings;
use diagnostics;
use AdminPanel::Privileges;
use FindBin;
use lib "$FindBin::RealBin";
use MainDisplay;
use yui;

my $cmdline = new yui::YCommandLine;

usage() if($cmdline->find("--help") > 0 || $cmdline->find("-h") > 0);

ask_for_authentication($USE_PKIT) if(require_root_capability());

my $mainWin = new MainDisplay();
my $launch = $mainWin->start();

while ($launch) {
    $mainWin->destroy();
    undef($mainWin);

    my $err = yui::YUI::app()->runInTerminal("$launch --ncurses");
    if ($err == -1) {
        system($launch);
    }

    $mainWin = new MainDisplay();
    $launch = $mainWin->start();
}

$mainWin->destroy();
undef($mainWin);

sub usage {
    print "\n";
    print "Usage apanel [options...]\n\n";
    print "Options:\n";
    print "\t--help | -h        print this help\n";
## anaselli: --name now is used only to add a path to /etc (e.g. --name mcc2 means /etc/mcc2)
    #          and it is overriden by --conf_dir, so it should be discussed better to understand
    #          if it is really needed any more. 
    #          Window title is got from settings.conf (key title)
    print "\t--name string      specify the window title of the administration panel\n";
    print "\t--conf_dir path    specify the settings.conf file directory\n";
    print "\n";
    exit(0);
}

=pod

=head1 main
       
       main launcher

=cut