19 Commits

Author SHA1 Message Date
64597f4c33 * Sat Dec 21 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-17.sme
- set our prefered modules on different events and dnf.service run [SME: 12618]
- update old manager to use dnf key instead of yum for settings [SME: 12831]
- clean rocky yum_repositories property Name content  [SME: 12806]
2024-12-21 23:44:40 -05:00
5f44cf7d38 * Sat Nov 30 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-16.sme
-  remove smeupdates and add smecontribs-testing  [SME: 12804]
2024-11-30 02:01:56 -05:00
ac0a7a9851 * Fri Nov 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-15.sme
- add PowerTools repo needed for openldap-server [SME: 12790]
- add SME 11 gpg key
2024-11-15 18:25:04 -05:00
453572ac38 Add *.bak to .gitignore 2024-11-12 19:22:02 +00:00
844bdb5f22 Update README with specific Bugzilla links with status options 2024-10-27 14:29:51 +00:00
4506fb1cf5 Update readme bugzilla link to show all outstanding bugs 2024-10-27 12:13:44 +00:00
0881ba0058 * Mon Sep 02 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-14.sme
- fix typo in rsyslog.conf [SME: 12668]
2024-09-02 15:52:55 -04:00
a08cc2a41b Typo in spec file 2024-08-21 10:56:44 +01:00
b66a26eaea Fix restart dnf for dnf-modify event 2024-08-21 10:55:09 +01:00
45e3c516b5 * Sat May 11 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-12.sme
- revert plugin changes to force modules [SME: 12618]
- tag service to limit log noise in message [SME: 12668]
- sort nut service to restart [SME: 12662]
2024-05-11 21:34:47 -04:00
6e69a3f6e6 * Tue Apr 23 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- fix debuglevel=-2 not allowed [SME: 12637]
- force modules needed for core [SME: 12618]
  php:remi-8.3 perl:5.26 python36:3.6 mariadb:10.5
2024-04-23 12:18:22 -04:00
4adf87588b * Thu Apr 18 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
- fix RuntimeError: dictionary changed size during iteration [SME: 12633]
2024-04-18 14:59:05 -04:00
b3580a5bd4 * Wed Apr 17 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- fix RuntimeError: dictionary changed size during iteration [SME: 12633]
2024-04-17 11:42:12 -04:00
b467a955d1 * Tue Apr 16 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- fix python error in dnf plugin [SME: 12631]
2024-04-16 16:00:24 -04:00
8303299ad7 * Mon Apr 08 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- fix python error in dnf plugin [SME: 12601]
- fix server error in old manager [SME: 12602]
2024-04-08 00:58:32 -04:00
cc7626c868 * Mon Apr 08 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- fix python error in dnf plugin [SME: 12601]
- fix server error in old manager [SME: 12602]
2024-04-08 00:56:32 -04:00
e1845339e5 * Wed Apr 04 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- rewrite smeserver.py plugin [SME: 12113]
- fix migrate template 39VisibleSmeContribs, 45RockyEOL [SME: 12549]
2024-04-04 17:24:58 -04:00
163fd5ca9d * Wed Mar 27 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-5.sme
- rewrite smeserver.py plugin [SME: 12113]
- fix migrate template 39VisibleSmeContribs, 45RockyEOL [SME: 12549]
2024-04-04 17:20:45 -04:00
2208ef74ba 4 2024-03-25 23:07:42 -04:00
47 changed files with 664 additions and 484 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
*.log
*spec-20*
*.tar.xz
*.bak

View File

@@ -6,7 +6,14 @@ SMEServer Koozali developed git repo for smeserver-update core
<br />https://wiki.koozali.org/smeserver-update
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-update&product=SME%20Server%2011.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
Show list of outstanding bugs:
[All](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=NEEDINFO&bug_status=IN_PROGRESS&bug_status=RESOLVED&bug_status=VERIFIED&cf_package=smeserver-update&classification=SME+Server&list_id=105756&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Confirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=CONFIRMED&cf_package=smeserver-update&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Unconfirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&cf_package=smeserver-update&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Need info](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=NEEDINFO&cf_package=smeserver-update&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[In progress](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=IN_PROGRESS&cf_package=smeserver-update&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Resolved](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=RESOLVED&cf_package=smeserver-update&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Verified](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=VERIFIED&cf_package=smeserver-update&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
## Description

View File

@@ -17,13 +17,18 @@ for ( qw(install remove update) )
event_link("dnf-action", "dnf-$_", "20");
}
safe_symlink("restart", "root/etc/e-smith/events/dnf-modify/services2adjust/yum");
safe_symlink("restart", "root/etc/e-smith/events/dnf-modify/services2adjust/dnf");
for ( qw(bootstrap-console-save dnf-update smeserver-update-update) )
{
event_link("rpm-import-keys", $_, "10");
}
for ( qw(post-install post-upgrade console-save))
{
event_link("dnf_modules", $_, "70");
}
my $event= "smeserver-update-update";
# systemd-specific action mandatory for this package-update event
event_link("systemd-reload", $event, "89");
@@ -34,4 +39,4 @@ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/rsyslog"
#--------------------------------------------------
# functions for manager panel
#--------------------------------------------------
panel_link("dnf", "manager");
panel_link("yum", "manager");

View File

@@ -1 +1 @@
Rocky Linux $releasever - AppStream
Rocky Linux - AppStream

View File

@@ -1 +1 @@
Rocky Linux $releasever - BaseOS
Rocky Linux - BaseOS

View File

@@ -1 +1 @@
Rocky Linux $releasever - Extras
Rocky Linux - Extras

View File

@@ -0,0 +1 @@
https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever

View File

@@ -0,0 +1 @@
Rocky Linux - PowerTools

View File

@@ -1 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smeaddons-10
https://mirrorlist.koozali.org/mirrorlist/smeaddons-11

View File

@@ -0,0 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smecontribs-testing-11

View File

@@ -0,0 +1 @@
SME Server - contribs-testing

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
repository

View File

@@ -1 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smecontribs-10
https://mirrorlist.koozali.org/mirrorlist/smecontribs-11

View File

@@ -1 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smedev-10
https://mirrorlist.koozali.org/mirrorlist/smedev-11

View File

@@ -1 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smeos-10
https://mirrorlist.koozali.org/mirrorlist/smeos-11

View File

@@ -1 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smetest-10
https://mirrorlist.koozali.org/mirrorlist/smetest-11

View File

@@ -1 +1 @@
https://mirrorlist.koozali.org/mirrorlist/smeupdates-testing-10
https://mirrorlist.koozali.org/mirrorlist/smeupdates-testing-11

View File

@@ -1 +0,0 @@
https://mirrorlist.koozali.org/mirrorlist/smeupdates-10

View File

@@ -1 +0,0 @@
SME Server - updates

View File

@@ -1,5 +1,5 @@
{
for my $name ( qw(appstream baseos extras remi-safe remi-modular) )
for my $name ( qw(appstream baseos powertools extras remi-safe remi-modular) )
{
my $repo = $DB->get($name) or next;

View File

@@ -1,5 +1,5 @@
{
for my $name ( qw(addons contrib dungog fws base centosplus fasttrack updates) )
for my $name ( qw(addons contrib dungog fws base centosplus fasttrack updates smeupdates) )
{
my $repo = $DB->get($name);
$repo->delete if $repo;

View File

@@ -4,7 +4,7 @@
my $repo = $DB->get($name) or next;
#only migrate if restore from previous SME version, we do not want to override an admin setting for current version.
return unless $repo->prop('MirrorList') =~ m{/$name-1?[0789]{1}$};
$repo->set_prop('status', 'enabled')
$repo->set_prop('status', 'enabled');
$repo->set_prop('Visible', 'yes');
}
}

View File

@@ -1,6 +1,6 @@
{
for my $name ( qw(smeaddons smecontribs smedev smeextras smeos smetest
smeupdates smeupdates-testing) )
for my $name ( qw(smeaddons smecontribs smecontribs-testing smedev smeextras smeos smetest
smeupdates-testing) )
{
my $repo = $DB->get($name) or next;

View File

@@ -40,8 +40,8 @@
my $curdate = strftime '%Y%m%d', localtime;
# return unless EOL is reached
return unless ( "$curdate" >= "$curVersEOL");
my %equiv=(appstream=>'AppStream', baseos=> 'BaseOS', extras=>'extras' );
for my $name ( qw(appstream baseos extras) )
my %equiv=(appstream=>'AppStream', baseos=> 'BaseOS', extras=>'extras', powertools=>'PowerTools' );
for my $name ( qw(appstream baseos extras powertools) )
{
my $repo = $DB->get($name) or next;
my $rname = $equiv{$name} || $name;

View File

@@ -0,0 +1,14 @@
#!/usr/bin/python3
import dnf
base = dnf.Base()
base.read_all_repos()
base.fill_sack()
module_base = dnf.module.module_base.ModuleBase(base)
module_base.switch_to(['php:remi-8.3'])
module_base.switch_to(['perl:5.26'])
module_base.switch_to(['python36:3.6'])
module_base.switch_to(['mariadb:10.5'])
base.do_transaction()

View File

@@ -5,7 +5,7 @@
# -4: critical
# -3: critical+errors
# -2: critical+errors+warnings (default)
debuglevel = -{ $dnf{Debug} || '2' }
debuglevel = { $dnf{Debug} || '2' }
# Uncomment to auto-import new gpg keys (dangerous)
# assumeyes = True

View File

@@ -1,4 +1,5 @@
#dnf Koozali SME Server updater
#dnf Koozali SME Server updater, dnf automatic and dnf makecache
if $programname startswith "dnf_update_dbs" then /var/log/dnf/dnf-update.log
& stop
if $programname startswith "dnf-automatic" then stop
if $programname startswith "dnf-makecache" then stop

View File

@@ -0,0 +1,506 @@
# vim: noexpandtab tabstop=4
import os
import shutil
import subprocess
import syslog
from dnfpluginscore import _, logger
import libdnf.conf
import dnf
import dnf.transaction
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"
signal_event = '/sbin/e-smith/signal-event'
config_set = '/sbin/e-smith/config'
status_file = '/var/cache/dnf/dnf.status'
eventlist = dict()
actionlist = dict()
templateslist = dict()
serviceslist = dict()
# list of packages that need a reboot
# if a package name starts with one these names, a reboot is needed
rebootpkgs = ['daemontools', 'dbus', 'glibc', 'gnutls', 'kernel', 'linux-firmware', 'lvm2', 'mdadm', 'openssl-libs', 'systemd']
# exclusions :
rebootpkgsexclude = dict()
rebootpkgsexclude['dbus']='-python','-tests','-devel','-doc',
rebootpkgsexclude['glibc']='-devel','-headers','-statics','-utils','-glib',
rebootpkgsexclude['gnutls']='-devel',
rebootpkgsexclude['kernel']='-doc','-debug','-devel','-abi-whitelists','tools',
rebootpkgsexclude['lvm2']='-devel','-python',
rebootpkgsexclude['systemd']='-devel','-python',
# list of packages that need a service restart
# if a package name starts with one of these values, a service restart is needed
# since, for example, httpd means httpd-admin and httpd-e-smith, we won't use these names directly but via serviceslist (see below)
restartpkgs = ['dovecot','bglibs','cvm','freeradius','httpd','iptables', 'mariadb' , 'nut', 'openldap', 'openssh', 'php', 'pptpd', 'proftp', 'samba', 'spamassassin', 'squid', 'qmail', 'qpsmtpd']
servicenames = dict()
servicenames['bglibs']='cvm-unix',
servicenames['cvm']='cvm-unix',
servicenames['dovecot']='dovecot',
servicenames['freeradius']='radiusd',
servicenames['httpd']='httpd-admin','httpd-e-smith',
servicenames['iptables']='masq',
servicenames['mariadb']='mariadb',
servicenames['nut']='nut',
servicenames['openldap']='ldap',
servicenames['openssh']='sshd',
servicenames['php']='httpd-e-smith', 'php72-php-fpm', 'php73-php-fpm', 'php74-php-fpm', 'php80-php-fpm', 'php81-php-fpm', 'php82-php-fpm', 'php83-php-fpm',
servicenames['proftp']='ftp',
servicenames['samba']='smb',
servicenames['spamassassin']='spamassassin',
servicenames['squid']='squid',
servicenames['qmail']='qmail',
servicenames['qpsmtpd']='qpsmtpd', 'sqpsmtpd',
DEBUG = False
smechange = False
smechangelist = dict()
ourfile = False
# not used
erasing = False
# not used
smeEventPretrans = False
removenorebootok = dict()
class SMEServer(dnf.Plugin):
name = "smeserver"
def __init__(self, base, cli):
super(SMEServer, self).__init__(base, cli)
self.base = base
self.logger = logger
self.report_yum_status('init')
def log(self,s):
if DEBUG :
print(s)
def createevent(self):
if os.path.isdir('/etc/e-smith/events/temp'):
shutil.rmtree('/etc/e-smith/events/temp')
os.makedirs('/etc/e-smith/events/temp/services2adjust', 0o777)
os.makedirs('/etc/e-smith/events/temp/templates2expand', 0o777)
def addtemplate2expand(self,template):
#check filename
head_tail = os.path.split(template)
head = head_tail[0];
filename = head_tail[1];
# create dir
if not os.path.isdir('/etc/e-smith/events/temp/templates2expand' + head):
os.makedirs('/etc/e-smith/events/temp/templates2expand' + head, 0o777)
#touch file
fname= '/etc/e-smith/events/temp/templates2expand'+ template
fhandle = open(fname, 'a')
try:
os.utime(fname, None)
finally:
fhandle.close()
def report_yum_status(self,status):
fileHandle = open(status_file, 'w')
fileHandle.write(status)
fileHandle.close()
def pre_config(self):
self.report_yum_status('pre_config')
def config(self):
self.report_yum_status('config')
def sack(self):
global ourfile
ourfile = True
self.report_yum_status('sack')
def resolved(self):
self.report_yum_status('resolved')
#2 PKG_DOWNGRADE = dnf.transaction.PKG_DOWNGRADE # :api
#1 PKG_INSTALL = dnf.transaction.PKG_INSTALL # :api
#4 PKG_OBSOLETE = dnf.transaction.PKG_OBSOLETE # :api
#9 PKG_REINSTALL = dnf.transaction.PKG_REINSTALL # :api
#8 PKG_REMOVE = dnf.transaction.PKG_ERASE # :api
#6 PKG_UPGRADE = dnf.transaction.PKG_UPGRADE # :api
#7 PKG_UPGRADED = libdnf.transaction.TransactionItemAction_UPGRADED
#101 PKG_CLEANUP = dnf.transaction.PKG_CLEANUP # :api
#102 PKG_VERIFY = dnf.transaction.PKG_VERIFY # :api
#103 PKG_SCRIPTLET = dnf.transaction.PKG_SCRIPTLET # :api
def pre_transaction(self):
self.report_yum_status('pretrans')
# Prefetch filelist for packages to be removed,
in_ts_items = []
out_ts_items = []
all_ts_items = []
for ts_item in self.base.transaction:
if ts_item.action in dnf.transaction.FORWARD_ACTIONS:
in_ts_items.append(ts_item)
elif ts_item.action in dnf.transaction.BACKWARD_ACTIONS:
out_ts_items.append(ts_item)
else:
# The action is not rpm change. It can be a reason change, therefore we can skip that item
continue
all_ts_items.append(ts_item)
allpkgs = all_ts_items # [tsi.pkg for tsi in all_ts_items]
# also to see dnf.db.group.RPMTransaction.install_set
installs = in_ts_items #[tsi.pkg for tsi in in_ts_items]
installs_dict = {}
for item in installs:
nam = item.name
installs_dict[nam] = item
# one liner new_dict = {item['name']:item for item in data}
# also to see dnf.db.group.RPMTransaction.remove_set
removes = out_ts_items #[tsi.pkg for tsi in out_ts_items]
self.log('## allpkgs: ' + str([ str(tsi.pkg) for tsi in allpkgs]))
self.log('## installs: ' +str([ str(tsi.pkg) for tsi in installs]))
self.log('## Removes: ' + str([ str(tsi.pkg) for tsi in removes]))
##allpkgs: ['smeserver-tinydns-11.0.0-4.el8.sme.noarch', 'smeserver-tinydns-11.0.0-3.el8.sme.noarch']
## install: ['smeserver-tinydns-11.0.0-4.el8.sme.noarch']
## Remove: ['smeserver-tinydns-11.0.0-3.el8.sme.noarch']
# list of all instaled rpm
base = dnf.Base()
base.fill_sack()
q = base.sack.query()
rpmdb = q.installed()
global smechange
global eventlist
global actionlist
global templateslist
global serviceslist
global erasing
global smeEventPretrans
global removenorebootok
# reinstall are not listed there so already skipped
# downgrade are going there
# update are going there, we filter them out
# real removal are the real deal there ; downgrade are played like if they were removal
for tsmem in removes:
erasing = True
n= str(tsmem.name)
# if the pkg.name is present on both IN and OUT, then we assume update/downgrade and continue to transaction
if n in installs_dict :
#self.log('updating ==> state ' + str(tsmem.pkg) + " to " + str(installs_dict[n].pkg) )
continue
self.log('**Package: ' + str(tsmem.pkg) + ' to be removed')
smeevent = n + '-update'
#check if /etc/e-smith/events/$smeevent exist, if yes add it to todo list
if os.path.isdir(events_path + os.sep + smeevent):
tmppath = events_path + os.sep + smeevent + os.sep
eventlist[n] = smeevent
# if templates to expand, add them
if os.path.isdir(tmppath + "templates2expand" + os.sep):
tmppathtmpl = tmppath + "templates2expand" + os.sep
for subdir, dirs, files in os.walk(tmppathtmpl):
for file in files:
mytmptemplate = os.path.join(subdir, file).replace(tmppathtmpl,os.sep)
if mytmptemplate not in templateslist :
templateslist[mytmptemplate]=mytmptemplate
self.log(" template " + mytmptemplate)
# we add the actions scripts
tmppathsrv = tmppath + os.sep
files = [f for f in os.listdir(tmppathsrv)]
for f in files:
if os.path.islink(tmppathsrv + f):
mytmpaction = os.path.realpath(os.readlink(tmppath + f).replace("..",events_path))
self.log(" link " + f + ": " + mytmpaction)
actionlist[f]=mytmpaction
# if there are services to handle we had them
if os.path.isdir(tmppath + "services2adjust" + os.sep):
tmppathsrv = tmppath + "services2adjust" + os.sep
files = [f for f in os.listdir(tmppathsrv)]
for f in files:
if os.path.islink(tmppathsrv + f):
self.log(" service link " + f + ": " + (os.readlink(tmppathsrv + f)))
mytmpserv = os.readlink(tmppathsrv + f)
# we had the service with its action, except if we need to force a restart
# TODO as we have only pkgs to remove here, shouldn't we just stop the service NOW?
if f not in serviceslist :
serviceslist[f]=mytmpserv
else:
if mytmpserv == "restart":
self.log("overriding all signals, forcing restart " + f )
serviceslist[f]="restart"
removenorebootok[n]=1;
else:
# if we are here this is a smeserver pkg without an update event, needs reboot...
if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale'):
smechange = True
smechangelist[n]=str(tsmem.pkg)
self.log("smechange set to True because of " + n + " without an update event " + str(tsmem.pkg) )
#end of if smeserver-*-update event exist
# do we need this for removal ?
if "/etc/e-smith/web/panels/manager/cgi-bin" in tsmem.files :
self.log(" ==> pannel detected : adding navigation-conf")
actionlist['S80navigation-conf']="/etc/e-smith/events/actions/navigation-conf"
#end of for list of packages
#only for debug
self.log('## smechange: '+str(smechange))
self.log('## eventlist: '+ str(eventlist))
self.log('## templateslist: '+str(templateslist.keys()))
self.log('## serviceslist: '+str(serviceslist.items()))
self.log('## actions ALL: ' + str(actionlist.keys()))
self.log('## smechangelist: ' + str(smechangelist.keys()))
if len(serviceslist)>0:
# would it be a good idea to do some action/event there to stop service being removed ?
# for the moment we do not, logic : if template still there at posttrans, we expand it after removal
# probably the actions in some situations could be done before...
# create an empty temp event
print("Creating temporary event 'temp' and populating it...")
self.createevent()
print(" Adding services to adjust")
for kservices in serviceslist:
self.log(" " + kservices + ": " + serviceslist[kservices])
os.symlink(serviceslist[kservices], '/etc/e-smith/events/temp/services2adjust/' + kservices)
# execute the event ; should we really wait ??
print("Executing signal-event temp before uninstalling ...........")
os.spawnl(os.P_WAIT,signal_event,signal_event, 'temp')
smeEventPretrans = True;
def transaction(self):
self.report_yum_status('transaction')
#ts = self.getTsInfo()
#rpmdb = self.getRpmDB()
# Prefetch filelist for packages to be removed,
in_ts_items = []
out_ts_items = []
all_ts_items = []
for ts_item in self.base.transaction:
if ts_item.action in dnf.transaction.FORWARD_ACTIONS:
in_ts_items.append(ts_item)
elif ts_item.action in dnf.transaction.BACKWARD_ACTIONS:
out_ts_items.append(ts_item)
else:
# The action is not rpm change. It can be a reason change, therefore we can skip that item
continue
all_ts_items.append(ts_item)
allpkgs = all_ts_items # [tsi.pkg for tsi in all_ts_items]
# also to see dnf.db.group.RPMTransaction.install_set
installs = in_ts_items #[tsi.pkg for tsi in in_ts_items]
installs_dict = {}
for item in installs:
nam = item.name
installs_dict[nam] = item
# one liner new_dict = {item['name']:item for item in data}
# also to see dnf.db.group.RPMTransaction.remove_set
removes = out_ts_items #[tsi.pkg for tsi in out_ts_items]
global smechange
global eventlist
global actionlist
global templateslist
global serviceslist
global erasing
global smeEventPretrans
global removenorebootok
global ourfile
for tsmem in installs:
# n: name ; a : arch; e: epoch ; v: version, r: release
n = tsmem.name
a = tsmem.arch
e = tsmem.epoch
v = tsmem.version
r = tsmem.release
# if we're upgrading/installing/removing a rebootpkgs package.. a reboot is required
for pkg in rebootpkgs:
if n.startswith(pkg):
self.log('**Package: ' + n + ' triggers reboot')
# we do some exclusions -devel -doc ...
if pkg in rebootpkgsexclude:
cont=False
for name in rebootpkgsexclude[pkg]:
if n.startswith(pkg + name):
cont=True
if cont:
# this is an exception we do not need reboot : -devel, -doc ...
continue
# either no exception or does not fit exceptions: we need reboot
smechange = True
smechangelist[n]=str(n) + "-" + str(v) + "-" + str(r)
self.log("smechange set to True because of " + n + " with " + str(v) + "-" + str(r) )
#self.log("smechange set to True because of " + pkg)
# check if we're upgrading a restartpkgs rpm
for pkg in restartpkgs:
if n.startswith(pkg):
if pkg in servicenames:
for name in servicenames[pkg]:
if name not in serviceslist :
serviceslist[name] = 'restart'
else:
if pkg not in serviceslist :
serviceslist[pkg] = 'restart'
#if smechange is true we can ignore the following part
# wondering if we reallly do want to ignore that : let's say we want to delay kernel reboot,
# could we at least configure httpd cleanly until next week ?
# also when updating a package the erasing flag was on and prevented to do this ....
# if not smechange and not erasing:
#if True:
smeevent = n + '-update'
if os.path.isdir(events_path + os.sep + smeevent):
tmppath = events_path + os.sep + smeevent + os.sep
eventlist[n] = smeevent
files = [f for f in os.listdir(tmppath)]
for f in files:
if os.path.islink(tmppath + f):
mytmpaction = os.path.realpath(os.readlink(tmppath + f).replace("..",events_path))
#self.log(" link " + f + ": " + mytmpaction)
actionlist[f]=mytmpaction
if os.path.isdir(tmppath + "templates2expand" + os.sep):
tmppathtmpl = tmppath + "templates2expand" + os.sep
for subdir, dirs, files in os.walk(tmppathtmpl):
for file in files:
mytmptemplate = os.path.join(subdir, file).replace(tmppathtmpl,os.sep)
if mytmptemplate not in templateslist :
templateslist[mytmptemplate]=mytmptemplate
self.log(" template " + mytmptemplate)
if os.path.isdir(tmppath + "services2adjust" + os.sep):
tmppathsrv = tmppath + "services2adjust" + os.sep
files = [f for f in os.listdir(tmppathsrv)]
for f in files:
if os.path.islink(tmppathsrv + f):
self.log(" service link " + f + ": " + (os.readlink(tmppathsrv + f)))
mytmpserv = os.readlink(tmppathsrv + f)
if f not in serviceslist :
serviceslist[f]=mytmpserv
else:
if mytmpserv == "restart":
#only for debug
self.log("overriding all signals, forcing restart " + f)
serviceslist[f]="restart"
else:
if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale') and not (n in removenorebootok):
smechange = True
smechangelist[n]=str(tsmem.name) + "-" + str(tsmem.version) + "-" + str(tsmem.release)
self.log("smechange set to True because of " + n )
# as long as it is a sme pkg we need to rebuild panel
if "/etc/e-smith/web/panels/manager/cgi-bin" in tsmem.files :
self.log(" ==> pannel detected : adding navigation-conf")
actionlist['S80navigation-conf']="/etc/e-smith/events/actions/navigation-conf"
# end of for installed list
#only for debug
self.log('## smechange: '+str(smechange))
self.log('## eventlist: '+ str(eventlist))
self.log('## templateslist: '+str(templateslist.keys()))
self.log('## serviceslist: '+str(serviceslist.items()))
self.log('## actions ALL: ' + str(actionlist.keys()))
self.log('## smechangelist: ' + str(smechangelist.keys()))
# check if smechange is true or if eventlist has items.. in both cases we must initialize databases
if smechange == True or len(eventlist)>0:
print('Initializing databases')
os.spawnl(os.P_WAIT, initialize_database, initialize_database)
# just in case we add systemd-default and systemd-reload
if 'S88systemd-default' not in actionlist :
actionlist['S88systemd-default'] = '/etc/e-smith/events/actions/systemd-default'
if 'S89systemd-reload' not in actionlist :
actionlist['S89systemd-reload'] = '/etc/e-smith/events/actions/systemd-reload'
# here we would like to remove duplicates
# those are potential : S??navigation-conf S??systemd-reload S??systemd-default
for act in ('navigation-conf','systemd-reload','systemd-default'):
global iter
iter = 0
tmpactionlist = actionlist
for key in list(tmpactionlist):
if key.endswith(act):
iter += 1
if iter>1:
del actionlist[key]
self.log("removing duplicate action " + key + " iter " + str(iter))
self.report_yum_status('transaction')
self.log("smeserver.py: transaction")
# now, if smechange is false (no reboot needed), we can execute actions, expand templates and adjust services
# create an empty temp event
print("Creating temporary event 'temp' and populating it...")
self.createevent()
# fill it with our list of actions
if len(actionlist)>0:
print(" Adding actions to execute")
for kactions in actionlist:
if os.path.isfile(actionlist[kactions]):
self.log(" " + kactions)
os.symlink(actionlist[kactions],'/etc/e-smith/events/temp/' + kactions)
# fill it with our list of templates to expand
if len(templateslist)>0:
print(" Adding templates to expand")
for ktemplates in templateslist:
mytemplatedir = '/etc/e-smith/templates/' + ktemplates
mytemplatemeta = '/etc/e-smith/templates.metadata/' + ktemplates
if os.path.exists(mytemplatedir) or os.path.exists(mytemplatemeta):
self.log(" " + ktemplates)
self.addtemplate2expand(ktemplates)
if len(serviceslist)>0:
print(" Adding services to adjust")
for kservices in serviceslist:
self.log(" " + kservices + ": " + serviceslist[kservices])
os.symlink(serviceslist[kservices], '/etc/e-smith/events/temp/services2adjust/' + kservices)
# execute the event ; should we really wait ??
print("Executing signal-event temp ...........")
os.spawnl(os.P_WAIT,signal_event,signal_event, 'temp')
if smechange:
os.spawnl(os.P_WAIT, config_set, config_set, 'set', 'UnsavedChanges', 'yes')
os.spawnl(os.P_WAIT, navigation_conf, navigation_conf)
syslog.syslog('Needs signal-event post-upgrade; signal-event reboot because of: ' + str(smechangelist.keys()) )
print("Reload dnf db for server-manager")
os.spawnl(os.P_WAIT, systemctl, systemctl, 'restart', 'dnf')
#no more close hook
#def close_hook(conduit):
if ourfile and os.path.isfile(status_file):
os.unlink(status_file)
if smechange:
print("\nThe following updates require a server reboot:\n" + str(smechangelist.keys()))
print("\n==============================================================\n")
print("WARNING: You now need to run BOTH of the following commands")
print("to ensure consistent system state:")
print("signal-event post-upgrade; signal-event reboot")
print("You should run these commands unless you are certain that")
print("dnf made no changes to your system.\n")
print("==============================================================")

View File

@@ -0,0 +1,2 @@
[Service]
SyslogIdentifier=dnf-automatic

View File

@@ -0,0 +1,2 @@
[Service]
SyslogIdentifier=dnf-automatic

View File

@@ -0,0 +1,2 @@
[Service]
SyslogIdentifier=dnf-automatic

View File

@@ -0,0 +1,2 @@
[Service]
SyslogIdentifier=dnf-automatic

View File

@@ -0,0 +1,3 @@
[Service]
SyslogIdentifier=dnf-makecache

View File

@@ -4,6 +4,8 @@ After=network-pre.target networking.service
[Service]
Type=forking
SyslogIdentifier=dnf_update_dbs
ExecStartPre=-/etc/e-smith/events/actions/dnf_modules
ExecStartPre=/sbin/e-smith/service-status dnf
ExecStart=/sbin/e-smith/dnf_update_dbs
TimeoutSec=0

View File

@@ -1,447 +0,0 @@
# vim: noexpandtab tabstop=4
import os
import shutil
import subprocess
import syslog
from yum.constants import *
from yum.plugins import PluginYumExit
from yum.plugins import TYPE_CORE
from yum.packages import parsePackages
from yum.packages import RpmBase
requires_api_version = '2.1'
plugin_type = (TYPE_CORE,)
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"
dnf_update_dbs = events_path + '/actions/yum-update-dbs'
Conflicts=yum-cron.service dnf-automatic-notifyonly.service dnf-automatic.service
signal_event = '/sbin/e-smith/signal-event'
config_set = '/sbin/e-smith/config'
status_file = '/var/cache/dnf/dnf.status'
expand_template = '/sbin/e-smith/expand-template'
service = '/sbin/e-smith/service'
eventlist = dict()
actionlist = dict()
templateslist = dict()
serviceslist = dict()
# list of packages that need a reboot
# if a package name starts with one these names, a reboot is needed
rebootpkgs = ['daemontools', 'dbus', 'glibc', 'gnutls', 'kernel', 'linux-firmware', 'lvm2', 'mdadm', 'openssl-libs', 'systemd']
# exclusions :
rebootpkgsexclude = dict()
rebootpkgsexclude['dbus']='-python','-tests','-devel','-doc',
rebootpkgsexclude['glibc']='-devel','-headers','-statics','-utils','-glib',
rebootpkgsexclude['gnutls']='-devel',
rebootpkgsexclude['kernel']='-doc','-debug','-devel','-abi-whitelists','tools',
rebootpkgsexclude['lvm2']='-devel','-python',
rebootpkgsexclude['systemd']='-devel','-python',
# list of packages that need a service restart
# if a package name starts with one of these values, a service restart is needed
# since, for example, httpd means httpd-admin and httpd-e-smith, we won't use these names directly but via serviceslist (see below)
restartpkgs = ['dovecot','bglibs','cvm','freeradius','httpd','iptables', 'mariadb' , 'nut', 'openldap', 'openssh', 'php', 'pptpd', 'proftp', 'samba', 'spamassassin', 'squid', 'qmail', 'qpsmtpd']
servicenames = dict()
servicenames['bglibs']='cvm-unix',
servicenames['cvm']='cvm-unix',
servicenames['dovecot']='dovecot',
servicenames['freeradius']='radiusd',
servicenames['httpd']='httpd-admin','httpd-e-smith',
servicenames['iptables']='masq',
servicenames['mariadb']='mariadb',
servicenames['nut']='nut-server','nut-driver','nut-monitor',
servicenames['openldap']='ldap',
servicenames['openssh']='sshd',
servicenames['php']='httpd-e-smith', 'php-fpm', 'php55-php-fpm', 'php56-php-fpm', 'php70-php-fpm', 'php71-php-fpm', 'php72-php-fpm', 'php73-php-fpm', 'php74-php-fpm', 'php80-php-fpm', 'php81-php-fpm',
servicenames['proftp']='ftp',
servicenames['samba']='smb',
servicenames['spamassassin']='spamassassin',
servicenames['squid']='squid',
servicenames['qmail']='qmail',
servicenames['qpsmtpd']='qpsmtpd',
smechange = False
smechangelist = dict()
ourfile = False
erasing = False
DEBUG = False
smeEventPretrans = False
removenorebootok = dict()
def log(s):
if DEBUG :
print s
def createevent():
if os.path.isdir('/etc/e-smith/events/temp'):
shutil.rmtree('/etc/e-smith/events/temp')
os.makedirs('/etc/e-smith/events/temp/services2adjust', 0o777)
os.makedirs('/etc/e-smith/events/temp/templates2expand', 0o777)
def addtemplate2expand(template):
#check filename
head_tail = os.path.split(template)
head = head_tail[0];
filename = head_tail[1];
# create dir
if not os.path.isdir('/etc/e-smith/events/temp/templates2expand' + head):
os.makedirs('/etc/e-smith/events/temp/templates2expand' + head, 0o777)
#touch file
fname= '/etc/e-smith/events/temp/templates2expand'+ template
fhandle = open(fname, 'a')
try:
os.utime(fname, None)
finally:
fhandle.close()
def report_yum_status(status):
fileHandle = open(status_file, 'w')
fileHandle.write(status)
fileHandle.close()
def predownload_hook(conduit):
report_yum_status('predownload')
def postdownload_hook(conduit):
report_yum_status('postdownload')
def prereposetup_hook(conduit):
global ourfile
ourfile = True
report_yum_status('prereposetup')
def postreposetup_hook(conduit):
report_yum_status('postreposetup')
def exclude_hook(conduit):
report_yum_status('exclude')
def preresolve_hook(conduit):
report_yum_status('preresolve')
def postresolve_hook(conduit):
report_yum_status('postresolve')
def pretrans_hook(conduit):
# we might need to change the strategy here to make a difference between update and removal.
#transaction set states
#TS_UPDATE = 10
#TS_INSTALL = 20
#TS_TRUEINSTALL = 30
#TS_ERASE = 40
#TS_OBSOLETED = 50
#TS_OBSOLETING = 60
#TS_AVAILABLE = 70
#TS_UPDATED = 90
#TS_FAILED = 100
#TS_INSTALL_STATES = [TS_INSTALL, TS_TRUEINSTALL, TS_UPDATE, TS_OBSOLETING]
#TS_REMOVE_STATES = [TS_ERASE, TS_OBSOLETED, TS_UPDATED]
report_yum_status('pretrans')
log("*******Pretrans********")
# Prefetch filelist for packages to be removed,
# otherwise for updated packages headers will not be available
ts = conduit.getTsInfo()
removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES)
rpmdb = conduit.getRpmDB()
global smechange
global eventlist
global actionlist
global templateslist
global serviceslist
global erasing
global smeEventPretrans
global removenorebootok
# reinstall are not listed there so already skipped
# downgrade are going there
# update are going there, we filter them out
# real removal are the real deal there ; downgrade are played like if they were removal
for tsmem in removes:
erasing = True
(n, a, e, v, r) = tsmem.po.pkgtup
if tsmem.output_state == TS_UPDATED :
# if we are actually updating then we are not removing, and new package will do better... skipping
log('skiping as updating ==> state ' + str(tsmem.po.state) + " RPM current state" + str(tsmem.current_state) + " RPM output state" + str(tsmem.output_state))
continue
log('**Package: ' + tsmem.name + ' to be removed')
smeevent = tsmem.name + '-update'
if os.path.isdir(events_path + os.sep + smeevent):
tmppath = events_path + os.sep + smeevent + os.sep
eventlist[tsmem.name] = smeevent
if os.path.isdir(tmppath + "templates2expand" + os.sep):
tmppathtmpl = tmppath + "templates2expand" + os.sep
for subdir, dirs, files in os.walk(tmppathtmpl):
for file in files:
mytmptemplate = os.path.join(subdir, file).replace(tmppathtmpl,os.sep)
if not templateslist.has_key(mytmptemplate):
templateslist[mytmptemplate]=mytmptemplate
log(" template " + mytmptemplate)
# nothing for actions ???
tmppathsrv = tmppath + os.sep
files = [f for f in os.listdir(tmppathsrv)]
for f in files:
if os.path.islink(tmppathsrv + f):
mytmpaction = os.path.realpath(os.readlink(tmppath + f).replace("..",events_path))
log(" link " + f + ": " + mytmpaction)
actionlist[f]=mytmpaction
# end debug print
if os.path.isdir(tmppath + "services2adjust" + os.sep):
tmppathsrv = tmppath + "services2adjust" + os.sep
files = [f for f in os.listdir(tmppathsrv)]
for f in files:
if os.path.islink(tmppathsrv + f):
log(" service link " + f + ": " + (os.readlink(tmppathsrv + f)))
mytmpserv = os.readlink(tmppathsrv + f)
if not serviceslist.has_key(f):
serviceslist[f]=mytmpserv
else:
if mytmpserv == "restart":
log("overriding all signals, forcing restart " + f )
serviceslist[f]="restart"
removenorebootok[n]=1;
thispo = rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
# thispo.dirlist thispo.ghostlist thispo.filelist
if "/etc/e-smith/web/panels/manager/cgi-bin" in thispo.dirlist:
log(" ==> pannel detected : adding navigation-conf")
actionlist['S80navigation-conf']="/etc/e-smith/events/actions/navigation-conf"
else:
if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale'):
smechange = True
smechangelist[n]=str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state)
log("smechange set to True because of " + n + " with " + str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state) )
#only for debug
log('## smechange: '+str(smechange))
log('## eventlist: '+ str(eventlist))
log('## templateslist: '+str(templateslist.keys()))
log('## serviceslist: '+str(serviceslist.items()))
log('## actions ALL: ' + str(actionlist.keys()))
log('## smechangelist: ' + str(smechangelist.keys()))
if len(serviceslist)>0:
# would it be a good idea to do some action/event there to stop service being removed ?
# for the moment we do not, logic : if template still there at posttrans, we expand it after removal
# probably the actions in some situations could be done before...
# create an empty temp event
print "Creating temporary event 'temp' and populating it..."
createevent()
print " Adding services to adjust"
for kservices in serviceslist:
log(" " + kservices + ": " + serviceslist[kservices])
os.symlink(serviceslist[kservices], '/etc/e-smith/events/temp/services2adjust/' + kservices)
# execute the event ; should we really wait ??
print "Executing signal-event temp before uninstalling ..........."
os.spawnl(os.P_WAIT,signal_event,signal_event, 'temp')
smeEventPretrans = True;
def posttrans_hook(conduit):
report_yum_status('posttrans')
log("*******Postrans********")
ts = conduit.getTsInfo()
rpmdb = conduit.getRpmDB()
global smechange
global eventlist
global actionlist
global templateslist
global serviceslist
global erasing
global smeEventPretrans
global removenorebootok
for tsmem in ts.getMembers():
(n, a, e, v, r) = tsmem.po.pkgtup
# n: name ; a : arch; e: epoch ; v: version, r: release
#if tsmem.output_state in TS_INSTALL_STATES:
# thispo = rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
# we're upgrading/installing/removing a rebootpkgs package.. a reboot is required
for pkg in rebootpkgs:
if n.startswith(pkg):
log('**Package: ' + tsmem.name + ' triggers reboot')
# we do some exclusions -devel -doc ...
if pkg in rebootpkgsexclude:
cont=False
for name in rebootpkgsexclude[pkg]:
if n.startswith(pkg + name):
cont=True
if cont:
# this is an exception we do not need reboot : -devel, -doc ...
continue
# either no exception or does not fit exceptions: we need reboot
smechange = True
smechangelist[n]=str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state)
log("smechange set to True because of " + n + " with " + str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state))
#log("smechange set to True because of " + pkg)
# check if we're upgrading a restartpkgs rpm
for pkg in restartpkgs:
if n.startswith(pkg):
if pkg in servicenames:
for name in servicenames[pkg]:
if not serviceslist.has_key(name):
serviceslist[name] = 'restart'
else:
if not serviceslist.has_key(pkg):
serviceslist[pkg] = 'restart'
#if smechange is true we can ignore the following part
# wondering if we reallly do want to ignore that : let's say we want to delay kernel reboot,
# could we at least configure httpd cleanly until next week ?
# also when updating a package the erasing flag was on and prevented to do this ....
# if not smechange and not erasing:
if True:
smeevent = tsmem.name + '-update'
if os.path.isdir(events_path + os.sep + smeevent):
tmppath = events_path + os.sep + smeevent + os.sep
eventlist[tsmem.name] = smeevent
files = [f for f in os.listdir(tmppath)]
for f in files:
if os.path.islink(tmppath + f):
mytmpaction = os.path.realpath(os.readlink(tmppath + f).replace("..",events_path))
#log(" link " + f + ": " + mytmpaction)
actionlist[f]=mytmpaction
if os.path.isdir(tmppath + "templates2expand" + os.sep):
tmppathtmpl = tmppath + "templates2expand" + os.sep
for subdir, dirs, files in os.walk(tmppathtmpl):
for file in files:
mytmptemplate = os.path.join(subdir, file).replace(tmppathtmpl,os.sep)
if not templateslist.has_key(mytmptemplate):
templateslist[mytmptemplate]=mytmptemplate
log(" template " + mytmptemplate)
if os.path.isdir(tmppath + "services2adjust" + os.sep):
tmppathsrv = tmppath + "services2adjust" + os.sep
files = [f for f in os.listdir(tmppathsrv)]
for f in files:
if os.path.islink(tmppathsrv + f):
log(" service link " + f + ": " + (os.readlink(tmppathsrv + f)))
mytmpserv = os.readlink(tmppathsrv + f)
if not serviceslist.has_key(f):
serviceslist[f]=mytmpserv
else:
if mytmpserv == "restart":
#only for debug
log("overriding all signals, forcing restart " + f)
serviceslist[f]="restart"
if tsmem.output_state in TS_INSTALL_STATES:
thispo = rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
# thispo.dirlist thispo.ghostlist thispo.filelist
if "/etc/e-smith/web/panels/manager/cgi-bin" in thispo.dirlist:
log(" ==> pannel detected : adding navigation-conf")
actionlist['S80navigation-conf']="/etc/e-smith/events/actions/navigation-conf"
else:
if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale') and not (n in removenorebootok):
smechange = True
smechangelist[n]=str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state)
log("smechange set to True because of " + n + " with " + str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state) )
#only for debug
log('## smechange: '+str(smechange))
log('## eventlist: '+ str(eventlist))
log('## templateslist: '+str(templateslist.keys()))
log('## serviceslist: '+str(serviceslist.items()))
log('## actions ALL: ' + str(actionlist.keys()))
log('## smechangelist: ' + str(smechangelist.keys()))
# check if smechange is true or if eventlist has items.. in both cases we must initialize databases
if smechange == True or len(eventlist)>0:
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('S88systemd-default'):
actionlist['S88systemd-default'] = '/etc/e-smith/events/actions/systemd-default'
if not actionlist.has_key('S89systemd-reload'):
actionlist['S89systemd-reload'] = '/etc/e-smith/events/actions/systemd-reload'
# here we would like to remove duplicates
# those are potential : S??navigation-conf S??systemd-reload S??systemd-default
for act in ('navigation-conf','systemd-reload','systemd-default'):
global iter
iter = 0
for key in actionlist.keys():
if key.endswith(act):
iter += 1
if iter>1:
del actionlist[key]
log("removing duplicate action " + key + " iter " + str(iter))
# now, if smechange is false (no reboot needed), we can execute actions, expand templates and adjust services
# create an empty temp event
print "Creating temporary event 'temp' and populating it..."
createevent()
# fill it with our list of actions
if len(actionlist)>0:
print " Adding actions to execute"
for kactions in actionlist:
if os.path.isfile(actionlist[kactions]):
log(" " + kactions)
os.symlink(actionlist[kactions],'/etc/e-smith/events/temp/' + kactions)
# fill it with our list of templates to expand
if len(templateslist)>0:
print " Adding templates to expand"
for ktemplates in templateslist:
mytemplatedir = '/etc/e-smith/templates/' + ktemplates
mytemplatemeta = '/etc/e-smith/templates.metadata/' + ktemplates
if os.path.exists(mytemplatedir) or os.path.exists(mytemplatemeta):
log(" " + ktemplates)
addtemplate2expand(ktemplates)
if len(serviceslist)>0:
print " Adding services to adjust"
for kservices in serviceslist:
log(" " + kservices + ": " + serviceslist[kservices])
os.symlink(serviceslist[kservices], '/etc/e-smith/events/temp/services2adjust/' + kservices)
# execute the event ; should we really wait ??
print "Executing signal-event temp ..........."
os.spawnl(os.P_WAIT,signal_event,signal_event, 'temp')
if smechange:
os.spawnl(os.P_WAIT, config_set, config_set, 'set', 'UnsavedChanges', 'yes')
os.spawnl(os.P_WAIT, navigation_conf, navigation_conf)
syslog.syslog('Needs signal-event post-upgrade; signal-event reboot because of: ' + str(smechangelist.keys()) )
print "Reload yum db for server-manager"
os.spawnl(os.P_WAIT, systemctl, systemctl, 'restart', 'yum')
def close_hook(conduit):
if ourfile and os.path.isfile(status_file):
os.unlink(status_file)
if smechange:
print "\nThe following updates require a server reboot:\n" + str(smechangelist.keys())
print "\n=============================================================="
print "WARNING: You now need to run BOTH of the following commands"
print "to ensure consistent system state:\n"
print "signal-event post-upgrade; signal-event reboot\n"
print "You should run these commands unless you are certain that"
print "yum made no changes to your system."
print "=============================================================="

View File

@@ -180,7 +180,7 @@ sub get_status
{
my ($fm, $prop, $localise) = @_;
my $status = $db->get_prop("yum", $prop) || 'disabled';
my $status = $db->get_prop("dnf", $prop) || 'disabled';
return $status unless $localise;
@@ -196,7 +196,7 @@ sub change_settings
PackageFunctions
) )
{
$db->set_prop('yum', $param, $q->param("yum_$param"));
$db->set_prop('dnf', $param, $q->param("yum_$param"));
}
my $check4updates = $q->param("yum_check4updates");
@@ -204,21 +204,21 @@ sub change_settings
if ($check4updates ne 'disabled') { $status = 'enabled'; }
$db->set_prop('yum', 'check4updates', $check4updates);
$db->set_prop('dnf', 'check4updates', $check4updates);
my $deltarpm = $q->param("yum_DeltaRpmProcess");
$db->set_prop('yum', 'DeltaRpmProcess', $deltarpm);
$db->set_prop('dnf', 'DeltaRpmProcess', $deltarpm);
my $downloadonly = $q->param("yum_DownloadOnly");
if ($downloadonly ne 'disabled') { $status = 'enabled'; }
$db->set_prop('yum', 'DownloadOnly', $downloadonly);
$db->set_prop('dnf', 'DownloadOnly', $downloadonly);
my $AutoInstallUpdates = $q->param("yum_AutoInstallUpdates");
if ($AutoInstallUpdates ne 'disabled') { $status = 'enabled'; }
$db->set_prop('yum', 'AutoInstallUpdates', $AutoInstallUpdates);
$db->set_prop('yum', 'status', $status);
$db->set_prop('dnf', 'AutoInstallUpdates', $AutoInstallUpdates);
$db->set_prop('dnf', 'status', $status);
my %selected = map {$_ => 1} $q->param('SelectedRepositories');

View File

@@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBGaPPbUBCACrfh7C6hG/ZryuDpoK23V2mMHe37hHsMUKojsRulrvPKsICE0t
QFqpppDp+dfJeOEbdA6gI5LZxlsIyAIZ6eYIpCPvjuEWRa9prVbb5y5HKRCq87NW
gTCRwARMiOmAJZ7N+IreyUF8nEBy0JePL2vDt1UsF4OrV5wnJnwUnJELsb5J9fz4
u3mpqGsSxMJp59RRpGVIMl8d1GF4gED5fgDYRZailsJyogE930nfAsPX98B3JHwM
E9931K/unCmj4p9+9dmsVETFPl8ULpFLiyZn6GFz9XuycLiMvM6Fdn2KkoTPX4mS
s9a1LYacZz/qhCeRZZBFtTCIlR9bvN5YdwahABEBAAG0FWtvamlhZG1pbkBrb296
YWxpLm9yZ4kBVAQTAQgAPhYhBATzQ/ljyNxKs+iy5M4aI/dEkiooBQJmjz21AhsD
BQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEM4aI/dEkioonV8H/jZk
du0NDAmg9Vh1zBHCQiuAHL6O+ST1yzMTXDVhAwoQBNBPdmhxceRu7DGCyvF+QKQN
L6j9ERlwc9zpBEWGxI3VW//Z9rw9fq1aFFATNjA9Huu4PNTzPdhvo5mmiw2VXMwe
TPZd6rAR/zY9UVC/FnKbEmHmSVCH15FRAGFEu3yA8WB5hZi5wP+nOZn1GB+Lihjf
C3RoLiAFLIVniCmZEDgyRuePeM7Yyiu5U9/NdfTdU+hGp8N2GBr5OdGXyDyOVgx5
YMdIt72cQSvVQDPz1y2A8GNr3xgfrJi9OvZA422GVaj5Vfop9aXAlwn3488DmGzD
3krKoWRmPCbR7yRMPi65AQ0EZo89tQEIAONb4Aj5JThzphwwbO30A7WlX4imGItU
VNLbfhgeJj5/COhExJ0pl915VnR4FWOsTVpH/Jpbaeal9Al+RFnfbsJkJ/ErMSr2
94h3j7WJiMtyoK5W1g/xdwtBZ1SMlQNtCa5uGAC+iAT+0vD74bqHYdHhA8X0D30d
Xn8TjhNi8jdbODIsVPvwqEZb+xzdiIAmxpEfJopKUvEy8UpEKThZX8GSEWgKnVRP
Q3nEoIhCApFWYYFriP/zFKelGFcaMs98fq22VAtwvPwwkd31nkWakR2k4AHZ8ICl
Frs+JbHLP0zetkQ0jLBxRld5w8FUj/m0CdzpJK71kxx04N7WtFs0LLsAEQEAAYkB
NgQYAQgAIBYhBATzQ/ljyNxKs+iy5M4aI/dEkiooBQJmjz21AhsMAAoJEM4aI/dE
kiooLHIH/3T0jJCIaZW8qbcrlxccxjYJT6s1WkQgshg2NCOvih63kHe3szx7L2mE
DMsKmopkRA8uGJOYRSAj2VKf2f+PFCRLi6vpEjIeB13/nBKyYyRsZCKtexlQyRpc
elRiwcJ9C7bXCZn1ILoleonahnACfWnHh4gVBO85kDdKbrk+tMYqaQd7jGKW/zNB
snDSb4ZzfXnKf4RYJSxfS2w3Jf0byO8AlqScunuxVjcOhOlNU8yCWxxVh5kyzmkr
YTBb5TPc9ibtcTKOUMQRz6gKh+jhepKi1Didt1xreu2hLSEghW4NYEnOC4nkwb1g
n+ECJ+ckVRagPFo6Ws4J5wWIRblF9aY=
=c/Xf
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -2,7 +2,7 @@
Summary: Koozali SME Server rpm updater
Name: %{name}
%define version 11.0.0
%define release 3
%define release 17
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -11,7 +11,7 @@ Source: %{name}-%{version}.tar.xz
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
BuildArchitectures: noarch
Provides: smeserver-yum-%{version}-%{release}
Provides: smeserver-yum
Obsoletes: smeserver-yum < %{version}-%{release}
Requires: smeserver-formmagick
Requires: smeserver-base
@@ -23,9 +23,7 @@ Requires: dnf-automatic
Requires: python3-dnf-plugins-core
Requires: python3-dnf-plugin-post-transaction-actions
Requires: python3-dnf-plugin-versionlock
#Requires: yum-plugin-fastestmirror
#Requires: yum-plugin-priorities
#Requires: yum-plugin-post-transaction-actions
Requires: perl(File::Slurp)
Requires: mailx
BuildRequires: smeserver-devtools
BuildRequires: python3
@@ -70,7 +68,52 @@ mkdir -p root/etc/yum.smerepos.d
%changelog
* Mon Mar 25 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-3.sme
* Sat Dec 21 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-17.sme
- set our prefered modules on different events and dnf.service run [SME: 12618]
- update old manager to use dnf key instead of yum for settings [SME: 12831]
- clean rocky yum_repositories property Name content [SME: 12806]
* Sat Nov 30 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-16.sme
- remove smeupdates and add smecontribs-testing [SME: 12804]
* Fri Nov 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-15.sme
- add PowerTools repo needed for openldap-server [SME: 12790]
- add SME 11 gpg key
* Mon Sep 02 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-14.sme
- fix typo in rsyslog.conf [SME: 12668]
* Wed Aug 21 2024 Brian Read <brianr@koozali.org> 11.0.0-13.sme
- Fix error in createlinks - link to restart yum should be dnf [SME: 12723]
* Sat May 11 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-12.sme
- revert plugin changes to force modules [SME: 12618]
- tag service to limit log noise in message [SME: 12668]
- sort nut service to restart [SME: 12662]
* Tue Apr 23 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- fix debuglevel=-2 not allowed [SME: 12637]
- force modules needed for core [SME: 12618]
php:remi-8.3 perl:5.26 python36:3.6 mariadb:10.5
* Thu Apr 18 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
- fix RuntimeError: dictionary changed size during iteration [SME: 12633]
* Tue Apr 16 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- fix python error in dnf plugin [SME: 12631]
* Mon Apr 08 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- fix python error in dnf plugin [SME: 12601]
- fix server error in old manager [SME: 12602]
* Thu Apr 04 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- rewrite smeserver.py plugin [SME: 12113]
- fix migrate template 39VisibleSmeContribs, 45RockyEOL [SME: 12549]
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-5.sme
- Set license file to GPL2.0 [SME: 12577]
* Mon Mar 25 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-4.sme
- initial release of smeserver-update based on smeserver-yum [SME: 12114]
* tidy centos repos, add rocky repos, add support for metalinks
* tidy most references to yum (except manager), tidy config and templates