commit:     5ebd6d3a2be67f8bd5375ae906cd1d2864973702
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 08:34:56 2025 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sun May 11 08:39:27 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ebd6d3a

net-misc/dropbear: skip default keys generation if `-r`

Closes: https://bugs.gentoo.org/947598
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 net-misc/dropbear/dropbear-2025.88-r1.ebuild |  2 +-
 net-misc/dropbear/files/dropbear.init.d-r1   | 41 ++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/net-misc/dropbear/dropbear-2025.88-r1.ebuild 
b/net-misc/dropbear/dropbear-2025.88-r1.ebuild
index 1037e27182e6..0771132cb62a 100644
--- a/net-misc/dropbear/dropbear-2025.88-r1.ebuild
+++ b/net-misc/dropbear/dropbear-2025.88-r1.ebuild
@@ -187,7 +187,7 @@ src_install() {
        set_options
        emake "${makeopts[@]}" PROGRAMS="${progs[*]}" DESTDIR="${D}" install
        doman manpages/*.8
-       newinitd "${FILESDIR}"/dropbear.init.d dropbear
+       newinitd "${FILESDIR}"/dropbear.init.d-r1 dropbear
        newconfd "${FILESDIR}"/dropbear.conf.d dropbear
        dodoc CHANGES README.md SMALL.md MULTI.md
 

diff --git a/net-misc/dropbear/files/dropbear.init.d-r1 
b/net-misc/dropbear/files/dropbear.init.d-r1
new file mode 100644
index 000000000000..25f7f259b12f
--- /dev/null
+++ b/net-misc/dropbear/files/dropbear.init.d-r1
@@ -0,0 +1,41 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+       use logger dns
+       need net
+}
+
+check_config() {
+       # bug #947598 - don't generate keys if DROPBEAR_OPTS contains option 
`-r`
+       echo "${DROPBEAR_OPTS}" | grep -E '(^-r)|(\s-r)' > /dev/null 2>&1 && 
return
+
+       mkdir -p /etc/dropbear
+
+       local t k
+       for t in rsa ecdsa ed25519; do
+               k="/etc/dropbear/dropbear_${t}_host_key"
+               if [ ! -e ${k} ] ; then
+                       # See if support is enabled for this key type.
+                       if dropbearkey -h 2>&1 | grep -q "      ${t}$" ; then
+                               einfo "Generating ${k} ..."
+                               dropbearkey -t ${t} -f ${k} >/dev/null
+                       fi
+               fi &
+       done
+       wait
+}
+
+start() {
+       check_config || return 1
+       ebegin "Starting dropbear"
+       dropbear ${DROPBEAR_OPTS}
+       eend $?
+}
+
+stop() {
+       ebegin "Stopping dropbear"
+       start-stop-daemon --stop --pidfile /var/run/dropbear.pid
+       eend $?
+}

Reply via email to