-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path0027-dnfpayload-make-available-repos-for-post-scripts.patch
70 lines (61 loc) · 2.98 KB
/
0027-dnfpayload-make-available-repos-for-post-scripts.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 6bf4ecd55b3a1c241dfe6902e552216dfaca43b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
Date: Sun, 29 Jan 2023 14:10:19 +0100
Subject: [PATCH] dnfpayload: make available repos for post-scripts
This is used by kickstart post-scripts to copy templates and
kernel-latest from installation source, whatever that source was.
The repositories used for actual installation are in payload.sources not
payload.repositories (there is a bunch of comments it's a temporary
solution, but it is this way right now).
---
pyanaconda/modules/payloads/payload/dnf/dnf.py | 1 +
.../modules/payloads/payload/dnf/installation.py | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/modules/payloads/payload/dnf/dnf.py b/pyanaconda/modules/payloads/payload/dnf/dnf.py
index cdfcf997ec..238dfdcf4f 100644
--- a/pyanaconda/modules/payloads/payload/dnf/dnf.py
+++ b/pyanaconda/modules/payloads/payload/dnf/dnf.py
@@ -464,6 +464,7 @@ class DNFModule(PayloadBase):
sysroot=conf.target.system_root,
dnf_manager=self.dnf_manager,
repositories=self.repositories,
+ sources=self.sources,
),
ImportRPMKeysTask(
sysroot=conf.target.system_root,
diff --git a/pyanaconda/modules/payloads/payload/dnf/installation.py b/pyanaconda/modules/payloads/payload/dnf/installation.py
index d5722fd768..a4648ad37a 100644
--- a/pyanaconda/modules/payloads/payload/dnf/installation.py
+++ b/pyanaconda/modules/payloads/payload/dnf/installation.py
@@ -252,7 +252,7 @@ class InstallPackagesTask(Task):
class WriteRepositoriesTask(Task):
"""The installation task for writing repositories on the target system."""
- def __init__(self, sysroot, dnf_manager, repositories):
+ def __init__(self, sysroot, dnf_manager, repositories, sources):
"""Create a new task.
:param str sysroot: a path to the system root
@@ -263,6 +263,7 @@ class WriteRepositoriesTask(Task):
self._sysroot = sysroot
self._dnf_manager = dnf_manager
self._repositories = repositories
+ self._sources = sources
@property
def name(self):
@@ -279,6 +280,16 @@ class WriteRepositoriesTask(Task):
content = self._dnf_manager.generate_repo_file(repo)
self._write_repo_file(repo.name, content)
+ for source in self._sources:
+ repo = source.repository
+ if not repo.name:
+ repo.name = "default"
+ log.info("Writing %s.repo to the installer.repo.", repo.name)
+ content = self._dnf_manager.generate_repo_file(repo)
+ make_directories("/tmp/installer.repos.d")
+ with open(f"/tmp/installer.repos.d/{repo.name}.repo", "w") as f:
+ f.write(content.strip() + "\n")
+
def _can_write_repo(self, repo):
"""Can we write the specified repository to the target system?
--
2.45.2