/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.1-bz11722-add-instance-support.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme10/e-smith-base-5.8.1-bz11722-add-instance-support.patch

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


Revision 1.1 - (hide annotations) (download)
Thu Oct 28 02:38:07 2021 UTC (3 years, 1 month ago) by jpp
Branch: MAIN
CVS Tags: e-smith-base-5_8_1-2_el7_sme
* Wed Oct 27 2021 Jean-Philippe Pialasse <tests@pialasse.com> 5.8.1-2.sme
- add support for systemd service with instance service@instance.service [SME: 11722]

1 jpp 1.1 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
2     --- e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/systemd-default 2021-06-06 16:30:37.000000000 -0400
3     +++ e-smith-base-5.8.1/root/etc/e-smith/events/actions/systemd-default 2021-10-27 22:31:19.567000000 -0400
4     @@ -98,15 +98,19 @@
5     next unless length; # next rec unless anything left
6     # print $_ ."\n";
7     next unless (/^(enable|disable)\s+([a-zA-Z0-9\-_.@]+\.service)/);
8     + my $service=$2;
9     + my $stats=$1;
10     # print $_ ."\n";
11     #ignore service that does not exists !
12     - next unless ( -e "/usr/lib/systemd/system/$2" or -e "/etc/lib/systemd/system/$2" );
13     + my $multiple = $service;
14     + ($multiple = $service ) =~ s/([a-zA-Z0-9\-_.]+@)(.*)/$1.service/ if ( $service =~ /@/ );
15     + #print "$stats $service $multiple\n";
16     + next unless ( -e "/usr/lib/systemd/system/$service" or -e "/etc/lib/systemd/system/$service" or -e "/usr/lib/systemd/system/$multiple");
17     # eliminate duplicates, this way we keep only the last entry of the lowest file as we do it in reverse order of file,
18     # but from top to bottom of file.
19     - $services{$2}=$1;
20     + $services{$service}=$stats;
21    
22     # list all Services explicitely listed in preset that are also in Wants= or with WantedBy= sme-server.target
23     - my $service=$2;
24     next if (/^$service$/ ~~ @WantedBy);
25     if ( /^$service$/ ~~ @smematches ) {
26     push(@WantedBy, $service);
27     @@ -145,10 +149,12 @@
28     # unlink "$d$fi";
29     # next;
30     #}
31     - # remove if link is not to an existing file # we should also check if poiting to an authorized path!
32     + # remove if link is not to an existing file # we should also check if pointing to an authorized path!
33     + my $multiple = $fi;
34     + ($multiple = $fi ) =~ s/([a-zA-Z0-9\-_.]+@)(.*)/$1.service/ if ( $fi =~ /@/ );
35     my $absFilePath = abs_path("$d$fi") ;
36     - if ( ! -f "$absFilePath" or ( ! -f "/etc/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$fi") ) {
37     - print "remove $d$fi target '$absFilePath' does not exist or is not regular file in expeted path\n";
38     + if ( ! -f "$absFilePath" or ( ! -f "/etc/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$fi" and ! -f "/usr/lib/systemd/system/$multiple") ) {
39     + print "remove $d$fi target '$absFilePath' does not exist or is not regular file in expected path\n";
40     unlink "$d$fi";
41     next;
42     }
43     @@ -177,7 +183,7 @@
44     my $linkedD = ( -e "/etc/systemd/system/default.target.wants/$service" or -e "/usr/lib/systemd/system/default.target.wants/$service" ) ? "linked" : "not";
45     ## adding link if needed in /etc/systemd/system/sme-server.target.wants
46     ## readd event if present in usr/lib as preste-all does not care about that.
47     - if ( $status eq "enable" and $linkedE eq "not" and $linkedD eq "not" and $wanted eq "want"){
48     + if ( $status eq "enable" and $linkedE eq "not" and $linkedD eq "not" and $wanted eq "want" and (! $service =~ /@\.service$/ ) ){
49     #print "systemctl add-wants sme-server.target $service\n";
50     `/usr/bin/systemctl add-wants sme-server.target $service `;
51     }
52     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
53     --- 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
54     +++ 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
55     @@ -8,8 +8,12 @@
56     unless ( $service->key ~~ @list ) {
57     $status = "disable" if -e "/etc/rc.d/init.d/".$service->key || -e "/etc/rc.d/init.d/supervise/".$service->key;
58     }
59     - $OUT .= "# Systemd service file does not exist : " unless -e "/usr/lib/systemd/system/$servicename" || -e "/etc/lib/systemd/system/$servicename";
60     + my $multiple = $servicename;
61     + ($multiple = $servicename ) =~ s/([a-zA-Z0-9\-_.]+@)(.*)/$1.service/ if ( $servicename =~ /@/ );
62     +
63     + $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";
64     $OUT .= "$status $servicename\n";
65     + $OUT .= "$status $multiple\n" unless $multiple eq $servicename ;
66    
67     }
68    

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