]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Fix for bug 12539
authorAdolf Belka <ahb.ipfire@gmail.com>
Mon, 7 Dec 2020 14:01:36 +0000 (15:01 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Dec 2020 12:59:42 +0000 (12:59 +0000)
The installer recognises cups and cups-filters both as cups and puts
two instances of cups in the add-on services table.
Based on input from Michael Tremer this patch replaces the command
returning the second element between hyphens with one that takes
what comes after "meta-" using Perl code rather than a shell command.
The second find command was changed as per Michael's suggestion.

Tested in my ipfire test bed system and only results in one cups
entry.
Signed-off-by: Adolf Belka <ahb.ipfire@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/services.cgi

index 26ab4f3143fff36434287ec085aaa47993726ff1..36954ba70367c2ae51e4d6aefb1cf94311157bb0 100644 (file)
@@ -161,19 +161,20 @@ END
        my $lines=0; # Used to count the outputlines to make different bgcolor
 
        # Generate list of installed addon pak's
-       my @pak = `find /opt/pakfire/db/installed/meta-* 2>/dev/null | cut -d"-" -f2`;
+       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
-               my @svc = `find /etc/init.d/$_ 2>/dev/null | cut -d"/" -f4`;
-               foreach (@svc){
+               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
                        #
-                       chomp($_);
                        if ( $_ eq 'squid' ) {
                                next;
                        }