systemd: rework network/tty units installation
PATCH v3 1/1 systemd: rework network/tty units installation
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.
--- package/systemd/systemd.mk | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
package/systemd/systemd.mk +17 -18
@@ -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))
Signature · 1 line
1.9.3
PATCH v3 1/1 systemd: rework network/tty units installation
Quoted 5 lines · Eric Le Bihan
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 <[email protected]>
[snip]
Signature · 6 lines
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
Thomas Petazzoni
AppliedPATCH v3 1/1 systemd: rework network/tty units installation
In reply to Eric Le BihanDear Eric Le Bihan,
Quoted 8 lines · Eric Le Bihan
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 <[email protected]>--- package/systemd/systemd.mk | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
Applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v3 1/1 systemd: rework network/tty units installation
Quoted 7 lines · Thomas Petazzoni
Dear Eric Le Bihan,
Quoted 4 lines · Eric Le Bihan
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.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Eric Le Bihan <[email protected]>--- 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
PATCH v3 1/1 systemd: rework network/tty units installation
Dear Eric Le Bihan,
Quoted 9 lines · Eric Le Bihan
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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v3 1/1 systemd: rework network/tty units installation
Quoted 12 lines · Thomas Petazzoni
Dear Eric Le Bihan,
Quoted 8 lines · Eric Le Bihan
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...).
Quoted 6 lines
Quoted 1 line
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