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 Name: cern-anaconda-addon
Version: 1.7 Version: 1.8
Release: 1%{?dist} Release: 1%{?dist}
Summary: CERN configuration anaconda addon Summary: CERN configuration anaconda addon
...@@ -31,6 +31,9 @@ install -p -m 644 data/cern.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/ ...@@ -31,6 +31,9 @@ install -p -m 644 data/cern.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/
%doc LICENSE README.md %doc LICENSE README.md
%changelog %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 * Tue Jan 28 2020 Ben Morrice <ben.morrice@cern.ch> - 1.7-1
- Add support for C8 - Add support for C8
......
...@@ -238,31 +238,40 @@ class CernData(AddonData): ...@@ -238,31 +238,40 @@ class CernData(AddonData):
except NoOptionError: except NoOptionError:
print("Unexpected error:", sys.exc_info()[0]) 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 # Configure yum-autoupdate
if self.autoupdate: if self.autoupdate:
yumautoupdate_installed=os.path.isfile('/usr/sbin/yum-autoupdate') if release == '8':
if yumautoupdate_installed == False: # install dnf-automatic instead of custom yum-autoupdate
# 'yum' will work for both 7 and 8 subprocess.check_call(["dnf", "-y", "install", "dnf-automatic"])
subprocess.check_call(["yum", "-y", "install", "yum-autoupdate"]) subprocess.check_call([SYSTEMCTL_BIN, "enable", "--now", "dnf-automatic-install.timer"])
subprocess.check_call([SYSTEMCTL_BIN, "enable", "yum-autoupdate"]) else:
try: yumautoupdate_installed=os.path.isfile('/usr/sbin/yum-autoupdate')
with open(yumupdate_file, "a") as fobj: if yumautoupdate_installed == False:
fobj.write("\n# initial-setup [cern-anaconda-cern] values\n") subprocess.check_call(["yum", "-y", "install", "yum-autoupdate"])
fobj.write("YUMUPDATE=%d\n" % int(self.autoupdate)) subprocess.check_call([SYSTEMCTL_BIN, "enable", "yum-autoupdate"])
fobj.write("YUMONBOOT=%d\n" % int(self.autoupdateboot)) try:
fobj.close() with open(yumupdate_file, "a") as fobj:
except IOError: fobj.write("\n# initial-setup [cern-anaconda-cern] values\n")
print("I/O Error couldn't write %s" % (yumupdate_file)) fobj.write("YUMUPDATE=%d\n" % int(self.autoupdate))
except: fobj.write("YUMONBOOT=%d\n" % int(self.autoupdateboot))
print("Unexpected error:", sys.exc_info()[0]) fobj.close()
except IOError:
print("I/O Error couldn't write %s" % (yumupdate_file))
except:
print("Unexpected error:", sys.exc_info()[0])
else: else:
# we use call rather than check_call as we don't care if this fails # we use call rather than check_call as we don't care if this fails
# due to yumautoupdate not being installed # 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 may not be installed - force install if it's not
locmap_installed=os.path.isfile('/usr/bin/locmap') locmap_installed=os.path.isfile('/usr/bin/locmap')
release=open('/etc/redhat-release','r').read().split(' ')[3].split('.')[0]
if locmap_installed == False: if locmap_installed == False:
# locmap does not reside in CERN repo on 8, install locmap-release # locmap does not reside in CERN repo on 8, install locmap-release
if release == '8': 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