/cfg: Move setup scripts to the pkg directory
...so that everything is together, controlled via a single KConfig
option, and not split into an extra overlay directory.
Change-Id: I8922d236fb1c337fe46b9b2a07e0dceaae05a444
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/local-fs.target.wants/cfg-restore-etc.service b/board/czechlight/common/overlay/usr/lib/systemd/system/local-fs.target.wants/cfg-restore-etc.service
deleted file mode 120000
index 7ee72f5..0000000
--- a/board/czechlight/common/overlay/usr/lib/systemd/system/local-fs.target.wants/cfg-restore-etc.service
+++ /dev/null
@@ -1 +0,0 @@
-../cfg-restore-etc.service
\ No newline at end of file
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/local-fs.target.wants/etc-overlay.service b/board/czechlight/common/overlay/usr/lib/systemd/system/local-fs.target.wants/etc-overlay.service
deleted file mode 120000
index 081d54a..0000000
--- a/board/czechlight/common/overlay/usr/lib/systemd/system/local-fs.target.wants/etc-overlay.service
+++ /dev/null
@@ -1 +0,0 @@
-../etc-overlay.service
\ No newline at end of file
diff --git a/package/czechlight-cfg-fs/Config.in b/package/czechlight-cfg-fs/Config.in
index c3c5a46..d44d14a 100644
--- a/package/czechlight-cfg-fs/Config.in
+++ b/package/czechlight-cfg-fs/Config.in
@@ -1,7 +1,11 @@
config BR2_PACKAGE_CZECHLIGHT_CFG_FS
- bool "Prepare the /cfg partition"
+ bool "Prepare persistent /cfg partition and /etc overlay"
+ depends on BR2_INIT_SYSTEMD
help
- This is required for RAUC to work properly.
+ This is required for RAUC to work properly. It creates a blank FS
+ image, configures systemd to mount it, and ensures that its contents
+ get restored to /etc at boot. The /etc is set up as a RW overlay on
+ top of a read-only rootfs.
if BR2_PACKAGE_CZECHLIGHT_CFG_FS
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/cfg-restore-etc.service b/package/czechlight-cfg-fs/cfg-restore-etc.service
similarity index 100%
rename from board/czechlight/common/overlay/usr/lib/systemd/system/cfg-restore-etc.service
rename to package/czechlight-cfg-fs/cfg-restore-etc.service
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
index 2409b82..6798e68 100644
--- a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -1,4 +1,3 @@
-CZECHLIGHT_CFG_FS_INSTALL_TARGET = NO
CZECHLIGHT_CFG_FS_INSTALL_IMAGES = YES
CZECHLIGHT_CFG_FS_DEPENDENCIES = host-e2fsprogs
@@ -13,4 +12,18 @@
$(error CZECHLIGHT_CFG_FS_SIZE cannot be empty)
endif
+define CZECHLIGHT_CFG_FS_INSTALL_TARGET_CMDS
+ $(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/
+ $(INSTALL) -D -m 0755 \
+ $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/czechlight-cfg-mount-generator \
+ $(TARGET_DIR)/usr/lib/systemd/system-generators/czechlight-cfg-mount-generator
+ $(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/
+endef
+
$(eval $(generic-package))
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system-generators/czehlight-cfg-mount-generator b/package/czechlight-cfg-fs/czechlight-cfg-mount-generator
similarity index 100%
rename from board/czechlight/common/overlay/usr/lib/systemd/system-generators/czehlight-cfg-mount-generator
rename to package/czechlight-cfg-fs/czechlight-cfg-mount-generator
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/etc-overlay.service b/package/czechlight-cfg-fs/etc-overlay.service
similarity index 100%
rename from board/czechlight/common/overlay/usr/lib/systemd/system/etc-overlay.service
rename to package/czechlight-cfg-fs/etc-overlay.service