summaryrefslogtreecommitdiff
blob: cbd04a176c16772d99ec543be3473deb51724259 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dropbear/files/dropbear.init.d,v 1.1 2004/06/21 13:32:07 vapier Exp $

depend() {
	use logger dns
	need net
}

check_config() {
	if [ ! -e /etc/dropbear/ ] ; then
		mkdir /etc/dropbear/
	fi
	if [ ! -e /etc/dropbear/dropbear_dss_host_key ] ; then
		einfo "Generating DSS-Hostkey..."
		/usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
	fi
	if [ ! -e /etc/dropbear/dropbear_rsa_host_key ] ; then
		einfo "Generating RSA-Hostkey..."
		/usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
	fi
}

start() {
	check_config || return 1
	ebegin "Starting dropbear"
	/usr/sbin/dropbear ${DROPBEAR_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping dropbear"
	start-stop-daemon --stop --pidfile /var/run/dropbear.pid
	eend $?
}