summaryrefslogtreecommitdiff
path: root/net-misc/dropbear/files/dropbear.init.d
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-misc/dropbear/files/dropbear.init.d
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/dropbear/files/dropbear.init.d')
-rw-r--r--net-misc/dropbear/files/dropbear.init.d38
1 files changed, 38 insertions, 0 deletions
diff --git a/net-misc/dropbear/files/dropbear.init.d b/net-misc/dropbear/files/dropbear.init.d
new file mode 100644
index 000000000000..eaa3ae2919c2
--- /dev/null
+++ b/net-misc/dropbear/files/dropbear.init.d
@@ -0,0 +1,38 @@
+#!/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() {
+ mkdir -p /etc/dropbear
+
+ local t k
+ for t in dss rsa ecdsa; 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 $?
+}