diff -Nur smeserver-yum-2.6.0.old/createlinks smeserver-yum-2.6.0/createlinks --- smeserver-yum-2.6.0.old/createlinks 2020-12-09 21:20:11.171000000 -0500 +++ smeserver-yum-2.6.0/createlinks 2020-12-09 21:52:24.591000000 -0500 @@ -19,20 +19,13 @@ event_link("navigation-conf", "yum-$_", "80"); } -# yum-update-dbs is launched by smeserver yum plugin, -# it isnot needed anymore in install remove and update events -for ( qw(modify) ) -{ - event_link("yum-update-dbs", "yum-$_", "90"); -} +safe_symlink("restart", "root/etc/e-smith/events/yum-modify/services2adjust/yum"); for ( qw(bootstrap-console-save yum-update smeserver-yum-update) ) { event_link("yum-import-keys", $_, "10"); } -safe_symlink("restart", "root/etc/e-smith/events/local/services2adjust/yum"); - my $event= "smeserver-yum-update"; # systemd-specific action mandatory for this package-update event event_link("systemd-reload", $event, "89"); 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 --- smeserver-yum-2.6.0.old/root/etc/e-smith/events/actions/yum-update-dbs 2020-12-09 21:20:11.172000000 -0500 +++ smeserver-yum-2.6.0/root/etc/e-smith/events/actions/yum-update-dbs 1969-12-31 19:00:00.000000000 -0500 @@ -1,25 +0,0 @@ -#!/bin/sh -#---------------------------------------------------------------------- -# Yum update dbs -# Copyright (C) 2005 Gordon Rowell -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License or more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#---------------------------------------------------------------------- - -# XXX - FIXME - We should be able to do this with a link -# /etc/e-smith/events/local/services2adjust/yum -> once -# but that never seems to terminate -exec /usr/bin/systemctl restart yum.service & - 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 --- smeserver-yum-2.6.0.old/root/sbin/e-smith/yum_update_dbs 2020-12-09 21:20:11.136000000 -0500 +++ smeserver-yum-2.6.0/root/sbin/e-smith/yum_update_dbs 2020-12-09 21:30:30.882000000 -0500 @@ -23,6 +23,11 @@ my $db = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB\n"; +my $pid = fork; +exit 1 unless defined $pid; +# now two processes are executing +if ($pid == 0) { + use constant YUM_CRON_FLAG => '/var/lock/subsys/yum-cron'; # we do not use yum-cron /etc/cron.daily file # so we keep away the subsys file @@ -33,8 +38,8 @@ #} #else #{ - system("/usr/bin/systemctl -q stop yum-cron"); - system("/usr/bin/systemctl -q mask yum-cron"); +# system("/usr/bin/systemctl -q stop yum-cron"); +# system("/usr/bin/systemctl -q mask yum-cron"); unlink YUM_CRON_FLAG; #} @@ -123,3 +128,5 @@ } exit 0; +} +exit 0; 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 --- smeserver-yum-2.6.0.old/root/usr/lib/systemd/system/yum.service 2020-12-09 21:20:11.172000000 -0500 +++ smeserver-yum-2.6.0/root/usr/lib/systemd/system/yum.service 2020-12-09 21:49:46.481000000 -0500 @@ -1,13 +1,14 @@ [Unit] Description=Yum db updater for Koozali SME Server -After=network-pre.target networking.service sme-server.target +After=network-pre.target networking.service +Conflicts=yum-cron.service [Service] -Type=oneshot +Type=forking ExecStartPre=/sbin/e-smith/service-status yum ExecStart=/sbin/e-smith/yum_update_dbs +TimeoutSec=0 RemainAfterExit=yes [Install] -# do not install with sme-server.target, this service will be launched by others -# including Koozali SME Server local.service +WantedBy=sme-server.target 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 --- smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py 2020-12-09 21:20:11.168000000 -0500 +++ smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py 2020-12-09 22:10:03.231000000 -0500 @@ -11,6 +11,7 @@ events_path = '/etc/e-smith/events' initialize_database = events_path + '/actions/initialize-default-databases' navigation_conf = events_path + '/actions/navigation-conf' +systemctl = "/usr/bin/systemctl" yum_update_dbs = events_path + '/actions/yum-update-dbs' signal_event = '/sbin/e-smith/signal-event' config_set = '/sbin/e-smith/config' @@ -315,6 +316,12 @@ print 'Initializing databases' os.spawnl(os.P_WAIT, initialize_database, initialize_database) + # just in case we add systemd-default and systemd-reload + if not actionlist.has_key('/etc/e-smith/events/actions/systemd-default'): + actionlist['/etc/e-smith/events/actions/systemd-default'] = '/etc/e-smith/events/actions/systemd-default' + if not actionlist.has_key('/etc/e-smith/events/actions/systemd-reload'): + actionlist['/etc/e-smith/events/actions/systemd-reload'] = '/etc/e-smith/events/actions/systemd-reload' + # now, if smechange is false (no reboot needed), we can execute actions, expan templates and adjust services #if not smechange: @@ -358,7 +365,7 @@ os.spawnl(os.P_WAIT, config_set, config_set, 'set', 'UnsavedChanges', 'yes') os.spawnl(os.P_WAIT, navigation_conf, navigation_conf) print "Reload yum db for server-manager" - os.spawnl(os.P_WAIT, yum_update_dbs, yum_update_dbs) + os.spawnl(os.P_WAIT, systemctl, systemctl, 'restart', 'yum') def close_hook(conduit): if ourfile and os.path.isfile('/var/run/yum.status'):