fb0bca49693ad90caa859400c542f4b30ad14b89
[openwrt-10.03/.git] / package / dropbear / files / S50dropbear
1 #!/bin/sh
2
3 # Make sure the dropbearkey progam exists
4 [ -f /usr/bin/dropbearkey ] || exit 0
5
6 # Check for the Dropbear RSA key
7 if [ ! -f /etc/dropbear/dropbear_rsa_host_key ] ; then
8         (
9                 echo Generating RSA Key...
10                 mkdir -p /etc/dropbear
11                 /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
12                 [ -f /etc/dropbear/dropbear_rsa_host_key ] && exec $0 $*
13         ) > /dev/null 2> /dev/null &
14         exit 0
15 fi
16
17 # Check for the Dropbear DSS key
18 if [ ! -f /etc/dropbear/dropbear_dss_host_key ] ; then
19         (
20                 echo Generating DSS Key...
21                 mkdir -p /etc/dropbear
22                 /usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
23                 [ -f /etc/dropbear/dropbear_dss_host_key ] && exec $0 $*
24         ) > /dev/null 2> /dev/null &
25         exit 0
26 fi
27
28 umask 077
29
30 /usr/sbin/dropbear
31