diff -Nur --no-dereference e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/systemd-default e-smith-base-5.8.1/root/etc/e-smith/events/actions/systemd-default --- e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/systemd-default 2021-06-06 16:30:37.000000000 -0400 +++ e-smith-base-5.8.1/root/etc/e-smith/events/actions/systemd-default 2021-10-27 22:31:19.567000000 -0400 @@ -98,15 +98,19 @@ next unless length; # next rec unless anything left # print $_ ."\n"; next unless (/^(enable|disable)\s+([a-zA-Z0-9\-_.@]+\.service)/); + my $service=$2; + my $stats=$1; # print $_ ."\n"; #ignore service that does not exists ! - next unless ( -e "/usr/lib/systemd/system/$2" or -e "/etc/lib/systemd/system/$2" ); + my $multiple = $service; + ($multiple = $service ) =~ s/([a-zA-Z0-9\-_.]+@)(.*)/$1.service/ if ( $service =~ /@/ ); + #print "$stats $service $multiple\n"; + next unless ( -e "/usr/lib/systemd/system/$service" or -e "/etc/lib/systemd/system/$service" or -e "/usr/lib/systemd/system/$multiple"); # eliminate duplicates, this way we keep only the last entry of the lowest file as we do it in reverse order of file, # but from top to bottom of file. - $services{$2}=$1; + $services{$service}=$stats; # list all Services explicitely listed in preset that are also in Wants= or with WantedBy= sme-server.target - my $service=$2; next if (/^$service$/ ~~ @WantedBy); if ( /^$service$/ ~~ @smematches ) { push(@WantedBy, $service); @@ -145,10 +149,12 @@ # unlink "$d$fi"; # next; #} - # remove if link is not to an existing file # we should also check if poiting to an authorized path! + # remove if link is not to an existing file # we should also check if pointing to an authorized path! + my $multiple = $fi; + ($multiple = $fi ) =~ s/([a-zA-Z0-9\-_.]+@)(.*)/$1.service/ if ( $fi =~ /@/ ); my $absFilePath = abs_path("$d$fi") ; - 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"; + if ( ! -f "$absFilePath" or ( ! -f "/etc/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$multiple") ) { + print "remove $d$fi target '$absFilePath' does not exist or is not regular file in expected path\n"; unlink "$d$fi"; next; } @@ -177,7 +183,7 @@ my $linkedD = ( -e "/etc/systemd/system/default.target.wants/$service" or -e "/usr/lib/systemd/system/default.target.wants/$service" ) ? "linked" : "not"; ## adding link if needed in /etc/systemd/system/sme-server.target.wants ## 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"){ + if ( $status eq "enable" and $linkedE eq "not" and $linkedD eq "not" and $wanted eq "want" and ( $service !~ /\@\.service$/ ) ){ #print "systemctl add-wants sme-server.target $service\n"; `/usr/bin/systemctl add-wants sme-server.target $service `; } diff -Nur --no-dereference e-smith-base-5.8.1.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services e-smith-base-5.8.1/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services --- e-smith-base-5.8.1.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services 2021-06-06 16:30:37.000000000 -0400 +++ e-smith-base-5.8.1/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services 2021-10-27 22:33:35.636000000 -0400 @@ -8,8 +8,12 @@ unless ( $service->key ~~ @list ) { $status = "disable" if -e "/etc/rc.d/init.d/".$service->key || -e "/etc/rc.d/init.d/supervise/".$service->key; } - $OUT .= "# Systemd service file does not exist : " unless -e "/usr/lib/systemd/system/$servicename" || -e "/etc/lib/systemd/system/$servicename"; + my $multiple = $servicename; + ($multiple = $servicename ) =~ s/([a-zA-Z0-9\-_.]+@)(.*)/$1.service/ if ( $servicename =~ /@/ ); + + $OUT .= "# Systemd service file does not exist : " unless -e "/usr/lib/systemd/system/$servicename" || -e "/etc/lib/systemd/system/$servicename" || -e "/usr/lib/systemd/system/$multiple"; $OUT .= "$status $servicename\n"; + $OUT .= "$status $multiple\n" unless $multiple eq $servicename ; }