diff mbox series

[1/2] package/linux-tools: add support for installing init system files

Message ID 4637e6aca8a761c9d863c58635cd691f274a9432.1578081397.git.yann.morin.1998@free.fr
State Accepted
Headers show
Series [1/2] package/linux-tools: add support for installing init system files | expand

Commit Message

Yann E. MORIN Jan. 3, 2020, 7:57 p.m. UTC
From: Pascal de Bruijn <p.debruijn@unilogic.nl>

Some linux tools (e.g. the Microsoft HyperV convenience utilities) will
install programs tostart at boot time, so they need to be able to
install init files (systemd units, sysv init script, or openrc units).

Unlike the other commands, we are redefining the real _INSTALL_INIT_*
macros, rather than use hooks, to let the infra call those at the right
moment.

We must be careful about the openrc support, though: if two tools are
enabled, one which provides sysv scripts but no openrc config, and the
other which provides openrc config, and we are using openrc as init
system, then we want to use the sysv scripts from the former as well as
the openrc config of the latter. Thus we need to duplicate a bit the
openrc logic here.

Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
[yann.morin.1998@free.fr:
  - define macros, not hooks
  - introduce support for openrc too
  - expand commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/linux-tools/linux-tools.mk | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Thomas Petazzoni Jan. 4, 2020, 3:19 p.m. UTC | #1
On Fri,  3 Jan 2020 20:57:04 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> From: Pascal de Bruijn <p.debruijn@unilogic.nl>
> 
> Some linux tools (e.g. the Microsoft HyperV convenience utilities) will
> install programs tostart at boot time, so they need to be able to
> install init files (systemd units, sysv init script, or openrc units).
> 
> Unlike the other commands, we are redefining the real _INSTALL_INIT_*
> macros, rather than use hooks, to let the infra call those at the right
> moment.
> 
> We must be careful about the openrc support, though: if two tools are
> enabled, one which provides sysv scripts but no openrc config, and the
> other which provides openrc config, and we are using openrc as init
> system, then we want to use the sysv scripts from the former as well as
> the openrc config of the latter. Thus we need to duplicate a bit the
> openrc logic here.
> 
> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> [yann.morin.1998@free.fr:
>   - define macros, not hooks
>   - introduce support for openrc too
>   - expand commit log
> ]
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>  package/linux-tools/linux-tools.mk | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/package/linux-tools/linux-tools.mk b/package/linux-tools/linux-tools.mk
index ac4da59b17..65d9e850e0 100644
--- a/package/linux-tools/linux-tools.mk
+++ b/package/linux-tools/linux-tools.mk
@@ -42,4 +42,26 @@  LINUX_TOOLS_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
 	$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
 		$(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))
 
+define LINUX_TOOLS_INSTALL_INIT_SYSTEMD
+	$(foreach tool,$(LINUX_TOOLS),\
+		$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+			$($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSTEMD))
+	)
+endef
+
+define LINUX_TOOLS_INSTALL_INIT_SYSV
+	$(foreach tool,$(LINUX_TOOLS),\
+		$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+			$($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV))
+	)
+endef
+
+define LINUX_TOOLS_INSTALL_INIT_OPENRC
+	$(foreach tool,$(LINUX_TOOLS),\
+		$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+			$(or $($(call UPPERCASE,$(tool))_INSTALL_INIT_OPENRC),\
+			     $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV)))
+	)
+endef
+
 $(eval $(generic-package))