|
Karanbir Singh |
0e45ce |
From c72f979499f5af3091ad8f2017442b3728cdff2f Mon Sep 17 00:00:00 2001
|
|
Karanbir Singh |
0e45ce |
From: Colin Walters <walters@verbum.org>
|
|
Karanbir Singh |
0e45ce |
Date: Tue, 16 Jun 2015 11:24:20 -0400
|
|
Karanbir Singh |
0e45ce |
Subject: [PATCH] Rebase
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
---
|
|
Karanbir Singh |
0e45ce |
pyanaconda/packaging/rpmostreepayload.py | 67 ++++++++++++++++++++------------
|
|
Karanbir Singh |
0e45ce |
1 file changed, 43 insertions(+), 24 deletions(-)
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
|
|
Karanbir Singh |
0e45ce |
index 5eacd9f..f979c3e 100644
|
|
Karanbir Singh |
0e45ce |
--- a/pyanaconda/packaging/rpmostreepayload.py
|
|
Karanbir Singh |
0e45ce |
+++ b/pyanaconda/packaging/rpmostreepayload.py
|
|
Karanbir Singh |
0e45ce |
@@ -138,24 +138,25 @@ class RPMOSTreePayload(ArchivePayload):
|
|
Karanbir Singh |
0e45ce |
["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
|
|
Karanbir Singh |
0e45ce |
"init-fs", iutil.getTargetPhysicalRoot()])
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
- repo_arg = "--repo=" + iutil.getTargetPhysicalRoot() + '/ostree/repo'
|
|
Karanbir Singh |
0e45ce |
+ self._sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
|
|
Karanbir Singh |
0e45ce |
+ sysroot = OSTree.Sysroot.new(self._sysroot_path)
|
|
Karanbir Singh |
0e45ce |
+ sysroot.load(cancellable)
|
|
Karanbir Singh |
0e45ce |
+ repo = sysroot.get_repo(None)[1]
|
|
Karanbir Singh |
0e45ce |
+ # We don't support resuming from interrupted installs
|
|
Karanbir Singh |
0e45ce |
+ repo.set_disable_fsync(True)
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
- # Store this for use in postInstall too, where we need to
|
|
Karanbir Singh |
0e45ce |
- # undo/redo this step.
|
|
Karanbir Singh |
0e45ce |
- self._base_remote_args = ["remote", "add"]
|
|
Karanbir Singh |
0e45ce |
+ self._remoteOptions = {}
|
|
Karanbir Singh |
0e45ce |
+
|
|
Karanbir Singh |
0e45ce |
+ # Handle variations in pykickstart
|
|
Karanbir Singh |
0e45ce |
if ((hasattr(ostreesetup, 'noGpg') and ostreesetup.noGpg) or
|
|
Karanbir Singh |
0e45ce |
(hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg)):
|
|
Karanbir Singh |
0e45ce |
- self._base_remote_args.append("--set=gpg-verify=false")
|
|
Karanbir Singh |
0e45ce |
- self._base_remote_args.extend([ostreesetup.remote,
|
|
Karanbir Singh |
0e45ce |
- ostreesetup.url])
|
|
Karanbir Singh |
0e45ce |
- self._safeExecWithRedirect("ostree", [repo_arg] + self._base_remote_args)
|
|
Karanbir Singh |
0e45ce |
+ self._remoteOptions['gpg-verify'] = GLib.Variant('b', False)
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
- self._sysroot_path = sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
|
|
Karanbir Singh |
0e45ce |
- sysroot = OSTree.Sysroot.new(sysroot_path)
|
|
Karanbir Singh |
0e45ce |
- sysroot.load(cancellable)
|
|
Karanbir Singh |
0e45ce |
+ repo.remote_change(None, OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
|
|
Karanbir Singh |
0e45ce |
+ ostreesetup.remote, ostreesetup.url,
|
|
Karanbir Singh |
0e45ce |
+ GLib.Variant('a{sv}', self._remoteOptions),
|
|
Karanbir Singh |
0e45ce |
+ cancellable)
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
- repo = sysroot.get_repo(None)[1]
|
|
Karanbir Singh |
0e45ce |
- repo.set_disable_fsync(True)
|
|
Karanbir Singh |
0e45ce |
progressQ.send_message(_("Starting pull of %(branchName)s from %(source)s") % \
|
|
Karanbir Singh |
0e45ce |
{"branchName": ostreesetup.ref, "source": ostreesetup.remote})
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
@@ -174,6 +175,14 @@ class RPMOSTreePayload(ArchivePayload):
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
progressQ.send_message(_("Preparing deployment of %s") % (ostreesetup.ref, ))
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
+ # Now that we have the data pulled, delete the remote for now.
|
|
Karanbir Singh |
0e45ce |
+ # This will allow a remote configuration defined in the tree
|
|
Karanbir Singh |
0e45ce |
+ # (if any) to override what's in the kickstart. Otherwise,
|
|
Karanbir Singh |
0e45ce |
+ # we'll re-add it in post. Ideally, ostree would support a
|
|
Karanbir Singh |
0e45ce |
+ # pull without adding a remote, but that would get quite
|
|
Karanbir Singh |
0e45ce |
+ # complex.
|
|
Karanbir Singh |
0e45ce |
+ repo.remote_delete(self.data.ostreesetup.remote, None)
|
|
Karanbir Singh |
0e45ce |
+
|
|
Karanbir Singh |
0e45ce |
self._safeExecWithRedirect("ostree",
|
|
Karanbir Singh |
0e45ce |
["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
|
|
Karanbir Singh |
0e45ce |
"os-init", ostreesetup.osname])
|
|
Karanbir Singh |
0e45ce |
@@ -250,24 +259,34 @@ class RPMOSTreePayload(ArchivePayload):
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
def postInstall(self):
|
|
Karanbir Singh |
0e45ce |
super(RPMOSTreePayload, self).postInstall()
|
|
Karanbir Singh |
0e45ce |
-
|
|
Karanbir Singh |
0e45ce |
+
|
|
Karanbir Singh |
0e45ce |
from gi.repository import OSTree
|
|
Karanbir Singh |
0e45ce |
cancellable = None
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
- # Reload this data - we couldn't keep it open across
|
|
Karanbir Singh |
0e45ce |
- # the remounts happening.
|
|
Karanbir Singh |
0e45ce |
sysroot = OSTree.Sysroot.new(self._sysroot_path)
|
|
Karanbir Singh |
0e45ce |
sysroot.load(cancellable)
|
|
Karanbir Singh |
0e45ce |
repo = sysroot.get_repo(None)[1]
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
- # This is an ugly hack - we didn't have /etc/ostree/remotes.d,
|
|
Karanbir Singh |
0e45ce |
- # so the remote went into /ostree/repo/config. But we want it
|
|
Karanbir Singh |
0e45ce |
- # in /etc, so delete that remote, then re-add it to
|
|
Karanbir Singh |
0e45ce |
- # /etc/ostree/remotes.d, executing ostree inside the sysroot
|
|
Karanbir Singh |
0e45ce |
- # so that it understands it's a "system repository" and should
|
|
Karanbir Singh |
0e45ce |
- # modify /etc.
|
|
Karanbir Singh |
0e45ce |
- repo.remote_delete(self.data.ostreesetup.remote, None)
|
|
Karanbir Singh |
0e45ce |
- self._safeExecWithRedirect("ostree", self._base_remote_args, root=iutil.getSysroot())
|
|
Karanbir Singh |
0e45ce |
+ # CentOS specific patch (for now) - pull the remote config from usr/etc if it exists.
|
|
Karanbir Singh |
0e45ce |
+ # The OSTree handling here was buggy in that it wasn't looking in the sysroot
|
|
Karanbir Singh |
0e45ce |
+ # for existing remotes.
|
|
Karanbir Singh |
0e45ce |
+ default_remote_path = iutil.getSysroot() + '/usr/etc/ostree/remotes.d/' + self.data.ostreesetup.osname + '.conf'
|
|
Karanbir Singh |
0e45ce |
+ if os.path.isfile(default_remote_path):
|
|
Karanbir Singh |
0e45ce |
+ destpath = iutil.getSysroot() + '/etc/ostree/remotes.d/' + os.path.basename(default_remote_path)
|
|
Karanbir Singh |
0e45ce |
+ self._safeExecWithRedirect('cp', ['-r', '-p', default_remote_path, destpath])
|
|
Karanbir Singh |
0e45ce |
+ else:
|
|
Karanbir Singh |
0e45ce |
+ # Following up on the "remote delete" above, we removed the
|
|
Karanbir Singh |
0e45ce |
+ # remote from /ostree/repo/config. But we want it in /etc, so
|
|
Karanbir Singh |
0e45ce |
+ # re-add it to /etc/ostree/remotes.d, using the sysroot path.
|
|
Karanbir Singh |
0e45ce |
+ #
|
|
Karanbir Singh |
0e45ce |
+ # However, we ignore the case where the remote already exists,
|
|
Karanbir Singh |
0e45ce |
+ # which occurs when the content itself provides the remote
|
|
Karanbir Singh |
0e45ce |
+ # config file.
|
|
Karanbir Singh |
0e45ce |
+ repo.remote_change(Gio.File.new_for_path(iutil.getSysroot()),
|
|
Karanbir Singh |
0e45ce |
+ OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
|
|
Karanbir Singh |
0e45ce |
+ self.data.ostreesetup.remote, self.data.ostreesetup.url,
|
|
Karanbir Singh |
0e45ce |
+ GLib.Variant('a{sv}', self._remoteOptions),
|
|
Karanbir Singh |
0e45ce |
+ cancellable)
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
boot = iutil.getSysroot() + '/boot'
|
|
Karanbir Singh |
0e45ce |
|
|
Karanbir Singh |
0e45ce |
--
|
|
Karanbir Singh |
0e45ce |
1.8.3.1
|
|
Karanbir Singh |
0e45ce |
|