#!/usr/bin/perl
# vim: set et ts=4 sw=4:
# Copyright 2012 Steven Tucker
# Copyright 2013 - 2015 Matteo Pasotti
# Copyright 2014 - 2015 Angelo Naselli
#
# This file is part of manatools
#
# ManaTools 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.
#
# ManaTools 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 ManaTools. If not, see .
use strict;
use warnings;
use diagnostics;
use ManaTools::Privileges;
use ManaTools::SettingsReader;
use ManaTools::MainDisplay;
use yui;
my $cmdline = new yui::YCommandLine;
usage() if $cmdline->find("--help") > 0 || $cmdline->find("-h") > 0;
my $settings = getSettings();
if ($cmdline->find("--dev") > 0) {
print "== Development mode ON\n";
}
else {
ask_for_authentication($settings->{priv_method}) if is_root_capability_required();
}
my $mainWin = new ManaTools::MainDisplay();
while (1) {
my $launch = $mainWin->start();
if ($launch) {
$mainWin->destroy();
$launch->start();
}
else {
$mainWin->destroy();
last;
}
$mainWin->setupGui();
}
sub usage {
print "\n";
print "Usage mpan [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 mana-tools panel\n";
print "\t--conf_dir path specify the settings.conf file directory\n";
print "\n";
exit(0);
}
# adpanel settings
sub getSettings {
my ($self) = @_;
my $confDir = "/etc/mpan";
# yui commandline parser
my $pos = $cmdline->find("--conf_dir");
if ($pos > 0) {
$confDir = $cmdline->arg($pos + 1);
}
else {
$pos = $cmdline->find("--name");
if ($pos > 0) {
$confDir = "/etc/" . $cmdline->arg($pos+1);
}
}
# configuration file name
my $fileName = "$confDir/settings.conf";
return new ManaTools::SettingsReader($fileName);
}
=pod
=head1 main
main launcher
=cut
1;
V(EHE@! m<b^"`HfY֯Z-3SJ=^ AF.#,ȋ "HH$`G5)*.EQ^xهحLN;R,St8k3:8x㞚$ǧ<^7e@IvТ*<Ɉ+HJf3
$HHc,Ż,݂ޖinjLIGeeҞ`p
I4iЖBPifXętw3F\RbM:j
:j
:j
8Ět1&] i5 i56KQ6KI4KI4I-wUoWW2b!fjZI g5S1"*
"d$AX T$ 86j4
AQ((Tb@H.Ǥ5C/HFq'-BASK-I?C!?[ul߆h$
SDOpS
2Ia$n%>/6^zm\LlH4(#aGw$;
bP"i $ED9'.8En;B:>ں=괡AU}:},?dG&䕞k9UﮱpBOHzXOŅ}S 3UJ.5'0ge3?S=سъ< @4OBB6 R$ZD@P71Ew0" Hr
Q B B(*5*UjN !@B PjIX_VfmBLE)1Վ[R0 ]8 FB&9DD_jHbTE@0Qf8VBDzrNDEv "@Ȝqe" ?'T!&F47C#еjtRlnݱn9N^QNNJ\J^B+1\$y1k[PBCjNξw+ ~TO 訩$ACD!ACMH=ϸ _/ﯛ1ը4{c+OЃbB0$g3__TwuO
)69uwb<TƮZkBߺ yn\aL?+$D
D xF[,vnwDS|ţU|?k.~r<JU$`Iէ)5_ATAWr'rCߙ|]eɏG-CsOG$OڻLHwgQgԩ:&+'Bѝ6'~E+wJGX>z?Å/@_!>T~
`:ǎJM,<{IE廒v4O#U%\ICAH&