aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-01-06 19:59:29 +0100
committerAngelo Naselli <anaselli@linux.it>2014-01-06 19:59:29 +0100
commite4abf51415f1871a29f81b2c033fda0cb64a276a (patch)
treeddca8e169a4c2724bf4257c0955ec035bd35d479
parent00950d42d1eaed19349aecfbc3ff2fe34ee7c905 (diff)
downloadcolin-keep-e4abf51415f1871a29f81b2c033fda0cb64a276a.tar
colin-keep-e4abf51415f1871a29f81b2c033fda0cb64a276a.tar.gz
colin-keep-e4abf51415f1871a29f81b2c033fda0cb64a276a.tar.bz2
colin-keep-e4abf51415f1871a29f81b2c033fda0cb64a276a.tar.xz
colin-keep-e4abf51415f1871a29f81b2c033fda0cb64a276a.zip
- Admin service is now splitted (gui and utility)
- Admin service extends Module - fixed load modules from categories.conf.d
-rw-r--r--AdminPanel/Services/AdminService.pm385
-rw-r--r--AdminPanel/Services/Utility.pm (renamed from AdminPanel/Services/services.pm)189
-rw-r--r--Category.pm3
-rw-r--r--MainDisplay.pm3
-rwxr-xr-xapanel.pl26
-rwxr-xr-xmodules/services/adminService (renamed from modules/services/servicemanager)6
-rwxr-xr-xmodules/usermanager/adminUser (renamed from modules/usermanager/usermanager)0
7 files changed, 424 insertions, 188 deletions
diff --git a/AdminPanel/Services/AdminService.pm b/AdminPanel/Services/AdminService.pm
new file mode 100644
index 0000000..2f3f1d9
--- /dev/null
+++ b/AdminPanel/Services/AdminService.pm
@@ -0,0 +1,385 @@
+# vim: set et ts=4 sw=4:
+#*****************************************************************************
+#
+# Copyright (c) 2013 Angelo Naselli <anaselli@linux.it>
+# from drakx services
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2, as
+# published by the Free Software Foundation.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#*****************************************************************************
+
+package AdminPanel::Services::AdminService;
+
+
+
+
+#-######################################################################################
+#- misc imports
+#-######################################################################################
+
+use strict;
+use common;
+use run_program;
+
+use Moose;
+
+use yui;
+use AdminPanel::Shared;
+use AdminPanel::Services::Utility qw(
+ services
+ xinetd_services
+ is_service_running
+ restart_or_start
+ stop
+ set_service
+ );
+
+use File::Basename;
+
+extends qw( Module );
+
+has '+icon' => (
+ default => "/usr/share/mcc/themes/default/service-mdk.png",
+);
+
+has '+name' => (
+ default => N("AdminService"),
+);
+
+
+=head1 VERSION
+
+Version 1.0.0
+
+=cut
+
+our $VERSION = '1.0.0';
+
+
+sub description {
+ my %services = (
+acpid => N_("Listen and dispatch ACPI events from the kernel"),
+alsa => N_("Launch the ALSA (Advanced Linux Sound Architecture) sound system"),
+anacron => N_("Anacron is a periodic command scheduler."),
+apmd => N_("apmd is used for monitoring battery status and logging it via syslog.
+It can also be used for shutting down the machine when the battery is low."),
+atd => N_("Runs commands scheduled by the at command at the time specified when
+at was run, and runs batch commands when the load average is low enough."),
+'avahi-deamon' => N_("Avahi is a ZeroConf daemon which implements an mDNS stack"),
+chronyd => N_("An NTP client/server"),
+cpufreq => N_("Set CPU frequency settings"),
+crond => N_("cron is a standard UNIX program that runs user-specified programs
+at periodic scheduled times. vixie cron adds a number of features to the basic
+UNIX cron, including better security and more powerful configuration options."),
+cups => N_("Common UNIX Printing System (CUPS) is an advanced printer spooling system"),
+dm => N_("Launches the graphical display manager"),
+fam => N_("FAM is a file monitoring daemon. It is used to get reports when files change.
+It is used by GNOME and KDE"),
+g15daemon => N_("G15Daemon allows users access to all extra keys by decoding them and
+pushing them back into the kernel via the linux UINPUT driver. This driver must be loaded
+before g15daemon can be used for keyboard access. The G15 LCD is also supported. By default,
+with no other clients active, g15daemon will display a clock. Client applications and
+scripts can access the LCD via a simple API."),
+gpm => N_("GPM adds mouse support to text-based Linux applications such the
+Midnight Commander. It also allows mouse-based console cut-and-paste operations,
+and includes support for pop-up menus on the console."),
+haldaemon => N_("HAL is a daemon that collects and maintains information about hardware"),
+harddrake => N_("HardDrake runs a hardware probe, and optionally configures
+new/changed hardware."),
+httpd => N_("Apache is a World Wide Web server. It is used to serve HTML files and CGI."),
+inet => N_("The internet superserver daemon (commonly called inetd) starts a
+variety of other internet services as needed. It is responsible for starting
+many services, including telnet, ftp, rsh, and rlogin. Disabling inetd disables
+all of the services it is responsible for."),
+ip6tables => N_("Automates a packet filtering firewall with ip6tables"),
+iptables => N_("Automates a packet filtering firewall with iptables"),
+irqbalance => N_("Evenly distributes IRQ load across multiple CPUs for enhanced performance"),
+keytable => N_("This package loads the selected keyboard map as set in
+/etc/sysconfig/keyboard. This can be selected using the kbdconfig utility.
+You should leave this enabled for most machines."),
+kheader => N_("Automatic regeneration of kernel header in /boot for
+/usr/include/linux/{autoconf,version}.h"),
+kudzu => N_("Automatic detection and configuration of hardware at boot."),
+'laptop-mode' => N_("Tweaks system behavior to extend battery life"),
+linuxconf => N_("Linuxconf will sometimes arrange to perform various tasks
+at boot-time to maintain the system configuration."),
+lpd => N_("lpd is the print daemon required for lpr to work properly. It is
+basically a server that arbitrates print jobs to printer(s)."),
+lvs => N_("Linux Virtual Server, used to build a high-performance and highly
+available server."),
+mandi => N_("Monitors the network (Interactive Firewall and wireless"),
+mdadm => N_("Software RAID monitoring and management"),
+messagebus => N_("DBUS is a daemon which broadcasts notifications of system events and other messages"),
+msec => N_("Enables MSEC security policy on system startup"),
+named => N_("named (BIND) is a Domain Name Server (DNS) that is used to resolve host names to IP addresses."),
+netconsole => N_("Initializes network console logging"),
+netfs => N_("Mounts and unmounts all Network File System (NFS), SMB (Lan
+Manager/Windows), and NCP (NetWare) mount points."),
+network => N_("Activates/Deactivates all network interfaces configured to start
+at boot time."),
+'network-auth' => N_("Requires network to be up if enabled"),
+'network-up' => N_("Wait for the hotplugged network to be up"),
+nfs => N_("NFS is a popular protocol for file sharing across TCP/IP networks.
+This service provides NFS server functionality, which is configured via the
+/etc/exports file."),
+nfslock => N_("NFS is a popular protocol for file sharing across TCP/IP
+networks. This service provides NFS file locking functionality."),
+ntpd => N_("Synchronizes system time using the Network Time Protocol (NTP)"),
+numlock => N_("Automatically switch on numlock key locker under console
+and Xorg at boot."),
+oki4daemon => N_("Support the OKI 4w and compatible winprinters."),
+partmon => N_("Checks if a partition is close to full up"),
+pcmcia => N_("PCMCIA support is usually to support things like ethernet and
+modems in laptops. It will not get started unless configured so it is safe to have
+it installed on machines that do not need it."),
+portmap => N_("The portmapper manages RPC connections, which are used by
+protocols such as NFS and NIS. The portmap server must be running on machines
+which act as servers for protocols which make use of the RPC mechanism."),
+portreserve => N_("Reserves some TCP ports"),
+postfix => N_("Postfix is a Mail Transport Agent, which is the program that moves mail from one machine to another."),
+random => N_("Saves and restores system entropy pool for higher quality random
+number generation."),
+rawdevices => N_("Assign raw devices to block devices (such as hard disk drive
+partitions), for the use of applications such as Oracle or DVD players"),
+resolvconf => N_("Nameserver information manager"),
+routed => N_("The routed daemon allows for automatic IP router table updated via
+the RIP protocol. While RIP is widely used on small networks, more complex
+routing protocols are needed for complex networks."),
+rstatd => N_("The rstat protocol allows users on a network to retrieve
+performance metrics for any machine on that network."),
+rsyslog => N_("Syslog is the facility by which many daemons use to log messages to various system log files. It is a good idea to always run rsyslog."),
+rusersd => N_("The rusers protocol allows users on a network to identify who is
+logged in on other responding machines."),
+rwhod => N_("The rwho protocol lets remote users get a list of all of the users
+logged into a machine running the rwho daemon (similar to finger)."),
+saned => N_("SANE (Scanner Access Now Easy) enables to access scanners, video cameras, ..."),
+shorewall => N_("Packet filtering firewall"),
+smb => N_("The SMB/CIFS protocol enables to share access to files & printers and also integrates with a Windows Server domain"),
+sound => N_("Launch the sound system on your machine"),
+'speech-dispatcherd' => N_("layer for speech analysis"),
+sshd => N_("Secure Shell is a network protocol that allows data to be exchanged over a secure channel between two computers"),
+syslog => N_("Syslog is the facility by which many daemons use to log messages
+to various system log files. It is a good idea to always run syslog."),
+'udev-post' => N_("Moves the generated persistent udev rules to /etc/udev/rules.d"),
+usb => N_("Load the drivers for your usb devices."),
+vnStat => N_("A lightweight network traffic monitor"),
+xfs => N_("Starts the X Font Server."),
+xinetd => N_("Starts other deamons on demand."),
+ );
+ my ($name) = @_;
+ my $s = $services{$name};
+ if ($s) {
+ $s = translate($s);
+ } else {
+ my $file = "$::prefix/usr/lib/systemd/system/$name.service";
+ if (-e $file) {
+ $s = cat_($file);
+ $s = $s =~ /^Description=(.*)/mg ? $1 : '';
+ } else {
+ $file = find { -e $_ } map { "$::prefix$_/$name" } '/etc/rc.d/init.d', '/etc/init.d', '/etc/xinetd.d';
+ $s = cat_($file);
+ $s =~ s/\\\s*\n#\s*//mg;
+ $s =
+ $s =~ /^#\s+(?:Short-)?[dD]escription:\s+(.*?)^(?:[^#]|# {0,2}\S)/sm ? $1 :
+ $s =~ /^#\s*(.*?)^[^#]/sm ? $1 : '';
+
+ $s =~ s/#\s*//mg;
+ }
+ }
+ $s =~ s/\n/ /gm; $s =~ s/\s+$//;
+ $s;
+}
+
+
+sub start {
+ my $self = shift;
+
+ $self->servicePanel();
+};
+
+
+## serviceInfo sets widgets accordingly to selected service status
+## param
+## 'service' service name
+## 'infoPanel' service information widget
+sub serviceInfo {
+ my ($self, $service, $infoPanel) = @_;
+
+ yui::YUI::ui()->blockEvents();
+ ## infoPanel
+ $infoPanel->setValue(formatAlaTeX(description($service)));
+ yui::YUI::ui()->unblockEvents();
+}
+
+sub serviceStatus {
+ my ($self, $tbl, $item) = @_;
+
+ my $started = (is_service_running($item->label())? N("running") : N("stopped"));
+# TODO add icon green/red led
+ my $cell = $tbl->toCBYTableItem($item)->cell(1);
+ if ($cell) {
+ $cell->setLabel($started);
+ $tbl->cellChanged($cell);
+ }
+}
+
+## draw service panel and manage it
+sub servicePanel {
+ my $self = shift;
+
+ my $appTitle = yui::YUI::app()->applicationTitle();
+ ## set new title to get it in dialog
+ yui::YUI::app()->setApplicationTitle(N("Services and daemons"));
+
+ my ($l, $on_services) = services();
+ my @xinetd_services = map { $_->[0] } xinetd_services();
+
+ my $mageiaPlugin = "mga";
+ my $factory = yui::YUI::widgetFactory;
+ my $mgaFactory = yui::YExternalWidgets::externalWidgetFactory($mageiaPlugin);
+ $mgaFactory = yui::YMGAWidgetFactory::getYMGAWidgetFactory($mgaFactory);
+
+ my $dialog = $factory->createMainDialog;
+ my $vbox = $factory->createVBox( $dialog );
+ my $frame = $factory->createFrame ($vbox, N("Services"));
+
+ my $frmVbox = $factory->createVBox( $frame );
+ my $hbox = $factory->createHBox( $frmVbox );
+
+ my $yTableHeader = new yui::YTableHeader();
+ $yTableHeader->addColumn(N("Service"), $yui::YAlignBegin);
+ $yTableHeader->addColumn(N("Status"), $yui::YAlignCenter);
+ $yTableHeader->addColumn(N("On boot"), $yui::YAlignBegin);
+
+ ## service list (serviceBox)
+ my $serviceTbl = $mgaFactory->createCBTable($hbox, $yTableHeader, $yui::YCBTableCheckBoxOnLastColumn);
+ my $itemCollection = new yui::YItemCollection;
+ foreach (@$l) {
+ my $serviceName = $_;
+
+ my $item = new yui::YCBTableItem($serviceName);
+ my $started = (is_service_running($serviceName)? N("running") : N("stopped"));
+# TODO add icon green/red led
+ my $cell = new yui::YTableCell($started);
+ $item->addCell($cell);
+ $item->check(member($serviceName, @$on_services));
+ $item->setLabel($serviceName);
+ $itemCollection->push($item);
+ $item->DISOWN();
+ }
+ $serviceTbl->addItems($itemCollection);
+ $serviceTbl->setImmediateMode(1);
+ $serviceTbl->setWeight(0, 50);
+
+ ## info panel (infoPanel)
+ $frame = $factory->createFrame ($hbox, N("Information"));
+ $frame->setWeight(0, 30);
+ $frmVbox = $factory->createVBox( $frame );
+ my $infoPanel = $factory->createRichText($frmVbox, "--------------"); #, 0, 0);
+ $infoPanel->setAutoScrollDown();
+
+ ### Service Start button ($startButton)
+ $hbox = $factory->createHBox( $frmVbox );
+ my $startButton = $factory->createPushButton($hbox, N("Start"));
+
+ ### Service Stop button ($stopButton)
+ my $stopButton = $factory->createPushButton($hbox, N("Stop"));
+
+ # dialog buttons
+ $factory->createVSpacing($vbox, 1.0);
+ ## Window push buttons
+ $hbox = $factory->createHBox( $vbox );
+ my $align = $factory->createLeft($hbox);
+ $hbox = $factory->createHBox($align);
+ my $aboutButton = $factory->createPushButton($hbox, N("About") );
+ $align = $factory->createRight($hbox);
+ $hbox = $factory->createHBox($align);
+ my $closeButton = $factory->createPushButton($hbox, N("Close") );
+
+ #first item status
+ my $item = $serviceTbl->selectedItem();
+ $self->serviceInfo($item->label(), $infoPanel) if ($item);
+
+ while(1) {
+ my $event = $dialog->waitForEvent();
+ my $eventType = $event->eventType();
+
+ #event type checking
+ if ($eventType == $yui::YEvent::CancelEvent) {
+ last;
+ }
+ elsif ($eventType == $yui::YEvent::WidgetEvent) {
+ # widget selected
+ my $widget = $event->widget();
+
+ if ($widget == $closeButton) {
+ last;
+ }
+ elsif ($widget == $aboutButton) {
+ my $license = translate($::license);
+ # TODO fix version value
+ AboutDialog({ name => N("Services and daemons"),
+ version => "1.0.0",
+ copyright => N("Copyright (C) %s Mageia community", '2013-2014'),
+ license => $license,
+ comments => N("Service Manager is the Mageia service and daemon management tool \n(from the original idea of Mandriva draxservice)."),
+ website => 'http://www.mageia.org',
+ website_label => N("Mageia"),
+ authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>",
+ translator_credits =>
+ #-PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>")
+ N("_: Translator(s) name(s) & email(s)\n")}
+ );
+ }
+ elsif ($widget == $serviceTbl) {
+ # service selection changed
+ $item = $serviceTbl->selectedItem();
+ $self->serviceInfo($item->label(), $infoPanel) if ($item);
+ $item = $serviceTbl->changedItem();
+ if ($item) {
+ set_service($item->label(), $item->checked());
+ # we can push/pop service, but this (slower) should return real situation
+ ($l, $on_services) = services();
+ }
+ }
+ elsif ($widget == $startButton) {
+ $item = $serviceTbl->selectedItem();
+ if ($item) {
+ restart_or_start($item->label());
+ # we can push/pop service, but this (slower) should return real situation
+ ($l, $on_services) = services();
+ $self->serviceStatus($serviceTbl, $item);
+ }
+ }
+ elsif ($widget == $stopButton) {
+ $item = $serviceTbl->selectedItem();
+ if ($item) {
+ stop($item->label());
+ # we can push/pop service, but this (slower) should return real situation
+ ($l, $on_services) = services();
+ $self->serviceStatus($serviceTbl, $item);
+ }
+ }
+ }
+ }
+ $dialog->destroy();
+
+ #restore old application title
+ yui::YUI::app()->setApplicationTitle($appTitle);
+}
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/AdminPanel/Services/services.pm b/AdminPanel/Services/Utility.pm
index 7b795bc..baae3db 100644
--- a/AdminPanel/Services/services.pm
+++ b/AdminPanel/Services/Utility.pm
@@ -19,7 +19,7 @@
#
#*****************************************************************************
-package AdminPanel::Services::services;
+package AdminPanel::Services::Utility;
@@ -32,10 +32,18 @@ use strict;
use common;
use run_program;
-use yui;
-use AdminPanel::Shared;
-
-use File::Basename;
+use File::Basename qw( basename );
+use base qw(Exporter);
+
+our @EXPORT = qw(
+ services
+ xinetd_services
+ is_service_running
+ restart_or_start
+ stop
+ start
+ set_service
+ );
sub description {
my %services = (
@@ -172,169 +180,7 @@ xinetd => N_("Starts other deamons on demand."),
}
-## serviceInfo sets widgets accordingly to selected service status
-## param
-## 'service' service name
-## 'infoPanel' service information widget
-sub serviceInfo {
- my ($service, $infoPanel) = @_;
-
- yui::YUI::ui()->blockEvents();
- ## infoPanel
- $infoPanel->setValue(formatAlaTeX(description($service)));
- yui::YUI::ui()->unblockEvents();
-}
-
-sub serviceStatus {
- my ($tbl, $item) = @_;
-
- my $started = (is_service_running($item->label())? N("running") : N("stopped"));
-# TODO add icon green/red led
- my $cell = $tbl->toCBYTableItem($item)->cell(1);
- if ($cell) {
- $cell->setLabel($started);
- $tbl->cellChanged($cell);
- }
-}
-
-## draw service panel and manage it
-sub servicePanel {
- my ($l, $on_services) = services();
- my @xinetd_services = map { $_->[0] } xinetd_services();
-
- my $mageiaPlugin = "mga";
- my $factory = yui::YUI::widgetFactory;
- my $mgaFactory = yui::YExternalWidgets::externalWidgetFactory($mageiaPlugin);
- $mgaFactory = yui::YMGAWidgetFactory::getYMGAWidgetFactory($mgaFactory);
-
- my $dialog = $factory->createMainDialog;
- my $vbox = $factory->createVBox( $dialog );
- my $frame = $factory->createFrame ($vbox, N("Services"));
-
- my $frmVbox = $factory->createVBox( $frame );
- my $hbox = $factory->createHBox( $frmVbox );
-
- my $yTableHeader = new yui::YTableHeader();
- $yTableHeader->addColumn(N("Service"), $yui::YAlignBegin);
- $yTableHeader->addColumn(N("Status"), $yui::YAlignCenter);
- $yTableHeader->addColumn(N("On boot"), $yui::YAlignBegin);
-
- ## service list (serviceBox)
- my $serviceTbl = $mgaFactory->createCBTable($hbox, $yTableHeader, $yui::YCBTableCheckBoxOnLastColumn);
- my $itemCollection = new yui::YItemCollection;
- foreach (@$l) {
- my $serviceName = $_;
-
- my $item = new yui::YCBTableItem($serviceName);
- my $started = (is_service_running($serviceName)? N("running") : N("stopped"));
-# TODO add icon green/red led
- my $cell = new yui::YTableCell($started);
- $item->addCell($cell);
- $item->check(member($serviceName, @$on_services));
- $item->setLabel($serviceName);
- $itemCollection->push($item);
- $item->DISOWN();
- }
- $serviceTbl->addItems($itemCollection);
- $serviceTbl->setImmediateMode(1);
- $serviceTbl->setWeight(0, 50);
-
- ## info panel (infoPanel)
- $frame = $factory->createFrame ($hbox, N("Information"));
- $frame->setWeight(0, 30);
- $frmVbox = $factory->createVBox( $frame );
- my $infoPanel = $factory->createRichText($frmVbox, "--------------"); #, 0, 0);
- $infoPanel->setAutoScrollDown();
-
- ### Service Start button ($startButton)
- $hbox = $factory->createHBox( $frmVbox );
- my $startButton = $factory->createPushButton($hbox, N("Start"));
-
- ### Service Stop button ($stopButton)
- my $stopButton = $factory->createPushButton($hbox, N("Stop"));
-
- # dialog buttons
- $factory->createVSpacing($vbox, 1.0);
- ## Window push buttons
- $hbox = $factory->createHBox( $vbox );
- my $align = $factory->createLeft($hbox);
- $hbox = $factory->createHBox($align);
- my $aboutButton = $factory->createPushButton($hbox, N("About") );
- $align = $factory->createRight($hbox);
- $hbox = $factory->createHBox($align);
- my $closeButton = $factory->createPushButton($hbox, N("Close") );
-
- #first item status
- my $item = $serviceTbl->selectedItem();
- serviceInfo($item->label(), $infoPanel) if ($item);
-
- while(1) {
- my $event = $dialog->waitForEvent();
- my $eventType = $event->eventType();
-
- #event type checking
- if ($eventType == $yui::YEvent::CancelEvent) {
- last;
- }
- elsif ($eventType == $yui::YEvent::WidgetEvent) {
- # widget selected
- my $widget = $event->widget();
-
- if ($widget == $closeButton) {
- last;
- }
- elsif ($widget == $aboutButton) {
- my $license = translate($::license);
- # TODO fix version value
- AboutDialog({ name => N("Services and daemons"),
- version => "1.0.0",
- copyright => N("Copyright (C) %s Mageia community", '2013-2014'),
- license => $license,
- comments => N("Service Manager is the Mageia service and daemon management tool \n(from the original idea of Mandriva draxservice)."),
- website => 'http://www.mageia.org',
- website_label => N("Mageia"),
- authors => "Angelo Naselli <anaselli\@linux.it>\nMatteo Pasotti <matteo.pasotti\@gmail.com>",
- translator_credits =>
- #-PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>")
- N("_: Translator(s) name(s) & email(s)\n")}
- );
- }
- elsif ($widget == $serviceTbl) {
- # service selection changed
- $item = $serviceTbl->selectedItem();
- serviceInfo($item->label(), $infoPanel) if ($item);
- $item = $serviceTbl->changedItem();
- if ($item) {
- _set_service($item->label(), $item->checked());
- # we can push/pop service, but this (slower) should return real situation
- ($l, $on_services) = services();
- }
- }
- elsif ($widget == $startButton) {
- $item = $serviceTbl->selectedItem();
- if ($item) {
- restart_or_start($item->label());
- # we can push/pop service, but this (slower) should return real situation
- ($l, $on_services) = services();
- serviceStatus($serviceTbl, $item);
- }
- }
- elsif ($widget == $stopButton) {
- $item = $serviceTbl->selectedItem();
- if ($item) {
- stop($item->label());
- # we can push/pop service, but this (slower) should return real situation
- ($l, $on_services) = services();
- serviceStatus($serviceTbl, $item);
- }
- }
- }
- }
- $dialog->destroy();
-}
-
-
-sub _set_service {
+sub set_service {
my ($service, $enable) = @_;
my @xinetd_services = map { $_->[0] } xinetd_services();
@@ -344,7 +190,8 @@ sub _set_service {
} elsif (running_systemd() || has_systemd()) {
# systemctl rejects any symlinked units. You have to enabled the real file
if (-l "/lib/systemd/system/$service.service") {
- $service = basename(readlink("/lib/systemd/system/$service.service"));
+ my $name = readlink("/lib/systemd/system/$service.service");
+ $service = File::Basename::basename($name);
} else {
$service = $service . ".service";
}
@@ -567,12 +414,12 @@ sub starts_on_boot {
sub start_service_on_boot ($) {
my ($service) = @_;
- _set_service($service, 1);
+ set_service($service, 1);
}
sub do_not_start_service_on_boot ($) {
my ($service) = @_;
- _set_service($service, 0);
+ set_service($service, 0);
}
sub enable {
diff --git a/Category.pm b/Category.pm
index 69eafc6..7191fab 100644
--- a/Category.pm
+++ b/Category.pm
@@ -68,9 +68,10 @@ sub new {
#=============================================================
sub loadModule {
my ($self, $module) = @_;
-
+
if (!$self->moduleLoaded($module)) {
push ( @{$self->{modules}}, $module );
+
return 1;
}
return 0;
diff --git a/MainDisplay.pm b/MainDisplay.pm
index 51c6a1e..afb730f 100644
--- a/MainDisplay.pm
+++ b/MainDisplay.pm
@@ -295,7 +295,7 @@ sub getCategory {
foreach $category (@{$self->{categories}}) {
if ($category->{name} eq $name) {
- last;
+ return $category;
}
}
@@ -368,7 +368,6 @@ sub loadCategories {
$hasNextMod = $inFile->hasNextMod();
}
}
- undef($tmpCat);
}
}
diff --git a/apanel.pl b/apanel.pl
index e2042da..38755eb 100755
--- a/apanel.pl
+++ b/apanel.pl
@@ -36,21 +36,21 @@ my $settings = getSettings();
ask_for_authentication($settings->{priv_method}) if(require_root_capability());
-my $mainWin = new MainDisplay();
-my $launch = $mainWin->start();
+while (1) {
+ my $mainWin = new MainDisplay();
+ my $launch = $mainWin->start();
-while ($launch) {
- $mainWin->destroy();
- undef($mainWin);
-
- $launch->start();
-
- $mainWin = new MainDisplay();
- $launch = $mainWin->start();
+ if ($launch) {
+ $launch->start();
+ undef($mainWin);
+ }
+ else {
+ $mainWin->destroy();
+ undef($mainWin);
+ last;
+ }
}
-$mainWin->destroy();
-undef($mainWin);
sub usage {
print "\n";
@@ -90,3 +90,5 @@ sub getSettings {
main launcher
=cut
+
+1;
diff --git a/modules/services/servicemanager b/modules/services/adminService
index 670abbe..d4f8fe3 100755
--- a/modules/services/servicemanager
+++ b/modules/services/adminService
@@ -7,7 +7,7 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla
use common;
use AdminPanel::Shared;
-use AdminPanel::Services::services;
+use AdminPanel::Services::AdminService;
use log;
use yui;
@@ -17,5 +17,7 @@ my $wm_icon = "/usr/share/mcc/themes/default/service-mdk.png";
yui::YUI::app()->setApplicationTitle(N("Services and daemons"));
yui::YUI::app()->setApplicationIcon($wm_icon);
-AdminPanel::Services::services::servicePanel();
+my $serviceMan = AdminPanel::Services::AdminService->new();
+$serviceMan->start();
+1;
diff --git a/modules/usermanager/usermanager b/modules/usermanager/adminUser
index e4cbe5f..e4cbe5f 100755
--- a/modules/usermanager/usermanager
+++ b/modules/usermanager/adminUser