Skip to content
Snippets Groups Projects
Commit de1c2cfa authored by Ben Morrice's avatar Ben Morrice
Browse files

use dnf-automatic on 8 family systems

parent 66f428c2
No related branches found
No related tags found
1 merge request!1use dnf-automatic on 8 family systems
Pipeline #2416351 passed
Name: cern-anaconda-addon
Version: 1.7
Version: 1.8
Release: 1%{?dist}
Summary: CERN configuration anaconda addon
......@@ -31,6 +31,9 @@ install -p -m 644 data/cern.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/
%doc LICENSE README.md
%changelog
* Thu Mar 18 2021 Ben Morrice <ben.morrice@cern.ch> - 1.8-1
- Use dnf-automatic instead of yum-autoupdate on 8 family systems
* Tue Jan 28 2020 Ben Morrice <ben.morrice@cern.ch> - 1.7-1
- Add support for C8
......
......@@ -238,31 +238,40 @@ class CernData(AddonData):
except NoOptionError:
print("Unexpected error:", sys.exc_info()[0])
# we will need this for later
release=open('/etc/redhat-release','r').read().split(' ')[3].split('.')[0]
# Configure yum-autoupdate
if self.autoupdate:
yumautoupdate_installed=os.path.isfile('/usr/sbin/yum-autoupdate')
if yumautoupdate_installed == False:
# 'yum' will work for both 7 and 8
subprocess.check_call(["yum", "-y", "install", "yum-autoupdate"])
subprocess.check_call([SYSTEMCTL_BIN, "enable", "yum-autoupdate"])
try:
with open(yumupdate_file, "a") as fobj:
fobj.write("\n# initial-setup [cern-anaconda-cern] values\n")
fobj.write("YUMUPDATE=%d\n" % int(self.autoupdate))
fobj.write("YUMONBOOT=%d\n" % int(self.autoupdateboot))
fobj.close()
except IOError:
print("I/O Error couldn't write %s" % (yumupdate_file))
except:
print("Unexpected error:", sys.exc_info()[0])
if release == '8':
# install dnf-automatic instead of custom yum-autoupdate
subprocess.check_call(["dnf", "-y", "install", "dnf-automatic"])
subprocess.check_call([SYSTEMCTL_BIN, "enable", "--now", "dnf-automatic-install.timer"])
else:
yumautoupdate_installed=os.path.isfile('/usr/sbin/yum-autoupdate')
if yumautoupdate_installed == False:
subprocess.check_call(["yum", "-y", "install", "yum-autoupdate"])
subprocess.check_call([SYSTEMCTL_BIN, "enable", "yum-autoupdate"])
try:
with open(yumupdate_file, "a") as fobj:
fobj.write("\n# initial-setup [cern-anaconda-cern] values\n")
fobj.write("YUMUPDATE=%d\n" % int(self.autoupdate))
fobj.write("YUMONBOOT=%d\n" % int(self.autoupdateboot))
fobj.close()
except IOError:
print("I/O Error couldn't write %s" % (yumupdate_file))
except:
print("Unexpected error:", sys.exc_info()[0])
else:
# we use call rather than check_call as we don't care if this fails
# due to yumautoupdate not being installed
subprocess.call([SYSTEMCTL_BIN, "disable", "yum-autoupdate"])
if release == '8':
subprocess.call([SYSTEMCTL_BIN, "disable", "yum-autoupdate"])
else:
subprocess.call([SYSTEMCTL_BIN, "disable", "dnf-automatic-install.timer"])
# locmap may not be installed - force install if it's not
locmap_installed=os.path.isfile('/usr/bin/locmap')
release=open('/etc/redhat-release','r').read().split(' ')[3].split('.')[0]
if locmap_installed == False:
# locmap does not reside in CERN repo on 8, install locmap-release
if release == '8':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment