From: Michael Glembotzki <[email protected]>

If DROPBEAR_RSAKEY_DIR has already been set before, e.g. by overwriting
the file dropbear.default, the line will still be appended a second time.

DROPBEAR_RSAKEY_DIR="/path/to/dropbear"
DROPBEAR_EXTRA_ARGS="-B"
DROPBEAR_RSAKEY_DIR=/var/lib/dropbear

(Backport of rev: 6045314d2968f6f5a0877a4dd45f35c766a40e40)

Signed-off-by: Michael Glembotzki <[email protected]>
Signed-off-by: Steve Sakoman <[email protected]>
---
 meta/classes/rootfs-postcommands.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/rootfs-postcommands.bbclass 
b/meta/classes/rootfs-postcommands.bbclass
index 5c0b3ec37c..f7517c66dc 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -119,7 +119,9 @@ read_only_rootfs_hook () {
                # Also tweak the key location for dropbear in the same way.
                if [ -d ${IMAGE_ROOTFS}/etc/dropbear ]; then
                        if [ ! -e 
${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ]; then
-                               echo "DROPBEAR_RSAKEY_DIR=/var/lib/dropbear" >> 
${IMAGE_ROOTFS}/etc/default/dropbear
+                               if ! grep -q "^DROPBEAR_RSAKEY_DIR=" 
${IMAGE_ROOTFS}/etc/default/dropbear ; then
+                                       echo 
"DROPBEAR_RSAKEY_DIR=/var/lib/dropbear" >> ${IMAGE_ROOTFS}/etc/default/dropbear
+                               fi
                        fi
                fi
        fi
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#198742): 
https://lists.openembedded.org/g/openembedded-core/message/198742
Mute This Topic: https://lists.openembedded.org/mt/105799734/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to