1 |
diff -Nur smeserver-yum-2.6.0.old/createlinks smeserver-yum-2.6.0/createlinks |
2 |
--- smeserver-yum-2.6.0.old/createlinks 2020-12-09 21:20:11.171000000 -0500 |
3 |
+++ smeserver-yum-2.6.0/createlinks 2020-12-09 21:52:24.591000000 -0500 |
4 |
@@ -19,20 +19,13 @@ |
5 |
event_link("navigation-conf", "yum-$_", "80"); |
6 |
} |
7 |
|
8 |
-# yum-update-dbs is launched by smeserver yum plugin, |
9 |
-# it isnot needed anymore in install remove and update events |
10 |
-for ( qw(modify) ) |
11 |
-{ |
12 |
- event_link("yum-update-dbs", "yum-$_", "90"); |
13 |
-} |
14 |
+safe_symlink("restart", "root/etc/e-smith/events/yum-modify/services2adjust/yum"); |
15 |
|
16 |
for ( qw(bootstrap-console-save yum-update smeserver-yum-update) ) |
17 |
{ |
18 |
event_link("yum-import-keys", $_, "10"); |
19 |
} |
20 |
|
21 |
-safe_symlink("restart", "root/etc/e-smith/events/local/services2adjust/yum"); |
22 |
- |
23 |
my $event= "smeserver-yum-update"; |
24 |
# systemd-specific action mandatory for this package-update event |
25 |
event_link("systemd-reload", $event, "89"); |
26 |
diff -Nur smeserver-yum-2.6.0.old/root/etc/e-smith/events/actions/yum-update-dbs smeserver-yum-2.6.0/root/etc/e-smith/events/actions/yum-update-dbs |
27 |
--- smeserver-yum-2.6.0.old/root/etc/e-smith/events/actions/yum-update-dbs 2020-12-09 21:20:11.172000000 -0500 |
28 |
+++ smeserver-yum-2.6.0/root/etc/e-smith/events/actions/yum-update-dbs 1969-12-31 19:00:00.000000000 -0500 |
29 |
@@ -1,25 +0,0 @@ |
30 |
-#!/bin/sh |
31 |
-#---------------------------------------------------------------------- |
32 |
-# Yum update dbs |
33 |
-# Copyright (C) 2005 Gordon Rowell <gordonr@gormand.com.au> |
34 |
-# |
35 |
-# This program is free software; you can redistribute it and/or modify |
36 |
-# it under the terms of the GNU General Public License as published by |
37 |
-# the Free Software Foundation; either version 2 of the License, or |
38 |
-# (at your option) any later version. |
39 |
-# |
40 |
-# This program is distributed in the hope that it will be useful, |
41 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
42 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
43 |
-# GNU General Public License or more details. |
44 |
-# |
45 |
-# You should have received a copy of the GNU General Public License |
46 |
-# along with this program; if not, write to the Free Software |
47 |
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
48 |
-#---------------------------------------------------------------------- |
49 |
- |
50 |
-# XXX - FIXME - We should be able to do this with a link |
51 |
-# /etc/e-smith/events/local/services2adjust/yum -> once |
52 |
-# but that never seems to terminate |
53 |
-exec /usr/bin/systemctl restart yum.service & |
54 |
- |
55 |
diff -Nur smeserver-yum-2.6.0.old/root/sbin/e-smith/yum_update_dbs smeserver-yum-2.6.0/root/sbin/e-smith/yum_update_dbs |
56 |
--- smeserver-yum-2.6.0.old/root/sbin/e-smith/yum_update_dbs 2020-12-09 21:20:11.136000000 -0500 |
57 |
+++ smeserver-yum-2.6.0/root/sbin/e-smith/yum_update_dbs 2020-12-09 21:30:30.882000000 -0500 |
58 |
@@ -23,6 +23,11 @@ |
59 |
|
60 |
my $db = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB\n"; |
61 |
|
62 |
+my $pid = fork; |
63 |
+exit 1 unless defined $pid; |
64 |
+# now two processes are executing |
65 |
+if ($pid == 0) { |
66 |
+ |
67 |
use constant YUM_CRON_FLAG => '/var/lock/subsys/yum-cron'; |
68 |
# we do not use yum-cron /etc/cron.daily file |
69 |
# so we keep away the subsys file |
70 |
@@ -33,8 +38,8 @@ |
71 |
#} |
72 |
#else |
73 |
#{ |
74 |
- system("/usr/bin/systemctl -q stop yum-cron"); |
75 |
- system("/usr/bin/systemctl -q mask yum-cron"); |
76 |
+# system("/usr/bin/systemctl -q stop yum-cron"); |
77 |
+# system("/usr/bin/systemctl -q mask yum-cron"); |
78 |
unlink YUM_CRON_FLAG; |
79 |
#} |
80 |
|
81 |
@@ -123,3 +128,5 @@ |
82 |
} |
83 |
|
84 |
exit 0; |
85 |
+} |
86 |
+exit 0; |
87 |
diff -Nur smeserver-yum-2.6.0.old/root/usr/lib/systemd/system/yum.service smeserver-yum-2.6.0/root/usr/lib/systemd/system/yum.service |
88 |
--- smeserver-yum-2.6.0.old/root/usr/lib/systemd/system/yum.service 2020-12-09 21:20:11.172000000 -0500 |
89 |
+++ smeserver-yum-2.6.0/root/usr/lib/systemd/system/yum.service 2020-12-09 21:49:46.481000000 -0500 |
90 |
@@ -1,13 +1,14 @@ |
91 |
[Unit] |
92 |
Description=Yum db updater for Koozali SME Server |
93 |
-After=network-pre.target networking.service sme-server.target |
94 |
+After=network-pre.target networking.service |
95 |
+Conflicts=yum-cron.service |
96 |
|
97 |
[Service] |
98 |
-Type=oneshot |
99 |
+Type=forking |
100 |
ExecStartPre=/sbin/e-smith/service-status yum |
101 |
ExecStart=/sbin/e-smith/yum_update_dbs |
102 |
+TimeoutSec=0 |
103 |
RemainAfterExit=yes |
104 |
|
105 |
[Install] |
106 |
-# do not install with sme-server.target, this service will be launched by others |
107 |
-# including Koozali SME Server local.service |
108 |
+WantedBy=sme-server.target |
109 |
diff -Nur smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py |
110 |
--- smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py 2020-12-09 21:20:11.168000000 -0500 |
111 |
+++ smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py 2020-12-09 22:10:03.231000000 -0500 |
112 |
@@ -11,6 +11,7 @@ |
113 |
events_path = '/etc/e-smith/events' |
114 |
initialize_database = events_path + '/actions/initialize-default-databases' |
115 |
navigation_conf = events_path + '/actions/navigation-conf' |
116 |
+systemctl = "/usr/bin/systemctl" |
117 |
yum_update_dbs = events_path + '/actions/yum-update-dbs' |
118 |
signal_event = '/sbin/e-smith/signal-event' |
119 |
config_set = '/sbin/e-smith/config' |
120 |
@@ -315,6 +316,12 @@ |
121 |
print 'Initializing databases' |
122 |
os.spawnl(os.P_WAIT, initialize_database, initialize_database) |
123 |
|
124 |
+ # just in case we add systemd-default and systemd-reload |
125 |
+ if not actionlist.has_key('/etc/e-smith/events/actions/systemd-default'): |
126 |
+ actionlist['/etc/e-smith/events/actions/systemd-default'] = '/etc/e-smith/events/actions/systemd-default' |
127 |
+ if not actionlist.has_key('/etc/e-smith/events/actions/systemd-reload'): |
128 |
+ actionlist['/etc/e-smith/events/actions/systemd-reload'] = '/etc/e-smith/events/actions/systemd-reload' |
129 |
+ |
130 |
# now, if smechange is false (no reboot needed), we can execute actions, expan templates and adjust services |
131 |
#if not smechange: |
132 |
|
133 |
@@ -358,7 +365,7 @@ |
134 |
os.spawnl(os.P_WAIT, config_set, config_set, 'set', 'UnsavedChanges', 'yes') |
135 |
os.spawnl(os.P_WAIT, navigation_conf, navigation_conf) |
136 |
print "Reload yum db for server-manager" |
137 |
- os.spawnl(os.P_WAIT, yum_update_dbs, yum_update_dbs) |
138 |
+ os.spawnl(os.P_WAIT, systemctl, systemctl, 'restart', 'yum') |
139 |
|
140 |
def close_hook(conduit): |
141 |
if ourfile and os.path.isfile('/var/run/yum.status'): |