|
|
fbcaed |
From fcd77ee59912d3945950c048d79b8601e7d8bca4 Mon Sep 17 00:00:00 2001
|
|
|
fbcaed |
From: Colin Walters <walters@verbum.org>
|
|
|
fbcaed |
Date: Fri, 17 Oct 2014 13:17:46 -0400
|
|
|
fbcaed |
Subject: [PATCH 3/5] rpmostreepayload: Rework remote add handling
|
|
|
fbcaed |
|
|
|
fbcaed |
We really want the remote to be in /etc/ostree/remotes.d, so
|
|
|
fbcaed |
that it can be easily manipulated post-install.
|
|
|
fbcaed |
|
|
|
fbcaed |
To do that unfortunately is a complex dance.
|
|
|
fbcaed |
---
|
|
|
fbcaed |
pyanaconda/packaging/rpmostreepayload.py | 34 +++++++++++++++++++++++++-------
|
|
|
fbcaed |
1 file changed, 27 insertions(+), 7 deletions(-)
|
|
|
fbcaed |
|
|
|
fbcaed |
diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
index bf8d7e1..b5ee16b 100644
|
|
|
fbcaed |
--- a/pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
+++ b/pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
@@ -140,16 +140,17 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
fbcaed |
|
|
|
fbcaed |
repo_arg = "--repo=" + iutil.getTargetPhysicalRoot() + '/ostree/repo'
|
|
|
fbcaed |
|
|
|
fbcaed |
- # Set up the chosen remote
|
|
|
fbcaed |
- remote_args = [repo_arg, "remote", "add"]
|
|
|
fbcaed |
+ # Store this for use in postInstall too, where we need to
|
|
|
fbcaed |
+ # undo/redo this step.
|
|
|
fbcaed |
+ self._base_remote_args = ["remote", "add"]
|
|
|
fbcaed |
if ((hasattr(ostreesetup, 'noGpg') and ostreesetup.noGpg) or
|
|
|
fbcaed |
(hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg)):
|
|
|
fbcaed |
- remote_args.append("--set=gpg-verify=false")
|
|
|
fbcaed |
- remote_args.extend([ostreesetup.remote,
|
|
|
fbcaed |
- ostreesetup.url])
|
|
|
fbcaed |
- self._safeExecWithRedirect("ostree", remote_args)
|
|
|
fbcaed |
+ self._base_remote_args.append("--set=gpg-verify=false")
|
|
|
fbcaed |
+ self._base_remote_args.extend([ostreesetup.remote,
|
|
|
fbcaed |
+ ostreesetup.url])
|
|
|
fbcaed |
+ self._safeExecWithRedirect("ostree", [repo_arg] + self._base_remote_args)
|
|
|
fbcaed |
|
|
|
fbcaed |
- sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
|
|
|
fbcaed |
+ self._sysroot_path = sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
|
|
|
fbcaed |
sysroot = OSTree.Sysroot.new(sysroot_path)
|
|
|
fbcaed |
sysroot.load(cancellable)
|
|
|
fbcaed |
|
|
|
fbcaed |
@@ -250,6 +251,24 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
fbcaed |
def postInstall(self):
|
|
|
fbcaed |
super(RPMOSTreePayload, self).postInstall()
|
|
|
fbcaed |
|
|
|
fbcaed |
+ from gi.repository import OSTree
|
|
|
fbcaed |
+ cancellable = None
|
|
|
fbcaed |
+
|
|
|
fbcaed |
+ # Reload this data - we couldn't keep it open across
|
|
|
fbcaed |
+ # the remounts happening.
|
|
|
fbcaed |
+ sysroot = OSTree.Sysroot.new(self._sysroot_path)
|
|
|
fbcaed |
+ sysroot.load(cancellable)
|
|
|
fbcaed |
+ repo = sysroot.get_repo(None)[1]
|
|
|
fbcaed |
+
|
|
|
fbcaed |
+ # This is an ugly hack - we didn't have /etc/ostree/remotes.d,
|
|
|
fbcaed |
+ # so the remote went into /ostree/repo/config. But we want it
|
|
|
fbcaed |
+ # in /etc, so delete that remote, then re-add it to
|
|
|
fbcaed |
+ # /etc/ostree/remotes.d, executing ostree inside the sysroot
|
|
|
fbcaed |
+ # so that it understands it's a "system repository" and should
|
|
|
fbcaed |
+ # modify /etc.
|
|
|
fbcaed |
+ repo.remote_delete(self.data.ostreesetup.remote, None)
|
|
|
fbcaed |
+ self._safeExecWithRedirect("ostree", self._base_remote_args, root=iutil.getSysroot())
|
|
|
fbcaed |
+
|
|
|
fbcaed |
boot = iutil.getSysroot() + '/boot'
|
|
|
fbcaed |
|
|
|
fbcaed |
# If we're using extlinux, rename extlinux.conf to
|
|
|
fbcaed |
@@ -276,6 +295,7 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
fbcaed |
os.rename(orig_grub_cfg, target_grub_cfg)
|
|
|
fbcaed |
os.symlink('../loader/grub.cfg', orig_grub_cfg)
|
|
|
fbcaed |
|
|
|
fbcaed |
+
|
|
|
fbcaed |
# OSTree owns the bootloader configuration, so here we give it
|
|
|
fbcaed |
# the argument list we computed from storage, architecture and
|
|
|
fbcaed |
# such.
|
|
|
fbcaed |
--
|
|
|
fbcaed |
1.8.3.1
|
|
|
fbcaed |
|