openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [master][scarthgap][poky][PATCH] rootfs-postcommands.bbclass: Only set DROPBEAR_RSAKEY_DIR once
@ 2024-04-22 16:39 Michael Glembotzki
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Glembotzki @ 2024-04-22 16:39 UTC (permalink / raw)
  To: openembedded-core; +Cc: Michael Glembotzki

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

Signed-off-by: Michael Glembotzki <Michael.Glembotzki@iris-sensing.com>
---
 meta/classes-recipe/rootfs-postcommands.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass
index e81b69a239..920da94ba2 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -206,7 +206,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.44.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [master][scarthgap][poky][PATCH] rootfs-postcommands.bbclass: Only set DROPBEAR_RSAKEY_DIR once
       [not found] <20240422135552.83928-1-Michael.Glembotzki@iris-sensing.com>
@ 2024-04-22 14:46 ` Michael
  0 siblings, 0 replies; 2+ messages in thread
From: Michael @ 2024-04-22 14:46 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

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

Signed-off-by: Michael Glembotzki <Michael.Glembotzki@iris-sensing.com>
---
 meta/classes-recipe/rootfs-postcommands.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass
b/meta/classes-recipe/rootfs-postcommands.bbclass
index e81b69a239..920da94ba2 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -206,7 +206,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.44.0

[-- Attachment #2: Type: text/html, Size: 1898 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-22 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 16:39 [master][scarthgap][poky][PATCH] rootfs-postcommands.bbclass: Only set DROPBEAR_RSAKEY_DIR once Michael Glembotzki
     [not found] <20240422135552.83928-1-Michael.Glembotzki@iris-sensing.com>
2024-04-22 14:46 ` Michael

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).