Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/skeleton-init-systemd: copy over etc-factory content
@ 2023-05-05  4:30 James Knight
  2023-10-01 10:38 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: James Knight @ 2023-05-05  4:30 UTC (permalink / raw)
  To: buildroot; +Cc: James Knight

The systemd package will prepare the folder `/usr/share/factory/etc/`,
which holds a series of default configuration files for a runtime
state [1]. For example, the etc-factory repository holds the default
template for `/etc/pam.d/system-auth` which is required in a default
environment configured to use systemd with SELinux. Without this file
prepared, login attempts will fail with the message:

    ... buildroot login[242]: PAM _pam_load_conf_file: unable to open config for system-auth
    ...

To avoid this, when preparing the initial skeleton structure for systemd
environments, copy over fallback configurations defined in etc-factory
into the target's `etc` folder. If a file is already prepared at this
state, these template files will be ignored.

[1]: https://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: James Knight <james.d.knight@live.com>
---
 package/skeleton-init-systemd/skeleton-init-systemd.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk
index fb15552f99eafcc90bc5fa9dfcee3ad465492b81..4076821c0c0429cf90681f4b16be114c44bde282 100644
--- a/package/skeleton-init-systemd/skeleton-init-systemd.mk
+++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk
@@ -68,6 +68,13 @@ SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFI
 endif  # BR2_INIT_SYSTEMD_POPULATE_TMPFILES
 
 define SKELETON_INIT_SYSTEMD_INSTALL_TARGET_CMDS
+	if [ -d $(TARGET_DIR)/usr/share/factory/etc ]; then \
+		rsync -av --ignore-existing --remove-source-files \
+			$(TARGET_DIR)/usr/share/factory/etc/ $(TARGET_DIR)/etc/; \
+		rm -rf $(TARGET_DIR)/usr/share/factory/etc/; \
+		rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/factory; \
+	fi
+
 	mkdir -p $(TARGET_DIR)/home
 	mkdir -p $(TARGET_DIR)/srv
 	mkdir -p $(TARGET_DIR)/var
-- 
2.40.1.windows.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-06-19 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-05  4:30 [Buildroot] [PATCH 1/2] package/skeleton-init-systemd: copy over etc-factory content James Knight
2023-10-01 10:38 ` Yann E. MORIN
2024-06-19 15:12   ` James Knight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox