Delay SSH key copying after the sshd have finished generating them

Previously, we were getting this dependency "for free" because the
netopeer2-keystored package was blocking on sshd to start because it was
requsing sshd's keys for its own purposes.

Now that our keys are different (that change happened in the main
buildroot repo in our add-on branch), we no longer depended on sshd to
finish its key generation, and in turn this meant that the main sshd's
host keys were not being preserved in our /cfg:

  # ls -al /cfg/etc/ssh/
  total 8
  drwxr-xr-x    2 root     root          4096 Sep 12 18:37 .
  drwxr-xr-x    4 root     root          4096 Sep 13 18:39 ..
  -rw-------    1 root     root             0 Sep 12 18:37 ssh_host_rsa_key.NHsbsiTO7k

Fix this by waiting for sshd to finish starting up, and only copy the
SSH host keys afterwards.

Also split copying of OpenSSH's host keys from copying og
Netopeer2-server's host keys because these are conceptually unrelated.

Change-Id: Ic927ec2316595d1f0722e2aad097e0ae9ab60690
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
index 7153dbf..a94e2e0 100644
--- a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -40,6 +40,10 @@
 	$(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/openssh-persistent-keys.service \
+			$(TARGET_DIR)/usr/lib/systemd/system/
+		ln -sf ../openssh-persistent-keys.service $(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/
diff --git a/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service b/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service
index 76f620e..773f293 100644
--- a/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service
+++ b/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service
@@ -1,13 +1,12 @@
 [Unit]
-Description=Store SSH host keys into /cfg
-After=netopeer2-keystored-init-keys.service cfg.mount
-Requires=netopeer2-keystored-init-keys.service cfg.mount
+Description=Store NETCONF SSH host keys into /cfg
+After=cfg.mount netopeer2-keystored-init-keys.service
+Requires=cfg.mount netopeer2-keystored-init-keys.service
 ConditionPathExists=!/cfg/etc/keystored/keys
 
 [Service]
 Type=oneshot
-ExecStartPre=/bin/mkdir -p /cfg/etc/ssh
-ExecStart=/bin/sh -c 'cp -a /etc/ssh/ssh_host_*_key* /cfg/etc/ssh/'
+ExecStartPre=/bin/mkdir -p /cfg/etc
 ExecStart=/bin/cp -a /etc/keystored /cfg/etc/
 
 [Install]
diff --git a/package/czechlight-cfg-fs/openssh-persistent-keys.service b/package/czechlight-cfg-fs/openssh-persistent-keys.service
new file mode 100644
index 0000000..d75b616
--- /dev/null
+++ b/package/czechlight-cfg-fs/openssh-persistent-keys.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Store OpenSSH host keys into /cfg
+After=cfg.mount sshd.service
+Requires=cfg.mount sshd.service
+ConditionPathExists=!/cfg/etc/ssh/ssh_host_rsa_key
+
+[Service]
+Type=oneshot
+ExecStartPre=/bin/mkdir -p /cfg/etc/ssh
+ExecStart=/bin/sh -c 'cp -a /etc/ssh/ssh_host_*_key* /cfg/etc/ssh/'
+
+[Install]
+WantedBy=multi-user.target