diff --git a/SOURCES/9800-rpmostreepayload-Rework-remote-add-handling.patch b/SOURCES/9800-rpmostreepayload-Rework-remote-add-handling.patch new file mode 100644 index 0000000..16b0660 --- /dev/null +++ b/SOURCES/9800-rpmostreepayload-Rework-remote-add-handling.patch @@ -0,0 +1,116 @@ +From c72f979499f5af3091ad8f2017442b3728cdff2f Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Tue, 16 Jun 2015 11:24:20 -0400 +Subject: [PATCH] Rebase + +--- + pyanaconda/packaging/rpmostreepayload.py | 67 ++++++++++++++++++++------------ + 1 file changed, 43 insertions(+), 24 deletions(-) + +diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py +index 5eacd9f..f979c3e 100644 +--- a/pyanaconda/packaging/rpmostreepayload.py ++++ b/pyanaconda/packaging/rpmostreepayload.py +@@ -138,24 +138,25 @@ class RPMOSTreePayload(ArchivePayload): + ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(), + "init-fs", iutil.getTargetPhysicalRoot()]) + +- repo_arg = "--repo=" + iutil.getTargetPhysicalRoot() + '/ostree/repo' ++ self._sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot()) ++ sysroot = OSTree.Sysroot.new(self._sysroot_path) ++ sysroot.load(cancellable) ++ repo = sysroot.get_repo(None)[1] ++ # We don't support resuming from interrupted installs ++ repo.set_disable_fsync(True) + +- # Store this for use in postInstall too, where we need to +- # undo/redo this step. +- self._base_remote_args = ["remote", "add"] ++ self._remoteOptions = {} ++ ++ # Handle variations in pykickstart + if ((hasattr(ostreesetup, 'noGpg') and ostreesetup.noGpg) or + (hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg)): +- self._base_remote_args.append("--set=gpg-verify=false") +- self._base_remote_args.extend([ostreesetup.remote, +- ostreesetup.url]) +- self._safeExecWithRedirect("ostree", [repo_arg] + self._base_remote_args) ++ self._remoteOptions['gpg-verify'] = GLib.Variant('b', False) + +- self._sysroot_path = sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot()) +- sysroot = OSTree.Sysroot.new(sysroot_path) +- sysroot.load(cancellable) ++ repo.remote_change(None, OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS, ++ ostreesetup.remote, ostreesetup.url, ++ GLib.Variant('a{sv}', self._remoteOptions), ++ cancellable) + +- repo = sysroot.get_repo(None)[1] +- repo.set_disable_fsync(True) + progressQ.send_message(_("Starting pull of %(branchName)s from %(source)s") % \ + {"branchName": ostreesetup.ref, "source": ostreesetup.remote}) + +@@ -174,6 +175,14 @@ class RPMOSTreePayload(ArchivePayload): + + progressQ.send_message(_("Preparing deployment of %s") % (ostreesetup.ref, )) + ++ # Now that we have the data pulled, delete the remote for now. ++ # This will allow a remote configuration defined in the tree ++ # (if any) to override what's in the kickstart. Otherwise, ++ # we'll re-add it in post. Ideally, ostree would support a ++ # pull without adding a remote, but that would get quite ++ # complex. ++ repo.remote_delete(self.data.ostreesetup.remote, None) ++ + self._safeExecWithRedirect("ostree", + ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(), + "os-init", ostreesetup.osname]) +@@ -250,24 +259,34 @@ class RPMOSTreePayload(ArchivePayload): + + def postInstall(self): + super(RPMOSTreePayload, self).postInstall() +- ++ + from gi.repository import OSTree + cancellable = None + +- # Reload this data - we couldn't keep it open across +- # the remounts happening. + sysroot = OSTree.Sysroot.new(self._sysroot_path) + sysroot.load(cancellable) + repo = sysroot.get_repo(None)[1] + +- # This is an ugly hack - we didn't have /etc/ostree/remotes.d, +- # so the remote went into /ostree/repo/config. But we want it +- # in /etc, so delete that remote, then re-add it to +- # /etc/ostree/remotes.d, executing ostree inside the sysroot +- # so that it understands it's a "system repository" and should +- # modify /etc. +- repo.remote_delete(self.data.ostreesetup.remote, None) +- self._safeExecWithRedirect("ostree", self._base_remote_args, root=iutil.getSysroot()) ++ # CentOS specific patch (for now) - pull the remote config from usr/etc if it exists. ++ # The OSTree handling here was buggy in that it wasn't looking in the sysroot ++ # for existing remotes. ++ default_remote_path = iutil.getSysroot() + '/usr/etc/ostree/remotes.d/' + self.data.ostreesetup.osname + '.conf' ++ if os.path.isfile(default_remote_path): ++ destpath = iutil.getSysroot() + '/etc/ostree/remotes.d/' + os.path.basename(default_remote_path) ++ self._safeExecWithRedirect('cp', ['-r', '-p', default_remote_path, destpath]) ++ else: ++ # Following up on the "remote delete" above, we removed the ++ # remote from /ostree/repo/config. But we want it in /etc, so ++ # re-add it to /etc/ostree/remotes.d, using the sysroot path. ++ # ++ # However, we ignore the case where the remote already exists, ++ # which occurs when the content itself provides the remote ++ # config file. ++ repo.remote_change(Gio.File.new_for_path(iutil.getSysroot()), ++ OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS, ++ self.data.ostreesetup.remote, self.data.ostreesetup.url, ++ GLib.Variant('a{sv}', self._remoteOptions), ++ cancellable) + + boot = iutil.getSysroot() + '/boot' + +-- +1.8.3.1 + diff --git a/SOURCES/9900-CentOS-atomic-branding.patch b/SOURCES/9900-CentOS-atomic-branding.patch index df84f60..9d51cf2 100644 --- a/SOURCES/9900-CentOS-atomic-branding.patch +++ b/SOURCES/9900-CentOS-atomic-branding.patch @@ -1,7 +1,19 @@ -diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/rhel.py anaconda-19.31.79/pyanaconda/installclasses/rhel.py ---- anaconda-19.31.79__orig/pyanaconda/installclasses/rhel.py 2015-06-05 12:15:44.289946326 +0100 -+++ anaconda-19.31.79/pyanaconda/installclasses/rhel.py 2015-06-05 12:26:37.525644750 +0100 -@@ -30,9 +30,9 @@ +From 6b70a1867fef732cd75ef79782f71c13241622b7 Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Fri, 12 Jun 2015 13:59:05 -0400 +Subject: [PATCH] Use CentOS branding, increase install priority for Atomic + +This is similar to the patch CentOS normally applies to Anaconda, +but updated for Atomic. +--- + pyanaconda/installclasses/rhel.py | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py +index a9a99f6..b924cd2 100644 +--- a/pyanaconda/installclasses/rhel.py ++++ b/pyanaconda/installclasses/rhel.py +@@ -30,9 +30,9 @@ from blivet.platform import platform from blivet.devicelibs import swap class RHELBaseInstallClass(BaseInstallClass): @@ -13,7 +25,7 @@ diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/rhel.py anaconda-19. hidden = True defaultFS = "xfs" -@@ -45,7 +45,7 @@ +@@ -45,7 +45,7 @@ class RHELBaseInstallClass(BaseInstallClass): _l10n_domain = "comps" @@ -22,14 +34,24 @@ diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/rhel.py anaconda-19. def configure(self, anaconda): BaseInstallClass.configure(self, anaconda) -@@ -90,8 +90,8 @@ +@@ -90,9 +90,14 @@ class RHELBaseInstallClass(BaseInstallClass): BaseInstallClass.__init__(self) class RHELAtomicInstallClass(RHELBaseInstallClass): - name = "RHEL Atomic Host" - if productName.startswith("RHEL Atomic"): +- hidden = False + name = "CentOS Atomic Host" -+ if productName.startswith("CentOS Atomic"): - hidden = False ++ # We have to bump priority because RHEL upstream is relying on a ++ # side effect of the OS name starting with "RHEL" instead of "Red ++ # Hat" and thus the normal RHELBaseInstallClass above not ++ # matching. ++ sortPriority = 20001 ++ if not productName.startswith("CentOS "): ++ hidden = True def setDefaultPartitioning(self, storage): + autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, +-- +1.8.3.1 + diff --git a/SPECS/anaconda.spec b/SPECS/anaconda.spec index f83fad7..960af27 100644 --- a/SPECS/anaconda.spec +++ b/SPECS/anaconda.spec @@ -3,7 +3,7 @@ Summary: Graphical system installer Name: anaconda Version: 19.31.79 -Release: 28.atomic%{?dist}.1 +Release: 28.atomic%{?dist}.7 License: GPLv2+ Group: Applications/System URL: http://fedoraproject.org/wiki/Anaconda @@ -48,7 +48,13 @@ Patch30: 0031-rpmostreepayload-Avoid-shutil.copytree-in-favor-of-c.patch Patch31: 0032-rescue-find-root-partition-of-ostree-atomic-installa.patch Patch32: 0033-Add-crashkernel-auto-by-default.patch +### *** CentOS specific patches +# This one needed to be backported from Fedora because CentOS doesn't +# use subscription-manager +Patch9800: 9800-rpmostreepayload-Rework-remote-add-handling.patch +# Rebranding patch, an adaption of the patch for CentOS Core Patch9900: 9900-CentOS-atomic-branding.patch +### ^^^ CentOS specific patches # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -256,6 +262,8 @@ runtime on NFS/HTTP/FTP servers or local disks. %patch31 -p1 %patch32 -p1 +%patch9800 -p1 + %patch9900 -p1 %build