board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / dropbear / S50dropbear
blob9474eaafaaccbb259f3db5fc757df036adec1fe2
1 #!/bin/sh
3 # Starts dropbear sshd.
6 # Allow a few customizations from a config file
7 test -r /etc/default/dropbear && . /etc/default/dropbear
9 start() {
10 DROPBEAR_ARGS="$DROPBEAR_ARGS -R"
12 # If /etc/dropbear is a symlink to /var/run/dropbear, and
13 # - the filesystem is RO (i.e. we can not rm the symlink),
14 # create the directory pointed to by the symlink.
15 # - the filesystem is RW (i.e. we can rm the symlink),
16 # replace the symlink with an actual directory
17 if [ -L /etc/dropbear \
18 -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
19 then
20 if rm -f /etc/dropbear >/dev/null 2>&1; then
21 mkdir -p /etc/dropbear
22 else
23 echo "No persistent location to store SSH host keys. New keys will be"
24 echo "generated at each boot. Are you sure this is what you want to do?"
25 mkdir -p "$(readlink /etc/dropbear)"
29 printf "Starting dropbear sshd: "
30 umask 077
32 start-stop-daemon -S -q -p /var/run/dropbear.pid \
33 --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
34 [ $? = 0 ] && echo "OK" || echo "FAIL"
36 stop() {
37 printf "Stopping dropbear sshd: "
38 start-stop-daemon -K -q -p /var/run/dropbear.pid
39 [ $? = 0 ] && echo "OK" || echo "FAIL"
41 restart() {
42 stop
43 start
46 case "$1" in
47 start)
48 start
50 stop)
51 stop
53 restart|reload)
54 restart
57 echo "Usage: $0 {start|stop|restart}"
58 exit 1
59 esac
61 exit $?