/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz11231-systemd-preset-all-workaround.patch
ViewVC logotype

Diff of /rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz11231-systemd-preset-all-workaround.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.2 by jpp, Sun Dec 6 20:02:14 2020 UTC Revision 1.3 by jpp, Sun Dec 6 21:09:40 2020 UTC
# Line 352  diff -Nur e-smith-base-5.8.0.old/root/us Line 352  diff -Nur e-smith-base-5.8.0.old/root/us
352  -enable php73-php-fpm.service  -enable php73-php-fpm.service
353  -enable php74-php-fpm.service  -enable php74-php-fpm.service
354  -  -
355    diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/systemd-default e-smith-base-5.8.0/root/etc/e-smith/events/actions/systemd-default
356    --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/systemd-default      2020-12-06 16:08:47.304000000 -0500
357    +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/systemd-default  2020-12-06 16:08:55.969000000 -0500
358    @@ -109,7 +109,7 @@
359                     my $wanted = `grep -P '^WantedBy=.*sme-server.target' /usr/lib/systemd/system/$service*  /etc/systemd/system/$service* -rsh` ;
360                     chomp $wanted;
361                     push(@WantedBy , $service)  unless ( $wanted eq "") ;
362    -                #print "want $service \n" unless ( $wanted eq "") ;
363    +               #print "want $service \n" unless ( $wanted eq "") ;
364                 }
365    
366            }
367    @@ -127,17 +127,30 @@
368             # for the moment we only consider service  files and ignore target, mount, device, socket...
369             next unless ($fi =~ /.service$/);
370            # remove if file but not a link
371    -       print "remove $d$fi : not a link\n" unless ( -l "$d$fi");
372    -       unlink "$d$fi" unless ( -l "$d$fi");
373    -       # remove if link is not to an existing file
374    +       unless ( -l "$d$fi") {
375    +               print "remove $d$fi : not a link\n";
376    +               unlink "$d$fi";
377    +               next;
378    +       }
379    +       # remove if also un /usr/lib .. not as preset-all does not care
380    +       #if ( -l "/usr/lib/systemd/system/sme-server.target.wants/$fi") {
381    +       #       print "remove $d$fi : also in /usr/lib/systemd/system/sme-server.target.wants/\n";
382    +       #       unlink "$d$fi";
383    +       #       next;
384    +       #}
385    +       # remove if link is not to an existing file # we should also check if poiting to an authorized path!
386            my $absFilePath = abs_path("$d$fi") ;
387    -       print "remove $d$fi target '$absFilePath' does not exist or is not regular file\n" unless ( -f "$absFilePath");
388    -       unlink "$d$fi" unless ( -f "$absFilePath");
389    +       if ( ! -f "$absFilePath" or ( ! -f "/etc/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$fi") ) {
390    +               print "remove $d$fi target '$absFilePath' does not exist or is not regular file in expeted path\n";    
391    +               unlink "$d$fi";
392    +               next;
393    +       }
394             # is not enable in preset : remove
395             #print "==$fi \n";
396             if ( ! defined $services{$fi} or $services{$fi} ne "enable") {
397                     print "remove $d$fi as not enabled in preset\n";
398                     unlink "$d$fi";
399    +               next;
400             }
401            # if not wanted remove
402            unless ( /^$fi$/ ~~ @WantedBy) {
403    @@ -156,10 +169,10 @@
404            my $linkedU = ( -e "/usr/lib/systemd/system/sme-server.target.wants/$service" ) ? "linked" : "not";
405            my $linkedE = ( -e "/etc/systemd/system/sme-server.target.wants/$service" ) ? "linked" : "not";
406            my $linkedD = ( -e "/etc/systemd/system/default.target.wants/$service" or -e "/usr/lib/systemd/system/default.target.wants/$service" ) ? "linked" : "not";
407    -       my $add = ($linkedU eq "not" and $linkedE eq "not" and $linkedD eq "not" and $status eq "enable" and $wanted eq "want") ? "ADDME!!" : "";
408            ## adding link if needed in /etc/systemd/system/sme-server.target.wants
409    -       if ( $status eq "enable" and $linkedU eq "not" and $linkedE eq "not" and $linkedD eq "not"  and $wanted eq "want"){
410    -               print "systemctl add-wants sme-server.target $service\n";
411    +       ## readd event if present in usr/lib as preste-all does not care about that.
412    +       if ( $status eq "enable" and $linkedE eq "not" and $linkedD eq "not"  and $wanted eq "want"){
413    +               #print "systemctl add-wants sme-server.target $service\n";
414                    `systemctl add-wants sme-server.target $service `;
415            }
416     }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed