systemd: prepare the /etc overlay prior to launching systemd
systemd performs a bunch of critical tasks prior to loading any unit
files from disk, or running generators. Examples of this include the
/etc/machine-id setup (which we worked around by a bind mount some time
ago), or reading )and setting) the hostname configuration.
Rather than playing the whack-a-mole game over and over again by adding
just enough scripts to re-kick a given daemon/subsystem once a
particular /etc file becomes available, this change moves /etc setup
(which includes the overlay and the /cfg filesystem as well) into an
"initramfs" (without actually using a separate initramfs, of course).
Thanks to Mantas Mikulėnas (grawity on IRC) for suggesting this.
Change-Id: I9ec4d7f1243929ea498142d435ae6689c53b6097
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
index a94e2e0..98ca80c 100644
--- a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -13,23 +13,10 @@
endif
define CZECHLIGHT_CFG_FS_INSTALL_TARGET_CMDS
- $(INSTALL) -D -m 0644 \
- $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/etc-fstab \
- $(TARGET_DIR)/etc/fstab
- mkdir -p $(TARGET_DIR)/cfg
- mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/local-fs.target.wants/
- $(INSTALL) -D -m 0644 \
- $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/etc-overlay.service \
- $(TARGET_DIR)/usr/lib/systemd/system/etc-overlay.service
- ln -sf ../etc-overlay.service $(TARGET_DIR)/usr/lib/systemd/system/local-fs.target.wants/
- mkdir -p $(TARGET_DIR)/usr/lib/systemd/system-generators/
$(INSTALL) -D -m 0755 \
- $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/czechlight-cfg-mount-generator \
- $(TARGET_DIR)/usr/lib/systemd/system-generators/
- $(INSTALL) -D -m 0644 \
- $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/cfg-restore-etc.service \
- $(TARGET_DIR)/usr/lib/systemd/system/cfg-restore-etc.service
- ln -sf ../cfg-restore-etc.service $(TARGET_DIR)/usr/lib/systemd/system/local-fs.target.wants/
+ $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/init-czechlight.sh \
+ $(TARGET_DIR)/sbin/init-czechlight.sh
+ mkdir -p $(TARGET_DIR)/cfg
$(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_SYSREPO),y))
mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
$(INSTALL) -D -m 0644 \