aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo.pasotti@gmail.com>2013-08-19 19:18:02 +0200
committerMatteo Pasotti <matteo.pasotti@gmail.com>2013-08-19 19:18:02 +0200
commit03ccf8d0c5df0c17d3e31cb24a0d27ad81795435 (patch)
tree7899aff06e678e8af18e7a6b631ef7ae3e152bae
parent016b1c5d913d6065d18944fa9c768885a10ae6c9 (diff)
downloadcolin-keep-03ccf8d0c5df0c17d3e31cb24a0d27ad81795435.tar
colin-keep-03ccf8d0c5df0c17d3e31cb24a0d27ad81795435.tar.gz
colin-keep-03ccf8d0c5df0c17d3e31cb24a0d27ad81795435.tar.bz2
colin-keep-03ccf8d0c5df0c17d3e31cb24a0d27ad81795435.tar.xz
colin-keep-03ccf8d0c5df0c17d3e31cb24a0d27ad81795435.zip
read apanel settings to retrieve the method to gain superuser privileges
-rwxr-xr-xapanel.pl22
1 files changed, 21 insertions, 1 deletions
diff --git a/apanel.pl b/apanel.pl
index 03c5984..c6148c7 100755
--- a/apanel.pl
+++ b/apanel.pl
@@ -1,6 +1,7 @@
#!/usr/bin/perl
# vim: set et ts=4 sw=4:
# Copyright 2012 Steven Tucker
+# Copyright 2013 Matteo Pasotti
#
# This file is part of AdminPanel
#
@@ -23,6 +24,7 @@ use diagnostics;
use AdminPanel::Privileges;
use FindBin;
use lib "$FindBin::RealBin";
+use SettingsReader;
use MainDisplay;
use yui;
@@ -30,7 +32,9 @@ my $cmdline = new yui::YCommandLine;
usage() if($cmdline->find("--help") > 0 || $cmdline->find("-h") > 0);
-ask_for_authentication($USE_CHLP) if(require_root_capability());
+my $settings = getSettings();
+
+ask_for_authentication($settings->{priv_method}) if(require_root_capability());
my $mainWin = new MainDisplay();
my $launch = $mainWin->start();
@@ -66,6 +70,22 @@ sub usage {
exit(0);
}
+# adpanel settings
+sub getSettings {
+ my ($self) = @_;
+ # yui commandline parser
+ my $pos = $cmdline->find("--conf_dir");
+ my $confDir = "/etc/apanel";
+ if($pos > 0){
+ $confDir = $cmdline->arg($pos + 1);
+ }else{
+ $confDir = "/etc/apanel";
+ }
+ # configuration file name
+ my $fileName = "$confDir/settings.conf";
+ return new SettingsReader($fileName);
+}
+
=pod
=head1 main