--- rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz11231-systemd-preset-all-workaround.patch 2020/12/06 20:02:14 1.2 +++ rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz11231-systemd-preset-all-workaround.patch 2020/12/06 21:09:40 1.3 @@ -352,3 +352,65 @@ diff -Nur e-smith-base-5.8.0.old/root/us -enable php73-php-fpm.service -enable php74-php-fpm.service - +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 +--- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/systemd-default 2020-12-06 16:08:47.304000000 -0500 ++++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/systemd-default 2020-12-06 16:08:55.969000000 -0500 +@@ -109,7 +109,7 @@ + my $wanted = `grep -P '^WantedBy=.*sme-server.target' /usr/lib/systemd/system/$service* /etc/systemd/system/$service* -rsh` ; + chomp $wanted; + push(@WantedBy , $service) unless ( $wanted eq "") ; +- #print "want $service \n" unless ( $wanted eq "") ; ++ #print "want $service \n" unless ( $wanted eq "") ; + } + + } +@@ -127,17 +127,30 @@ + # for the moment we only consider service files and ignore target, mount, device, socket... + next unless ($fi =~ /.service$/); + # remove if file but not a link +- print "remove $d$fi : not a link\n" unless ( -l "$d$fi"); +- unlink "$d$fi" unless ( -l "$d$fi"); +- # remove if link is not to an existing file ++ unless ( -l "$d$fi") { ++ print "remove $d$fi : not a link\n"; ++ unlink "$d$fi"; ++ next; ++ } ++ # remove if also un /usr/lib .. not as preset-all does not care ++ #if ( -l "/usr/lib/systemd/system/sme-server.target.wants/$fi") { ++ # print "remove $d$fi : also in /usr/lib/systemd/system/sme-server.target.wants/\n"; ++ # unlink "$d$fi"; ++ # next; ++ #} ++ # remove if link is not to an existing file # we should also check if poiting to an authorized path! + my $absFilePath = abs_path("$d$fi") ; +- print "remove $d$fi target '$absFilePath' does not exist or is not regular file\n" unless ( -f "$absFilePath"); +- unlink "$d$fi" unless ( -f "$absFilePath"); ++ if ( ! -f "$absFilePath" or ( ! -f "/etc/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$fi") ) { ++ print "remove $d$fi target '$absFilePath' does not exist or is not regular file in expeted path\n"; ++ unlink "$d$fi"; ++ next; ++ } + # is not enable in preset : remove + #print "==$fi \n"; + if ( ! defined $services{$fi} or $services{$fi} ne "enable") { + print "remove $d$fi as not enabled in preset\n"; + unlink "$d$fi"; ++ next; + } + # if not wanted remove + unless ( /^$fi$/ ~~ @WantedBy) { +@@ -156,10 +169,10 @@ + my $linkedU = ( -e "/usr/lib/systemd/system/sme-server.target.wants/$service" ) ? "linked" : "not"; + my $linkedE = ( -e "/etc/systemd/system/sme-server.target.wants/$service" ) ? "linked" : "not"; + my $linkedD = ( -e "/etc/systemd/system/default.target.wants/$service" or -e "/usr/lib/systemd/system/default.target.wants/$service" ) ? "linked" : "not"; +- my $add = ($linkedU eq "not" and $linkedE eq "not" and $linkedD eq "not" and $status eq "enable" and $wanted eq "want") ? "ADDME!!" : ""; + ## adding link if needed in /etc/systemd/system/sme-server.target.wants +- if ( $status eq "enable" and $linkedU eq "not" and $linkedE eq "not" and $linkedD eq "not" and $wanted eq "want"){ +- print "systemctl add-wants sme-server.target $service\n"; ++ ## readd event if present in usr/lib as preste-all does not care about that. ++ if ( $status eq "enable" and $linkedE eq "not" and $linkedD eq "not" and $wanted eq "want"){ ++ #print "systemctl add-wants sme-server.target $service\n"; + `systemctl add-wants sme-server.target $service `; + } + }