|
|
24d05b |
diff -uNrp anaconda-21.48.22.121.orig/pyanaconda/packaging/rpmostreepayload.py anaconda-21.48.22.121/pyanaconda/packaging/rpmostreepayload.py
|
|
|
24d05b |
--- anaconda-21.48.22.121.orig/pyanaconda/packaging/rpmostreepayload.py 2017-06-21 12:44:34.000000000 +0000
|
|
|
24d05b |
+++ anaconda-21.48.22.121/pyanaconda/packaging/rpmostreepayload.py 2017-08-23 02:28:23.121006339 +0000
|
|
|
24d05b |
@@ -142,24 +142,25 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
24d05b |
["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
|
|
|
24d05b |
"init-fs", iutil.getTargetPhysicalRoot()])
|
|
|
24d05b |
|
|
|
24d05b |
- repo_arg = "--repo=" + iutil.getTargetPhysicalRoot() + '/ostree/repo'
|
|
|
24d05b |
+ self._sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
|
|
|
24d05b |
+ sysroot = OSTree.Sysroot.new(self._sysroot_path)
|
|
|
24d05b |
+ sysroot.load(cancellable)
|
|
|
24d05b |
+ repo = sysroot.get_repo(None)[1]
|
|
|
24d05b |
+ # We don't support resuming from interrupted installs
|
|
|
24d05b |
+ repo.set_disable_fsync(True)
|
|
|
24d05b |
+
|
|
|
24d05b |
+ self._remoteOptions = {}
|
|
|
24d05b |
|
|
|
24d05b |
- # Store this for use in postInstall too, where we need to
|
|
|
24d05b |
- # undo/redo this step.
|
|
|
24d05b |
- self._base_remote_args = ["remote", "add"]
|
|
|
24d05b |
+ # Handle variations in pykickstart
|
|
|
24d05b |
if ((hasattr(ostreesetup, 'noGpg') and ostreesetup.noGpg) or
|
|
|
24d05b |
(hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg)):
|
|
|
24d05b |
- self._base_remote_args.append("--set=gpg-verify=false")
|
|
|
24d05b |
- self._base_remote_args.extend([ostreesetup.remote,
|
|
|
24d05b |
- ostreesetup.url])
|
|
|
24d05b |
- self._safeExecWithRedirect("ostree", [repo_arg] + self._base_remote_args)
|
|
|
24d05b |
+ self._remoteOptions['gpg-verify'] = GLib.Variant('b', False)
|
|
|
24d05b |
|
|
|
24d05b |
- self._sysroot_path = sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
|
|
|
24d05b |
- sysroot = OSTree.Sysroot.new(sysroot_path)
|
|
|
24d05b |
- sysroot.load(cancellable)
|
|
|
24d05b |
+ repo.remote_change(None, OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
|
|
|
24d05b |
+ ostreesetup.remote, ostreesetup.url,
|
|
|
24d05b |
+ GLib.Variant('a{sv}', self._remoteOptions),
|
|
|
24d05b |
+ cancellable)
|
|
|
24d05b |
|
|
|
24d05b |
- repo = sysroot.get_repo(None)[1]
|
|
|
24d05b |
- repo.set_disable_fsync(True)
|
|
|
24d05b |
progressQ.send_message(_("Starting pull of %(branchName)s from %(source)s") % \
|
|
|
24d05b |
{"branchName": ostreesetup.ref, "source": ostreesetup.remote})
|
|
|
24d05b |
|
|
|
24d05b |
@@ -192,6 +193,14 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
24d05b |
log.info("ostree pull: " + (progress.get_status() or ""))
|
|
|
24d05b |
progressQ.send_message(_("Preparing deployment of %s") % (ostreesetup.ref, ))
|
|
|
24d05b |
|
|
|
24d05b |
+ # Now that we have the data pulled, delete the remote for now.
|
|
|
24d05b |
+ # This will allow a remote configuration defined in the tree
|
|
|
24d05b |
+ # (if any) to override what's in the kickstart. Otherwise,
|
|
|
24d05b |
+ # we'll re-add it in post. Ideally, ostree would support a
|
|
|
24d05b |
+ # pull without adding a remote, but that would get quite
|
|
|
24d05b |
+ # complex.
|
|
|
24d05b |
+ repo.remote_delete(self.data.ostreesetup.remote, None)
|
|
|
24d05b |
+
|
|
|
24d05b |
self._safeExecWithRedirect("ostree",
|
|
|
24d05b |
["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
|
|
|
24d05b |
"os-init", ostreesetup.osname])
|
|
|
24d05b |
@@ -348,20 +357,30 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
24d05b |
from gi.repository import OSTree
|
|
|
24d05b |
cancellable = None
|
|
|
24d05b |
|
|
|
24d05b |
- # Reload this data - we couldn't keep it open across
|
|
|
24d05b |
- # the remounts happening.
|
|
|
24d05b |
sysroot = OSTree.Sysroot.new(self._sysroot_path)
|
|
|
24d05b |
sysroot.load(cancellable)
|
|
|
24d05b |
repo = sysroot.get_repo(None)[1]
|
|
|
24d05b |
|
|
|
24d05b |
- # This is an ugly hack - we didn't have /etc/ostree/remotes.d,
|
|
|
24d05b |
- # so the remote went into /ostree/repo/config. But we want it
|
|
|
24d05b |
- # in /etc, so delete that remote, then re-add it to
|
|
|
24d05b |
- # /etc/ostree/remotes.d, executing ostree inside the sysroot
|
|
|
24d05b |
- # so that it understands it's a "system repository" and should
|
|
|
24d05b |
- # modify /etc.
|
|
|
24d05b |
- repo.remote_delete(self.data.ostreesetup.remote, None)
|
|
|
24d05b |
- self._safeExecWithRedirect("ostree", self._base_remote_args, root=iutil.getSysroot())
|
|
|
24d05b |
+ # CentOS specific patch (for now) - pull the remote config from usr/etc if it exists.
|
|
|
24d05b |
+ # The OSTree handling here was buggy in that it wasn't looking in the sysroot
|
|
|
24d05b |
+ # for existing remotes.
|
|
|
24d05b |
+ default_remote_path = iutil.getSysroot() + '/usr/etc/ostree/remotes.d/' + self.data.ostreesetup.osname + '.conf'
|
|
|
24d05b |
+ if os.path.isfile(default_remote_path):
|
|
|
24d05b |
+ destpath = iutil.getSysroot() + '/etc/ostree/remotes.d/' + os.path.basename(default_remote_path)
|
|
|
24d05b |
+ self._safeExecWithRedirect('cp', ['-r', '-p', default_remote_path, destpath])
|
|
|
24d05b |
+ else:
|
|
|
24d05b |
+ # Following up on the "remote delete" above, we removed the
|
|
|
24d05b |
+ # remote from /ostree/repo/config. But we want it in /etc, so
|
|
|
24d05b |
+ # re-add it to /etc/ostree/remotes.d, using the sysroot path.
|
|
|
24d05b |
+ #
|
|
|
24d05b |
+ # However, we ignore the case where the remote already exists,
|
|
|
24d05b |
+ # which occurs when the content itself provides the remote
|
|
|
24d05b |
+ # config file.
|
|
|
24d05b |
+ repo.remote_change(Gio.File.new_for_path(iutil.getSysroot()),
|
|
|
24d05b |
+ OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
|
|
|
24d05b |
+ self.data.ostreesetup.remote, self.data.ostreesetup.url,
|
|
|
24d05b |
+ GLib.Variant('a{sv}', self._remoteOptions),
|
|
|
24d05b |
+ cancellable)
|
|
|
24d05b |
|
|
|
24d05b |
boot = iutil.getSysroot() + '/boot'
|
|
|
24d05b |
|