Message ID | 20240422135552.83928-1-Michael.Glembotzki@iris-sensing.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [master,scarthgap] rootfs-postcommands.bbclass: Only set DROPBEAR_RSAKEY_DIR once | expand |
Incorrect mailing list. Please read poky/README.md Alex On Mon, 22 Apr 2024 at 15:56, Michael Glembotzki via lists.yoctoproject.org <m.glembo=gmail.com@lists.yoctoproject.org> wrote: > > 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 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13331): https://lists.yoctoproject.org/g/poky/message/13331 > Mute This Topic: https://lists.yoctoproject.org/mt/105669771/1686489 > Group Owner: poky+owner@lists.yoctoproject.org > Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
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
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(-)