diff --git a/cern-anaconda-addon.spec b/cern-anaconda-addon.spec index 0a540419338b609f5d77ad6b591e1c0266603a1b..d26f3a4fad50a8cfe67a415d693e1b39749fad36 100644 --- a/cern-anaconda-addon.spec +++ b/cern-anaconda-addon.spec @@ -1,5 +1,5 @@ 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 diff --git a/src/cern_customizations/ks/cern.py b/src/cern_customizations/ks/cern.py index 249e5c63f4154cd1ece783964007480dff69a4a7..cd7b3255304300ac3c5f4b7a00309852b9da5e72 100644 --- a/src/cern_customizations/ks/cern.py +++ b/src/cern_customizations/ks/cern.py @@ -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':