aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-09-13 16:33:30 +0200
committerAngelo Naselli <anaselli@linux.it>2014-09-13 16:33:30 +0200
commit7cbaf3e4e333fb7db0a357e8943e31e00e0c33dd (patch)
treea2a0ec2c44bdbc76c302d64a2c7aae635ecb3fca
parent0a8c0d48d11162cfd3b15ee1002983d0cc27190a (diff)
downloadmanatools-7cbaf3e4e333fb7db0a357e8943e31e00e0c33dd.tar
manatools-7cbaf3e4e333fb7db0a357e8943e31e00e0c33dd.tar.gz
manatools-7cbaf3e4e333fb7db0a357e8943e31e00e0c33dd.tar.bz2
manatools-7cbaf3e4e333fb7db0a357e8943e31e00e0c33dd.tar.xz
manatools-7cbaf3e4e333fb7db0a357e8943e31e00e0c33dd.zip
Added mana script to manage as script launcher
-rw-r--r--Changes2
-rw-r--r--MANIFEST1
-rw-r--r--Makefile.PL1
-rwxr-xr-xscripts/mana47
4 files changed, 51 insertions, 0 deletions
diff --git a/Changes b/Changes
index 0cf0a7e7..dbf37070 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
Revision history for AdminPanel-Shared
1.0.0-3
+ - added mana script to run pkexec into script for any tools
+ and as a single entry for desktop file
- dragora-urpm-sources.pl crashed updating media, if no media
are configured
- dragora-urpm-sources.pl crashed if no media are configured
diff --git a/MANIFEST b/MANIFEST
index f60d5e00..4c2fab2d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -66,6 +66,7 @@ modules/rpmdragora/dragora-urpm-sources.pl
modules/rpmdragora/rpmdragora
modules/test.cpp
README.md
+scripts/mana
scripts/manaadduser
scripts/manaclock
scripts/manahost
diff --git a/Makefile.PL b/Makefile.PL
index 9f0b4133..cd92bfd4 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -61,6 +61,7 @@ WriteMakefile(
"autodie" => 2.20,
},
EXE_FILES => [ qw( scripts/mpan.pl
+ scripts/mana
scripts/manaadduser
scripts/manaclock
scripts/manadm
diff --git a/scripts/mana b/scripts/mana
new file mode 100755
index 00000000..b4bc38bd
--- /dev/null
+++ b/scripts/mana
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+use AdminPanel::Privileges;
+
+use yui;
+
+# TODO from configuration file?
+my %modules = (
+ log => '/usr/bin/manalog',
+ user => '/usr/bin/manauser',
+ service => '/usr/bin/manaservice',
+ clock => '/usr/bin/manaclock',
+ host => '/usr/bin/manahost',
+ proxy => '/usr/bin/manaproxy',
+
+);
+
+my $cmdline = new yui::YCommandLine;
+
+usage() if($cmdline->find("--help") > 0 || $cmdline->find("-h") > 0);
+usage() if scalar(@ARGV) < 1;
+
+my $cmd = $ARGV[0];
+
+die "Command ". $cmd . " not found!\n" if !defined($modules{$cmd});
+
+my $mod = $modules{$cmd};
+shift(@ARGV);
+
+if(is_root_capability_required()) {
+ system("/usr/bin/pkexec", $mod, @ARGV);
+} else {
+ system($mod, @ARGV);
+}
+
+sub usage {
+ print "\n";
+ print "Usage mana --help | -h print this help\n";
+ print "Usage mana <command> [args...]\n\n";
+ print "valid <commands>:\n\t";
+# TODO better presentation
+ while ( my ($key, $value) = each(%modules) ) {
+ print " " . $key;
+ }
+ print "\n";
+ exit(0);
+}