All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation
@ 2014-06-23  9:52 Eric Le Bihan
  2014-06-23 16:41 ` Arnout Vandecappelle
  2014-06-29  8:55 ` Thomas Petazzoni
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-06-23  9:52 UTC (permalink / raw)
  To: buildroot

The installation of the network.service and serial-getty.service unit
files are now performed via the <pkg>_INIT_SYSTEMD mechanism instead of
an installation hook.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/systemd/systemd.mk | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index f3874db..95e7214 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -101,6 +101,13 @@ ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),y)
 SYSTEMD_CONF_OPT += --enable-networkd
 else
 SYSTEMD_CONF_OPT += --disable-networkd
+define SYSTEMD_INSTALL_SERVICE_NETWORK
+	$(INSTALL) -D -m 644 package/systemd/network.service \
+		$(TARGET_DIR)/etc/systemd/system/network.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -fs ../network.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/network.service
+endef
 endif
 
 ifeq ($(BR2_PACKAGE_SYSTEMD_TIMESYNCD),y)
@@ -131,11 +138,6 @@ define SYSTEMD_INSTALL_INIT_HOOK
 	ln -fs ../../../lib/systemd/system/multi-user.target $(TARGET_DIR)/etc/systemd/system/default.target
 endef
 
-define SYSTEMD_INSTALL_TTY_HOOK
-	rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
-	ln -fs ../../../../lib/systemd/system/serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service
-endef
-
 define SYSTEMD_INSTALL_MACHINEID_HOOK
 	touch $(TARGET_DIR)/etc/machine-id
 endef
@@ -145,28 +147,25 @@ define SYSTEMD_SANITIZE_PATH_IN_UNITS
 		-exec $(SED) 's,$(HOST_DIR),,g' {} \;
 endef
 
-define SYSTEMD_INSTALL_NETWORK_HOOK
-	$(INSTALL) -D -m 644 package/systemd/network.service \
-		$(TARGET_DIR)/etc/systemd/system/network.service
-	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
-	ln -fs ../network.service \
-		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/network.service
-endef
-
 SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
 	SYSTEMD_INSTALL_INIT_HOOK \
-	SYSTEMD_INSTALL_TTY_HOOK \
 	SYSTEMD_INSTALL_MACHINEID_HOOK \
 	SYSTEMD_SANITIZE_PATH_IN_UNITS
 
-ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),)
-SYSTEMD_POST_INSTALL_TARGET_HOOKS += SYSTEMD_INSTALL_NETWORK_HOOK
-endif
-
 define SYSTEMD_USERS
 	systemd-journal -1 systemd-journal -1 * /var/log/journal - - Journal
 	systemd-journal-gateway -1 systemd-journal-gateway -1 * /var/log/journal - - Journal Gateway
 	$(SYSTEMD_USER_TIMESYNC)
 endef
 
+define SYSTEMD_INSTALL_SERVICE_TTY
+	rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
+	ln -fs ../../../../lib/systemd/system/serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+endef
+
+define SYSTEMD_INSTALL_INIT_SYSTEMD
+	$(SYSTEMD_INSTALL_SERVICE_TTY)
+	$(SYSTEMD_INSTALL_SERVICE_NETWORK)
+endef
+
 $(eval $(autotools-package))
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation
  2014-06-23  9:52 [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation Eric Le Bihan
@ 2014-06-23 16:41 ` Arnout Vandecappelle
  2014-06-29  8:55 ` Thomas Petazzoni
  1 sibling, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2014-06-23 16:41 UTC (permalink / raw)
  To: buildroot

On 23/06/14 11:52, Eric Le Bihan wrote:
> The installation of the network.service and serial-getty.service unit
> files are now performed via the <pkg>_INIT_SYSTEMD mechanism instead of
> an installation hook.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

[snip]

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation
  2014-06-23  9:52 [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation Eric Le Bihan
  2014-06-23 16:41 ` Arnout Vandecappelle
@ 2014-06-29  8:55 ` Thomas Petazzoni
  2014-07-02 17:49   ` Eric Le Bihan
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2014-06-29  8:55 UTC (permalink / raw)
  To: buildroot

Dear Eric Le Bihan,

On Mon, 23 Jun 2014 11:52:06 +0200, Eric Le Bihan wrote:
> The installation of the network.service and serial-getty.service unit
> files are now performed via the <pkg>_INIT_SYSTEMD mechanism instead of
> an installation hook.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  package/systemd/systemd.mk | 35 +++++++++++++++++------------------
>  1 file changed, 17 insertions(+), 18 deletions(-)

Applied, thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation
  2014-06-29  8:55 ` Thomas Petazzoni
@ 2014-07-02 17:49   ` Eric Le Bihan
  2014-07-02 20:15     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Le Bihan @ 2014-07-02 17:49 UTC (permalink / raw)
  To: buildroot

On Sun, Jun 29, 2014 at 10:55:12AM +0200, Thomas Petazzoni wrote:
> Dear Eric Le Bihan,
>
> On Mon, 23 Jun 2014 11:52:06 +0200, Eric Le Bihan wrote:
> > The installation of the network.service and serial-getty.service unit
> > files are now performed via the <pkg>_INIT_SYSTEMD mechanism instead of
> > an installation hook.
> >
> > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> > ---
> >  package/systemd/systemd.mk | 35 +++++++++++++++++------------------
> >  1 file changed, 17 insertions(+), 18 deletions(-)
>
> Applied, thanks!
>

Looking back, converting the fixup of getty service from an post installation
hook to a service installation was not a good idea, after all.

$(PKG)_INSTALL_INIT_SYSTEMD is performed before installing the package itself
in the target directory via $(PKG)_INSTALL_TARGET_CMDS. So the fixup will fail
trying to delete a file that has not been installed yet... (D'Oh! I should
have cleaned my build directory...).

I will send a patch reverting this part.

Best regards,
ELB

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation
  2014-07-02 17:49   ` Eric Le Bihan
@ 2014-07-02 20:15     ` Thomas Petazzoni
  2014-07-02 22:31       ` Eric Le Bihan
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-02 20:15 UTC (permalink / raw)
  To: buildroot

Dear Eric Le Bihan,

On Wed, 2 Jul 2014 19:49:00 +0200, Eric Le Bihan wrote:

> Looking back, converting the fixup of getty service from an post installation
> hook to a service installation was not a good idea, after all.
> 
> $(PKG)_INSTALL_INIT_SYSTEMD is performed before installing the package itself
> in the target directory via $(PKG)_INSTALL_TARGET_CMDS. So the fixup will fail
> trying to delete a file that has not been installed yet... (D'Oh! I should
> have cleaned my build directory...).
> 
> I will send a patch reverting this part.

Hum, right, I don't know if a fixup of a file belongs to
<pkg>_INSTALL_INIT_SYSTEMD. But the fact that <pkg>_INSTALL_INIT_<foo>
gets executed *before* the package is installed to the target looks a
bit weird. Is there a reason for that?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation
  2014-07-02 20:15     ` Thomas Petazzoni
@ 2014-07-02 22:31       ` Eric Le Bihan
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Le Bihan @ 2014-07-02 22:31 UTC (permalink / raw)
  To: buildroot

On Wed, Jul 02, 2014 at 10:15:17PM +0200, Thomas Petazzoni wrote:
> Dear Eric Le Bihan,
>
> On Wed, 2 Jul 2014 19:49:00 +0200, Eric Le Bihan wrote:
>
> > Looking back, converting the fixup of getty service from an post installation
> > hook to a service installation was not a good idea, after all.
> >
> > $(PKG)_INSTALL_INIT_SYSTEMD is performed before installing the package itself
> > in the target directory via $(PKG)_INSTALL_TARGET_CMDS. So the fixup will fail
> > trying to delete a file that has not been installed yet... (D'Oh! I should
> > have cleaned my build directory...).
> >
> > I will send a patch reverting this part.
>
> Hum, right, I don't know if a fixup of a file belongs to
> <pkg>_INSTALL_INIT_SYSTEMD. But the fact that <pkg>_INSTALL_INIT_<foo>
> gets executed *before* the package is installed to the target looks a
> bit weird. Is there a reason for that?

From package/pkg-generic.mk at line 227:

	$(if $(BR2_INIT_SYSTEMD),\
		$($(PKG)_INSTALL_INIT_SYSTEMD))
	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
		$($(PKG)_INSTALL_INIT_SYSV))
	+$($(PKG)_INSTALL_TARGET_CMDS)
	$(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))

I see no harm in swapping these lines...

Best regards,
ELB

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-02 22:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23  9:52 [Buildroot] [Patch v3 1/1] systemd: rework network/tty units installation Eric Le Bihan
2014-06-23 16:41 ` Arnout Vandecappelle
2014-06-29  8:55 ` Thomas Petazzoni
2014-07-02 17:49   ` Eric Le Bihan
2014-07-02 20:15     ` Thomas Petazzoni
2014-07-02 22:31       ` Eric Le Bihan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.