From patchwork Tue Oct 18 19:43:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1691682 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MsPSD04CXz23jp for ; Wed, 19 Oct 2022 06:43:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3319F41B3E; Tue, 18 Oct 2022 19:43:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3319F41B3E X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eweLRJn-6er5; Tue, 18 Oct 2022 19:43:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id D84F641A1D; Tue, 18 Oct 2022 19:43:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D84F641A1D X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id BB8531BF95F for ; Tue, 18 Oct 2022 19:43:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 978A16111B for ; Tue, 18 Oct 2022 19:43:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 978A16111B X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HOqcBJrn8zAL for ; Tue, 18 Oct 2022 19:43:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 82EAF61115 Received: from relais-inet.orange.com (relais-inet.orange.com [80.12.70.35]) by smtp3.osuosl.org (Postfix) with ESMTPS id 82EAF61115 for ; Tue, 18 Oct 2022 19:43:19 +0000 (UTC) Received: from opfednr03.francetelecom.fr (unknown [xx.xx.xx.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by opfednr24.francetelecom.fr (ESMTP service) with ESMTPS id 4MsPRT1kXCz1yJB; Tue, 18 Oct 2022 21:43:17 +0200 (CEST) Received: by tl-lnx-nyma7486 (sSMTP sendmail emulation); Tue, 18 Oct 2022 21:43:14 +0200 From: To: Date: Tue, 18 Oct 2022 21:43:06 +0200 Message-ID: <14736_1666122197_634F01D5_14736_488_1_88b7ddd5c7fe78927e68e2f29ea9c9e61e0a782f.1666122184.git.yann.morin@orange.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.115.26.52] X-ClientProxiedBy: OPE16NORMBX404.corporate.adroot.infra.ftgroup (10.115.26.17) To OPE16NORMBX305.corporate.adroot.infra.ftgroup (10.115.27.10) X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.com; s=ORANGE001; t=1666122197; bh=3pxAO5NMrC9V/jH48dkr78dvqOZgdrWnfiinnWMUXCA=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; b=LDXtGFrDGAVskx8tGHftii9wuEz6wvn7O2WX4Sux0AZBav7gMMTl7gO3fUb5Uc4wd 2OG82uY1xBCS9rEYzPDU7k6wOYoBrS+O1NN6ZmPtkCTcxK+GJghL8ZG8kWVdnLrBFq CRf7ktU2SHKxhLj5iNv0mMCwiVVfJvHyX212KanQJFT03S0+r1cAb2Nvplg0jO8Ny0 nV7W0i4F1dhmu2rkQ0UXksnIiIw6JjjMqPm1HeA4Oiuu+BPh84kyCYcDu76CJFyM7M ni8cmW4/g87iHRGhVdQQynIQGoOutuBOMN5oSLJojmCIfU52c6ch0wYBNMF+8QUxr9 YNfS0vyuEEvtw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=orange.com header.i=@orange.com header.a=rsa-sha256 header.s=ORANGE001 header.b=LDXtGFrD Subject: [Buildroot] [PATCH 3/6 v3] package/skeleton-systemd: host the tmpfiles preparation script X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Je=CC=81re=CC=81my_Rosen?= , Romain Naour , yann.morin@orange.com, Norbert Lange , "Yann E. MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" From: "Yann E. MORIN" Commit 0d9b84b7a83f (package/systemd: invoke systemd-tmpfilesd on final image) forcefully introduced a call to systemd-tmpfiles as a per-rootfs hook, on the premise that would help with read-only rootfs. However, that did not account for the then-pre-existing handling of /var as a factory when the user opted not to remount / read-write (by not setting BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW). This means that, for users who want to use a factory for /var, the generated filesystem contains the factory files twice: once as stored in the factory, and once as populated by systemd-tmpefilesd. In the hope to reconcile the two solutions, we move the handling of calling systemd-tmpfilesd to the skeleton-init-systemd package, where we already handle the /var factory. Having the two in the same package will make it easier, in the future, to provide the user with a choice whether to use one of the other. Note that it is very important to keep the order of the hooks as they are. Indeed, skeleton-init-systemd sorts before systemd, so its hooks were registered before systemd's hooks; now that we move the CREATE_TMPFILES hook, we must ensure it is called after the PRE_ROOTFS_VAR one, so that the behaviour of acting on the var factory remains. As a final note: we chose the move this way, rather than move the var factory into the systemd package, because it is more related to the system integration on the Buildroot side, rather than the integration of the systemd package in Buildroot. Similarly, the other four rootfs hooks, SYSTEMD_LOCALE_PURGE_CATALOGS, SYSTEMD_UPDATE_CATALOGS, SYSTEMD_RM_CATALOG_UPDATE_SERVICE, and specially SYSTEMD_PRESET_ALL, should also be moved out of the systemd package, because they too are more related to the Buildroot system, rather than to the systemd package itself; but the frontier is very porous is either way, for such a package as special as systemd. Signed-off-by: Yann E. MORIN Cc: Norbert Lange Cc: Arnout Vandecappelle (Essensium/Mind) Cc: Romain Naour Cc: Jérémy Rosen Cc: Yann E. MORIN Acked-by: Norbert Lange --- .../{systemd => skeleton-init-systemd}/fakeroot_tmpfiles.sh | 0 package/skeleton-init-systemd/skeleton-init-systemd.mk | 6 ++++++ package/systemd/systemd.mk | 6 ------ 3 files changed, 6 insertions(+), 6 deletions(-) rename package/{systemd => skeleton-init-systemd}/fakeroot_tmpfiles.sh (100%) diff --git a/package/systemd/fakeroot_tmpfiles.sh b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh similarity index 100% rename from package/systemd/fakeroot_tmpfiles.sh rename to package/skeleton-init-systemd/fakeroot_tmpfiles.sh diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk index 970951d553..89a28d1780 100644 --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk @@ -58,6 +58,12 @@ SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_PRE_ROOTFS_V endif +define SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK + HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \ + $(SKELETON_INIT_SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR) +endef +SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK + define SKELETON_INIT_SYSTEMD_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/home mkdir -p $(TARGET_DIR)/srv diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk index 1d7452de19..e4a8114221 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -739,12 +739,6 @@ define SYSTEMD_RM_CATALOG_UPDATE_SERVICE endef SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_RM_CATALOG_UPDATE_SERVICE -define SYSTEMD_CREATE_TMPFILES_HOOK - HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \ - $(SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR) -endef -SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_CREATE_TMPFILES_HOOK - define SYSTEMD_PRESET_ALL $(HOST_DIR)/bin/systemctl --root=$(TARGET_DIR) preset-all endef