kdump-utils/0002-dracut-create-sub-directories-for-dracut-modules.patch
Philipp Rudo d38412baaf Enable erofs support for the kdump initrd
Resolves: RHEL-50942
Upstream: https://github.com/rhkdump/kdump-utils.git
Conflict: Dropped hunks concerning OVS bridge support in patch 3 and 5
	   due to missing 224d310 ("Support setting up Open vSwitch
	   (Ovs) Bridge network")

Also contains upstream commit

commit 2970176d9e9b7b6a1191a9ee54423d2f1c56fbaf
Author: Philipp Rudo <prudo@redhat.com>
Date:   Tue Sep 24 10:39:32 2024 +0200

    spec: fix patching of files in subdirectories

    With 23df04b ("dracut: create sub-directories for dracut modules") the
    dracut modules were moved to subdirectories. This causes problems when
    someone wants to include a patch to the spec file to change one of the
    files in those subdirectories. Reason is that '%autosetup' in the spec
    file calls 'patch' per default. 'patch' however, will strip all
    directories when it is called without option -p. Which means that it
    will search the file in the root directory and then fail because it
    cannot find it. Thus add option -p1 to '%autosetup' which will be passed
    on to 'patch'. Choose -p1 as that will work with the most common patch
    creation tools like git and packit.

    Signed-off-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2024-09-27 15:48:12 +02:00

188 lines
7.9 KiB
Diff

From c986a97b64060fdc0f5ae67fb822163a7fd5a884 Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Mon, 1 Jul 2024 15:06:15 +0200
Subject: [PATCH 02/16] dracut: create sub-directories for dracut modules
With the introduction of the Makefile it is now easy to move files into
different sub-directories. Thus create a sub-directory for each of the
dracut modules and move their files there. This not only cleans up the
main directory but also simplifies the Makefile and prevents bugs like
the one fixed in 5109f11 ("Makefile: Fix early-kdump file names").
One nice site effect by using 'cp' instead of 'install' is that file
permissions from the repo are preserved. So instead of manually setting
the file permissions for each call to 'install' we can now simply change
(and commit) the file permissions in the repo. Like it is done for
99kdumpbase/monitor_dd_progress.sh and 99zz-fadumpinit/module-setup.sh
in this commit.
Also adjust the .editorconfig to the new structure.
Signed-off-by: Philipp Rudo <prudo@redhat.com>
---
.editorconfig | 10 ----------
Makefile | 19 +++----------------
dracut/.editorconfig | 9 +++++++++
.../99earlykdump/early-kdump.sh | 0
.../99earlykdump/module-setup.sh | 0
dracut/99kdumpbase/.editorconfig | 3 +++
.../99kdumpbase/kdump-capture.service | 0
.../99kdumpbase/kdump-emergency.service | 0
.../99kdumpbase/kdump-emergency.target | 0
.../99kdumpbase/kdump.sh | 0
.../99kdumpbase/module-setup.sh | 0
.../99kdumpbase/monitor_dd_progress.sh | 0
dracut/99zz-fadumpinit/.editorconfig | 3 +++
.../99zz-fadumpinit/init-fadump.sh | 0
.../99zz-fadumpinit/module-setup.sh | 0
15 files changed, 18 insertions(+), 26 deletions(-)
create mode 100644 dracut/.editorconfig
rename dracut-early-kdump.sh => dracut/99earlykdump/early-kdump.sh (100%)
rename dracut-early-kdump-module-setup.sh => dracut/99earlykdump/module-setup.sh (100%)
create mode 100644 dracut/99kdumpbase/.editorconfig
rename dracut-kdump-capture.service => dracut/99kdumpbase/kdump-capture.service (100%)
rename dracut-kdump-emergency.service => dracut/99kdumpbase/kdump-emergency.service (100%)
rename dracut-kdump-emergency.target => dracut/99kdumpbase/kdump-emergency.target (100%)
rename dracut-kdump.sh => dracut/99kdumpbase/kdump.sh (100%)
rename dracut-module-setup.sh => dracut/99kdumpbase/module-setup.sh (100%)
rename dracut-monitor_dd_progress.sh => dracut/99kdumpbase/monitor_dd_progress.sh (100%)
mode change 100644 => 100755
create mode 100644 dracut/99zz-fadumpinit/.editorconfig
rename dracut-fadump-init-fadump.sh => dracut/99zz-fadumpinit/init-fadump.sh (100%)
rename dracut-fadump-module-setup.sh => dracut/99zz-fadumpinit/module-setup.sh (100%)
mode change 100644 => 100755
diff --git a/.editorconfig b/.editorconfig
index 98bc39a..dd58ec8 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -20,13 +20,3 @@ space_redirects = true
# Some scripts will only run with bash
[{mkfadumprd,mkdumprd,kdumpctl,kdump-lib.sh}]
shell_variant = bash
-
-# Use dracut code style for *-module-setup.sh
-[*-module-setup.sh,dracut-early-kdump.sh]
-shell_variant = bash
-indent_style = space
-indent_size = 4
-switch_case_indent = true
-function_next_line = false
-binary_next_line = true
-space_redirects = true
diff --git a/Makefile b/Makefile
index 538e4f4..5029a59 100644
--- a/Makefile
+++ b/Makefile
@@ -12,27 +12,14 @@ udevrulesdir ?= ${libdir}/udev/rules.d
systemdsystemunitdir ?= ${libdir}/systemd/system/
ARCH ?= $(shell uname -m)
dracutmoddir = $(DESTDIR)${libdir}/dracut/modules.d
-kdumpbasemoddir = $(dracutmoddir)/99kdumpbase
dracut-modules:
mkdir -p $(dracutmoddir)
- mkdir -p -m755 $(kdumpbasemoddir)
-
- install -m 755 dracut-kdump.sh $(kdumpbasemoddir)/kdump.sh
- install -m 755 dracut-module-setup.sh $(kdumpbasemoddir)/module-setup.sh
- install -m 755 dracut-monitor_dd_progress.sh $(kdumpbasemoddir)/monitor_dd_progress.sh
- install -m 644 dracut-kdump-emergency.service $(kdumpbasemoddir)/kdump-emergency.service
- install -m 644 dracut-kdump-capture.service $(kdumpbasemoddir)/kdump-capture.service
- install -m 644 dracut-kdump-emergency.target $(kdumpbasemoddir)/kdump-emergency.target
-
- mkdir -p -m755 $(dracutmoddir)/99earlykdump
- install -m 755 dracut-early-kdump.sh $(dracutmoddir)/99earlykdump/early-kdump.sh
- install -m 755 dracut-early-kdump-module-setup.sh $(dracutmoddir)/99earlykdump/module-setup.sh
+ cp -r dracut/99kdumpbase $(dracutmoddir)
+ cp -r dracut/99earlykdump $(dracutmoddir)
ifeq ($(ARCH), $(filter ppc64le ppc64,$(ARCH)))
- mkdir -p -m755 $(dracutmoddir)/99zz-fadumpinit
- install -m 755 dracut-fadump-init-fadump.sh $(dracutmoddir)/99zz-fadumpinit/init-fadump.sh
- install -m 755 dracut-fadump-module-setup.sh $(dracutmoddir)/99zz-fadumpinit/module-setup.sh
+ cp -r dracut/99zz-fadumpinit $(dracutmoddir)
endif
kdump-conf: gen-kdump-conf.sh
diff --git a/dracut/.editorconfig b/dracut/.editorconfig
new file mode 100644
index 0000000..254f870
--- /dev/null
+++ b/dracut/.editorconfig
@@ -0,0 +1,9 @@
+# Use dracut code style for dracut modules
+[*]
+shell_variant = bash
+indent_style = space
+indent_size = 4
+switch_case_indent = true
+function_next_line = false
+binary_next_line = true
+space_redirects = true
diff --git a/dracut-early-kdump.sh b/dracut/99earlykdump/early-kdump.sh
similarity index 100%
rename from dracut-early-kdump.sh
rename to dracut/99earlykdump/early-kdump.sh
diff --git a/dracut-early-kdump-module-setup.sh b/dracut/99earlykdump/module-setup.sh
similarity index 100%
rename from dracut-early-kdump-module-setup.sh
rename to dracut/99earlykdump/module-setup.sh
diff --git a/dracut/99kdumpbase/.editorconfig b/dracut/99kdumpbase/.editorconfig
new file mode 100644
index 0000000..feb7df2
--- /dev/null
+++ b/dracut/99kdumpbase/.editorconfig
@@ -0,0 +1,3 @@
+# These files run in the initrd and need to be posix compliant
+[{monitor_dd_progress.sh,kdump.sh}]
+shell_variant = posix
diff --git a/dracut-kdump-capture.service b/dracut/99kdumpbase/kdump-capture.service
similarity index 100%
rename from dracut-kdump-capture.service
rename to dracut/99kdumpbase/kdump-capture.service
diff --git a/dracut-kdump-emergency.service b/dracut/99kdumpbase/kdump-emergency.service
similarity index 100%
rename from dracut-kdump-emergency.service
rename to dracut/99kdumpbase/kdump-emergency.service
diff --git a/dracut-kdump-emergency.target b/dracut/99kdumpbase/kdump-emergency.target
similarity index 100%
rename from dracut-kdump-emergency.target
rename to dracut/99kdumpbase/kdump-emergency.target
diff --git a/dracut-kdump.sh b/dracut/99kdumpbase/kdump.sh
similarity index 100%
rename from dracut-kdump.sh
rename to dracut/99kdumpbase/kdump.sh
diff --git a/dracut-module-setup.sh b/dracut/99kdumpbase/module-setup.sh
similarity index 100%
rename from dracut-module-setup.sh
rename to dracut/99kdumpbase/module-setup.sh
diff --git a/dracut-monitor_dd_progress.sh b/dracut/99kdumpbase/monitor_dd_progress.sh
old mode 100644
new mode 100755
similarity index 100%
rename from dracut-monitor_dd_progress.sh
rename to dracut/99kdumpbase/monitor_dd_progress.sh
diff --git a/dracut/99zz-fadumpinit/.editorconfig b/dracut/99zz-fadumpinit/.editorconfig
new file mode 100644
index 0000000..fdcbad4
--- /dev/null
+++ b/dracut/99zz-fadumpinit/.editorconfig
@@ -0,0 +1,3 @@
+# These files run in the initrd and need to be posix compliant
+[{init-fadump.sh}]
+shell_variant = posix
diff --git a/dracut-fadump-init-fadump.sh b/dracut/99zz-fadumpinit/init-fadump.sh
similarity index 100%
rename from dracut-fadump-init-fadump.sh
rename to dracut/99zz-fadumpinit/init-fadump.sh
diff --git a/dracut-fadump-module-setup.sh b/dracut/99zz-fadumpinit/module-setup.sh
old mode 100644
new mode 100755
similarity index 100%
rename from dracut-fadump-module-setup.sh
rename to dracut/99zz-fadumpinit/module-setup.sh
--
2.46.1