Copying keys into /cfg automatically
The idea here is to copy the SSH key material which gets generated
during the first boot into a persistent place. That way, one can update
the system freely, and the SSH keys for both OpenSSH and Netopeer2's
server/keystored will be preserved.
Change-Id: I094ab3142195ce4dd5e714b486962b2ec4925098
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
index f51b6ef..c774691 100644
--- a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -33,6 +33,13 @@
$(TARGET_DIR)/usr/lib/systemd/system/
ln -sf ../sysrepo-persistent-cfg.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
$(endif)
+ $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_KEYS),y))
+ mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
+ $(INSTALL) -D -m 0644 \
+ $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service \
+ $(TARGET_DIR)/usr/lib/systemd/system/
+ ln -sf ../netopeer2-keystored-persistent-keys.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
+ $(endif)
endef
$(eval $(generic-package))