summaryrefslogtreecommitdiff
path: root/dropbear
diff options
context:
space:
mode:
authorJuergen Daubert <jue@jue.li>2015-02-20 12:29:37 +0100
committerJuergen Daubert <jue@jue.li>2015-02-20 12:29:37 +0100
commit9bfec5c5744fd9755275103c9013577218d5ad0d (patch)
tree47a5e16edbc82b1014b854c641535a76f61831ac /dropbear
parent40233ac2f2f11cc9c62b78a5e2c55e4a3faad3c0 (diff)
downloadopt-9bfec5c5744fd9755275103c9013577218d5ad0d.tar.gz
opt-9bfec5c5744fd9755275103c9013577218d5ad0d.tar.xz
dropbear: improved rc script
Diffstat (limited to 'dropbear')
-rw-r--r--dropbear/.md5sum2
-rw-r--r--dropbear/Pkgfile2
-rw-r--r--dropbear/dropbear32
3 files changed, 26 insertions, 10 deletions
diff --git a/dropbear/.md5sum b/dropbear/.md5sum
index 4f93d8c13..9f39d2d51 100644
--- a/dropbear/.md5sum
+++ b/dropbear/.md5sum
@@ -1,2 +1,2 @@
-0de16660a2ab1bbacefa51e871ea7a6b dropbear
+513e13e2b2dd352dff0b58e6ae8bd586 dropbear
e967e320344cd4bfebe321e3ab8514d6 dropbear-2015.67.tar.bz2
diff --git a/dropbear/Pkgfile b/dropbear/Pkgfile
index 7f287a4e1..f7bc976a7 100644
--- a/dropbear/Pkgfile
+++ b/dropbear/Pkgfile
@@ -5,7 +5,7 @@
name=dropbear
version=2015.67
-release=1
+release=2
source=(http://matt.ucc.asn.au/$name/releases/$name-$version.tar.bz2 \
$name)
diff --git a/dropbear/dropbear b/dropbear/dropbear
index 118c49f59..c2a6c1744 100644
--- a/dropbear/dropbear
+++ b/dropbear/dropbear
@@ -3,6 +3,10 @@
# /etc/rc.d/dropbear: start/stop dropbear ssh daemon
#
+SSD=/sbin/start-stop-daemon
+PROG=/usr/sbin/dropbear
+PID=/var/run/dropbear.pid
+
CONV=/usr/bin/dropbearconvert
KEYG=/usr/bin/dropbearkey
@@ -10,8 +14,7 @@ RSA=/etc/dropbear/dropbear_rsa_host_key
DSS=/etc/dropbear/dropbear_dss_host_key
ECDSA=/etc/dropbear/dropbear_ecdsa_host_key
-case $1 in
-start)
+create_keys() {
if [ ! -f $RSA ]; then
if [ -f /etc/ssh/ssh_host_rsa_key ]; then
$CONV openssh dropbear /etc/ssh/ssh_host_rsa_key $RSA
@@ -23,28 +26,41 @@ start)
if [ -f /etc/ssh/ssh_host_dsa_key ]; then
$CONV openssh dropbear /etc/ssh/ssh_host_dsa_key $DSS
else
- $KEYG -t dss -f $DSS
+ $KEYG -t dss -f $DSS
fi
fi
if [ ! -f $ECDSA ]; then
if [ -f /etc/ssh/ssh_host_ecdsa_key ]; then
$CONV openssh dropbear /etc/ssh/ssh_host_ecdsa_key $ECDSA
else
- $KEYG -t ecdsa -s 521 -f $ECDSA
+ $KEYG -t ecdsa -s 521 -f $ECDSA
fi
fi
- /usr/sbin/dropbear
+}
+
+case $1 in
+start)
+ create_keys
+ $SSD --start --pidfile $PID --exec $PROG
;;
stop)
- killall -q /usr/sbin/dropbear
+ $SSD --stop --retry 10 --pidfile $PID
;;
restart)
$0 stop
- sleep 2
$0 start
;;
+status)
+ $SSD --status --pidfile $PID
+ case $? in
+ 0) echo "$PROG is running" ;;
+ 1) echo "$PROG is not running but the pid file $PID exists" ;;
+ 3) echo "$PROG is not running" ;;
+ 4) echo "Unable to determine the program status" ;;
+ esac
+ ;;
*)
- echo "usage: $0 [start|stop|restart]"
+ echo "usage: $0 [start|stop|restart|status]"
;;
esac

Generated by cgit