From ae66baa80b57f42df9ea4ba6c18e270b28337f43 Mon Sep 17 00:00:00 2001 From: Andrei Gherzan <andrei.gherzan@huawei.com> Date: Mon, 2 Aug 2021 17:27:51 +0100 Subject: [PATCH] ohos-image.bbclass: Revert dropbear hostkey dir configuration When read-only rootfs is enabled - it is enabled default for the reference images - the core bbclass rootfs-postcommands.bbclass configures dropbear to use a volatile location (a tmpfs location) for the hostkey because the default location, /etc/dropbear is read-only. With the advent of writables.bbclass, the OS now provides the default path /etc/dropbear as a writable (a persistent location bind-mounted from the sysdata partition). This makes now /etc/dropbear both read-write and also persistent over reboots. This change reverts the rootfs-postcommands.bbclass dropbear configuration to use a volatile location as opposed to the default one (/etc/dropbear). Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> --- meta-ohos-core/classes/ohos-image.bbclass | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meta-ohos-core/classes/ohos-image.bbclass b/meta-ohos-core/classes/ohos-image.bbclass index b6211fd2..7d46446a 100644 --- a/meta-ohos-core/classes/ohos-image.bbclass +++ b/meta-ohos-core/classes/ohos-image.bbclass @@ -15,7 +15,12 @@ systemd_mask_getty () { fi } -IMAGE_PREPROCESS_COMMAND_append = " ${@ 'systemd_mask_getty;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''}" +# read_only_rootfs_hook +revert_volatile_dropear_hostkeys () { + sed -i '/DROPBEAR_RSAKEY_DIR/d' ${IMAGE_ROOTFS}/etc/default/dropbear +} + +IMAGE_PREPROCESS_COMMAND_append = " ${@ 'systemd_mask_getty;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''} revert_volatile_dropear_hostkeys" IMAGE_FEATURES_append = " read-only-rootfs" -- GitLab