kdump-anaconda-addon/make-it-possible-to-prevent-systemctl-invocation.patch
2021-08-07 10:31:04 +08:00

44 lines
1.7 KiB
Diff

From d411f7d635f999c2d67a0a0f4c64cd0db1252e9b Mon Sep 17 00:00:00 2001
From: Martin Kolman <mkolman@redhat.com>
Date: Wed, 25 Jul 2018 16:08:41 +0200
Subject: [PATCH] Make it possible to prevent systemctl invocation via
kickstart
There are cases such as creation of very minimal containers where
there might be no systemctl inside the installation chroot.
In such a case we need to assure that systemctl is not called
or else the installation will fail. Unfortunately at the moment
kdump will try to always call systemctl unless the whole addon
is marked as disabled in the boot options and it's not possible
to override this behavior via kickstart.
So change the logic a bit so that when %addon com_redhat_kdump --disable
is used in kickstart will have the same effect (systemctl will not be
called).
Resolves: rhbz#1608359
---
com_redhat_kdump/ks/kdump.py | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/com_redhat_kdump/ks/kdump.py b/com_redhat_kdump/ks/kdump.py
index 496c322..fa1bfee 100644
--- a/com_redhat_kdump/ks/kdump.py
+++ b/com_redhat_kdump/ks/kdump.py
@@ -137,12 +137,9 @@ def handle_header(self, lineno, args):
def execute(self, storage, ksdata, instClass, users, payload):
# the KdumpSpoke should run only if requested
- if not flags.cmdline.getbool("kdump_addon", default=False):
+ if not flags.cmdline.getbool("kdump_addon", default=False) or not self.enabled:
return
- if self.enabled:
- action = "enable"
- else:
- action = "disable"
+ action = "enable"
util.execWithRedirect("systemctl", [action, "kdump.service"], root=util.getSysroot())