Skip to contentSkip to conversation

zfcpdump: Add install script for zfcpdump

PATCH Superseded Philipp Rudo 1 participant 1 message Jul 25, 2018 s390

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 zfcpdump: Add install script for zfcpdump

Since version 198 (Feb 2013) systemd contains kernel-install, a script managing kernel installs. This script allows execution of drop-in scripts for customization. Add such a drop-in script to s390-tools to handle the installation of zfcpdump kernels and simplify interactions between zfcpdump and zipl.

The script supports two installation modes. One recommended by the BootLoaderSpecs [1] to /boot/<machine-id>/<kernel-version> directories and one directly to /boot. In the second case files are renamed during installation to <original-name>-<kernel-version> to guarantee unique names.

Because the zfcpdump kernel is so special make the script stand-alone and prevent any other script from being executed (exit 77) when a zfcpdump is installed. Especially avoid functionality like creating an initrd (already provided by s390-tools) or creating a boot entry (the zfcpdump kernel should not be used for any other purpose than dumping).

The script requires systemd >= 203.

[1] https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/

---
 .gitignore                      |   1 +
 common.mak                      |   3 +-
 zfcpdump/10-zfcpdump.install.in | 114 ++++++++++++++++++++++++++++++++++++++++
 zfcpdump/Makefile               |  16 ++++--
 4 files changed, 130 insertions(+), 4 deletions(-)
 create mode 100755 zfcpdump/10-zfcpdump.install.in
.gitignore +1 -0
index 6741256b..31e51e87 100644
@@ -77,6 +77,7 @@ zdump/zgetdump
 zfcpdump/cpioinit
 zfcpdump/zfcpdump_part
 zfcpdump/zfcpdump-initrd
+zfcpdump/10-zfcpdump.install
 ziomon/ziomon_mgr
 ziomon/ziomon_util
 ziomon/ziomon_zfcpdd
common.mak +2 -1
index 986ff303..013b577b 100644
@@ -184,7 +184,8 @@ export INSTALLDIR BINDIR LIBDIR MANDIR OWNER GROUP
 # Special defines for zfcpdump
 ZFCPDUMP_IMAGE	= zfcpdump-image
 ZFCPDUMP_INITRD	= zfcpdump-initrd
-export ZFCPDUMP_DIR ZFCPDUMP_IMAGE ZFCPDUMP_INITRD
+ZFCPDUMP_FLAVOR	= zfcpdump
+export ZFCPDUMP_DIR ZFCPDUMP_IMAGE ZFCPDUMP_INITRD ZFCPDUMP_FLAVOR
 
 CFLAGS		?= $(DEFAULT_CFLAGS) $(OPT_FLAGS)
 HOSTCFLAGS	?= $(DEFAULT_CFLAGS) $(OPT_FLAGS)
zfcpdump/10-zfcpdump.install.in new file +114 -0

114 lines not on this page · raw message

zfcpdump/Makefile +13 -3
index 1d9cce53..cb2fd419 100644
@@ -1,6 +1,7 @@
 include ../common.mak
 
 CPIOINIT  = $(call echocmd,"  CPIOINI ",/$@)./cpioinit
+INSTALL_SCRIPTS = 10-zfcpdump.install
 
 ifeq (${HAVE_LIBC_STATIC},0)
 
@@ -20,7 +21,7 @@ check_dep:
 		"HAVE_LIBC_STATIC=0", \
 		"-static")
 
-all: check_dep $(ZFCPDUMP_INITRD)
+all: check_dep $(ZFCPDUMP_INITRD) scripts
 
 cpioinit: cpioinit.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
@@ -34,12 +35,21 @@ $(ZFCPDUMP_INITRD): cpioinit zfcpdump_part
 	$(GZIP) -f [email protected]
 	$(MV) [email protected] $(ZFCPDUMP_INITRD)
 
+scripts: $(INSTALL_SCRIPTS)
+	chmod +x $(INSTALL_SCRIPTS)
+
 install: all
 	$(INSTALL) -m 611 $(ZFCPDUMP_INITRD) $(DESTDIR)$(ZFCPDUMP_DIR)
 
+%: %.in
+	zfcpdump_image=$(ZFCPDUMP_DIR)/$(ZFCPDUMP_IMAGE);	\
+	$(SED)	-e "s#@zfcpdump_image@#$$zfcpdump_image#g"	\
+		-e "s#@flavor@#$(ZFCPDUMP_FLAVOR)#g"		\
+	< $< > $@
 endif
 
 clean:
-	rm -f *.o *.gz *.tmp *~ zfcpdump_part cpioinit $(ZFCPDUMP_INITRD)
+	rm -f *.o *.gz *.tmp *~ zfcpdump_part cpioinit $(ZFCPDUMP_INITRD) \
+		$(INSTALL_SCRIPTS)
 
-.PHONY: all clean install check_dep
+.PHONY: all clean install check_dep scripts
Signature · 1 line
2.16.4