From patchwork Tue Oct 18 19:43:04 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: 1691680 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::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 4MsPRk3Tddz23jp for ; Wed, 19 Oct 2022 06:43:30 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9BDA96111E; Tue, 18 Oct 2022 19:43:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9BDA96111E 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 j5DtehDFh4al; Tue, 18 Oct 2022 19:43:27 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 6A19F6111D; Tue, 18 Oct 2022 19:43:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6A19F6111D 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 D433C1BF95F for ; Tue, 18 Oct 2022 19:43:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B001B6111D for ; Tue, 18 Oct 2022 19:43:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B001B6111D 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 kIPz1TI0rKYR for ; Tue, 18 Oct 2022 19:43:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7891D61115 Received: from relais-inet.orange.com (relais-inet.orange.com [80.12.70.34]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7891D61115 for ; Tue, 18 Oct 2022 19:43:14 +0000 (UTC) Received: from opfednr02.francetelecom.fr (unknown [xx.xx.xx.66]) (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 opfednr23.francetelecom.fr (ESMTP service) with ESMTPS id 4MsPRN1yRbz5w04; Tue, 18 Oct 2022 21:43:12 +0200 (CEST) Received: by tl-lnx-nyma7486 (sSMTP sendmail emulation); Tue, 18 Oct 2022 21:43:09 +0200 From: To: Date: Tue, 18 Oct 2022 21:43:04 +0200 Message-ID: <18712_1666122192_634F01D0_18712_304_1_aadcab6f9e8f71b5581c8a15b2773a431bb29ca0.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: OPE16NORMBX302.corporate.adroot.infra.ftgroup (10.115.26.11) 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=1666122192; bh=PW1kWKnrFIsUp6e0BeGQOtY4EkD31TPZKHUfwI6otmk=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; b=HU8sMAlwganZbiHNBSbwl6gQWTAvzz/TI/hNUUBb3A2+9v1QISontDs9bIC0WvyeY 8uS7qq5gNgrVSJtQbe7Ru2h+OcQNt9/04mSWWWHzQNdCGfB9oFVUvbVrcIBsaTLI/E LTkK9hDrQSRiApcezzI3eZgVW4BbVdixMU0s/f44l1wX9YkeHpHm+bIlM2OWDDCkYO WcH4ZXY6YCpUWv/TRjoec1NBZX4u+5Lf1Hh2kWFl5s8GYmHJVDjCLJvav9Euug47/1 YhVCgkrQ5iylXjhV6OAax5088crffJ4C/bdZbdgN9ZWu5rDdLiApBClhs0BimXEPbX 7TovuU73BYRjw== 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=HU8sMAlw Subject: [Buildroot] [PATCH 1/6 v3] package/skeleton-systemd: move /var factory tmpfiles out of /etc 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: Norbert Lange , yann.morin@orange.com, =?utf-8?q?Je?= =?utf-8?q?=CC=81re=CC=81my_Rosen?= , Romain Naour , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" When the rootfs is not remounted read-write (thus assuming a read-only rootfs like squashfs), we create a tmpfiles.d factory for /var. However, we register those in /etc/tmpfiles.d/, but /etc could also be a tmpfs (for full state-less systems, or easy factory-reset, see [0]). So, we move our var factory to /usr/lib/tmpfiles.d/, which is also the location where systemd itself places its own tmpfiles, and where we already put all our other tmpfiles (see audit, avahi, cryptsetup, dhcp, lighttpd, nfs-utils, quagga, samba4, swupdate) and our handling of systemd's catalog files too. We also rename the file to a better name, so that it is obvious it is generated by us (systemd already installs a var.conf of its own, so we want to avoid name clashing). Last little detail: there is no need or reason to create .../tmpfiles.d/ at install time; it is only needed in the rootfs-pre-cmd hook, so we only create it just before we need it. [0] http://0pointer.de/blog/projects/stateless.html Signed-off-by: Yann E. MORIN Cc: Norbert Lange Cc: Romain Naour Cc: Jérémy Rosen [yann.morin.1998@free.fr: - split original patch in two - this one only moves out of /etc and into /usr/lib - adapt commit log accordingly ] Signed-off-by: Yann E. MORIN Acked-by: Norbert Lange --- package/skeleton-init-systemd/skeleton-init-systemd.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk index 795a171809..7b66732ef4 100644 --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk @@ -29,7 +29,6 @@ else # a real (but empty) directory, and the "factory files" will be copied # back there by the tmpfiles.d mechanism. define SKELETON_INIT_SYSTEMD_ROOT_RO_OR_RW - mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d echo "/dev/root / auto ro 0 1" >$(TARGET_DIR)/etc/fstab echo "tmpfs /var tmpfs mode=1777 0 0" >>$(TARGET_DIR)/etc/fstab endef @@ -38,6 +37,7 @@ define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR rm -rf $(TARGET_DIR)/usr/share/factory/var mv $(TARGET_DIR)/var $(TARGET_DIR)/usr/share/factory/var mkdir -p $(TARGET_DIR)/var + mkdir -p $(TARGET_DIR)/usr/lib/tmpfiles.d for i in $(TARGET_DIR)/usr/share/factory/var/* \ $(TARGET_DIR)/usr/share/factory/var/lib/* \ $(TARGET_DIR)/usr/share/factory/var/lib/systemd/*; do \ @@ -51,7 +51,7 @@ define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR printf "C! %s - - - -\n" "$${j}" \ || exit 1; \ fi; \ - done >$(TARGET_DIR)/etc/tmpfiles.d/var-factory.conf + done >$(TARGET_DIR)/usr/lib/tmpfiles.d/buildroot-factory.conf endef SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR