Use new Pakfire::pakinfo function to determine installed addons and related services/initscripts more reliable. Signed-off-by: Robin Roevens --- html/cgi-bin/services.cgi | 96 ++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 37 deletions(-) diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi index 38b89ef1e..66b0d711f 100644 --- a/html/cgi-bin/services.cgi +++ b/html/cgi-bin/services.cgi @@ -29,6 +29,7 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/graphs.pl"; +require "/opt/pakfire/lib/functions.pl"; my %color = (); my %mainsettings = (); @@ -160,48 +161,69 @@ END my $lines=0; # Used to count the outputlines to make different bgcolor - # Generate list of installed addon pak's - opendir (DIR, "/opt/pakfire/db/installed") || die "Cannot opendir /opt/pakfire/db/installed/: $!"; - my @pak = sort readdir DIR; - foreach (@pak){ - chomp($_); - next unless (m/^meta-/); - s/^meta-//; - - # Check which of the paks are services - if (-e "/etc/init.d/$_") { - # blacklist some packages - # - # alsa has trouble with the volume saving and was not really stopped - # mdadm should not stopped with webif because this could crash the system - # - if ( $_ eq 'squid' ) { - next; - } - if ( ($_ ne "alsa") && ($_ ne "mdadm") ) { - $lines++; - if ($lines % 2){ - print ""; - $col="bgcolor='$color{'color22'}'"; - }else{ - print ""; - $col="bgcolor='$color{'color20'}'"; + my ($paklist, $pakinfo); + my (@templine, @templine2); + my ($listline, $infoline); + my @paks; + my @addon_services; + + # Generate list of installed addon pak services + $Pakfire::enable_colors = 0; + open OUT, '>', \$paklist; + select OUT; + eval { \&Pakfire::dblist("installed", "noweb"); }; + select STDOUT; + + foreach $listline (split(/^/, "$paklist")) { + chomp($listline); + @templine = split(/\: /, $listline); + + if ("@templine[0]" eq "Name") { + open OUT, '>', \$pakinfo; + select OUT; + eval { \&Pakfire::pakinfo("@templine[1]", "installed"); }; + select STDOUT; + + foreach $infoline (split(/^/, $pakinfo)) { + chomp($infoline); + @templine2 = split(/\: /, $infoline); + + if ("@templine2[0]" eq "InitScripts" && "@templine2[1]") { + push(@addon_services, split(" ", "@templine2[1]")); } - print "$_ "; - my $status = isautorun($_,$col); - print "$status "; - print "$Lang::tr{"; - print "$Lang::tr{ "; - my $status = &isrunningaddon($_,$col); - $status =~ s/\\[[0-1]\;[0-9]+m//g; - - chomp($status); - print "$status"; - print ""; } } } + foreach (@addon_services) { + $lines++; + if ($lines % 2){ + print ""; + $col="bgcolor='$color{'color22'}'"; + }else{ + print ""; + $col="bgcolor='$color{'color20'}'"; + } + print "$_ "; + my $status = isautorun($_,$col); + print "$status "; + # Don't allow user to start/stop folowing services from webui: + # - alsa has trouble with the volume saving and was not really stopped + if ($_ eq "alsa") { + print ""; + print " "; + } else { + print "$Lang::tr{"; + print "$Lang::tr{ "; + } + my $status = &isrunningaddon($_,$col); + $status =~ s/\\[[0-1]\;[0-9]+m//g; + + chomp($status); + print "$status"; + print ""; + } + print "\n"; &Header::closebox(); -- 2.31.1 -- Dit bericht is gescanned op virussen en andere gevaarlijke inhoud door MailScanner en lijkt schoon te zijn.