aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes4
-rw-r--r--lib/AdminPanel/Module/Services.pm14
-rw-r--r--lib/AdminPanel/Shared/Services.pm15
-rwxr-xr-xscripts/mana3
4 files changed, 21 insertions, 15 deletions
diff --git a/Changes b/Changes
index 381cd58..988fa0a 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,8 @@
1.0.0-8
+ - manaservice: fixed service disappeared after enabling
+ at boot and refreshing service status
+ - manaservice: managed new flag dbus_auth_interactive to
+ to work in user space (thanks Colin)
- rpmdragora: find string if present, after changing the
filter
- rpmdragora: gurpm module moved to Moose and allowed
diff --git a/lib/AdminPanel/Module/Services.pm b/lib/AdminPanel/Module/Services.pm
index 168e275..7ca3d8e 100644
--- a/lib/AdminPanel/Module/Services.pm
+++ b/lib/AdminPanel/Module/Services.pm
@@ -221,13 +221,13 @@ sub BUILD {
sub start {
my $self = shift;
- if ($EUID != 0) {
- $self->sh_gui->warningMsgBox({
- title => $self->name,
- text => $self->loc->N("root privileges required"),
- });
- return;
- }
+# if ($EUID != 0) {
+# $self->sh_gui->warningMsgBox({
+# title => $self->name,
+# text => $self->loc->N("root privileges required"),
+# });
+# return;
+# }
$self->_servicePanel();
};
diff --git a/lib/AdminPanel/Shared/Services.pm b/lib/AdminPanel/Shared/Services.pm
index 4425165..8900201 100644
--- a/lib/AdminPanel/Shared/Services.pm
+++ b/lib/AdminPanel/Shared/Services.pm
@@ -61,6 +61,7 @@ use Moose;
use Sys::Syslog;
use Net::DBus;
+use Net::DBus::Annotation qw(:auth);
use File::Basename;
use AdminPanel::Shared::Locales;
@@ -171,7 +172,7 @@ sub _serviceInfoInitialization {
if (!$services{$name} &&
$name !~ /.*\@$/g &&
(-e $s->[0] or -e "/etc/rc.d/init.d/$name") &&
- ! -l $s->[0] && $st eq "disabled") {
+ ! -l $s->[0] && ($st eq "disabled" || $st eq "enabled")) {
my $wantedby = $self->_WantedBy($s->[0]);
if ($wantedby) {
my $descr = $self->getUnitProperty($name, 'Description');
@@ -179,7 +180,7 @@ sub _serviceInfoInitialization {
$services{$name} = {
'name' => $name,
'description' => $descr,
- 'enabled' => 0,
+ 'enabled' => $st eq "enabled",
};
}
}
@@ -378,10 +379,10 @@ sub set_service {
$service = $service . ".service";
my $dbus_object = $self->dbus_systemd1_object;
if ($enable) {
- $dbus_object->EnableUnitFiles([$service], 0, 1);
+ $dbus_object->EnableUnitFiles(dbus_auth_interactive, [$service], 0, 1);
}
else {
- $dbus_object->DisableUnitFiles([$service], 0);
+ $dbus_object->DisableUnitFiles(dbus_auth_interactive, [$service], 0);
}
# reload local cache
$self->_systemd_services(1);
@@ -402,13 +403,13 @@ sub _run_action {
if ($self->_running_systemd()) {
my $object = $self->dbus_systemd1_object;
if ($action eq 'start') {
- $object->StartUnit("$service.service", 'fail');
+ $object->StartUnit(dbus_auth_interactive, "$service.service", 'fail');
}
elsif ($action eq 'stop') {
- $object->StopUnit("$service.service", 'fail');
+ $object->StopUnit(dbus_auth_interactive, "$service.service", 'fail');
}
else {
- $object->RestartUnit("$service.service", 'fail');
+ $object->RestartUnit(dbus_auth_interactive, "$service.service", 'fail');
}
# reload local cache
$self->_systemd_services(1);
diff --git a/scripts/mana b/scripts/mana
index c8d1d2e..c436fc7 100755
--- a/scripts/mana
+++ b/scripts/mana
@@ -37,6 +37,7 @@ my %modules = (
service => {
exec => '/usr/bin/manaservice',
descr => "manaservice: service manager",
+ user_mode => 1,
},
dm => {
exec => '/usr/bin/manadm',
@@ -85,7 +86,7 @@ my $mod = $modules{$cmd}->{exec};
shift(@ARGV);
eval {
- if(is_root_capability_required()) {
+ if(!$modules{$cmd}->{user_mode} && is_root_capability_required()) {
system("/usr/bin/pkexec", $mod, @ARGV);
} else {
system($mod, @ARGV);