source: freewrt/package/dropbear/files/dropbear.init@ 583d755

freewrt_1_0 freewrt_2_0
Last change on this file since 583d755 was 583d755, checked in by Thorsten Glaser <tg@…>, 19 years ago
  • change the SYSV init system to add a target "autostart"
  • on system startup, call autostart instead of start
  • on autostart, check /etc/rc.conf for whether the service is enabled and act appropriately; fall through into start target
  • move some pre-startup checks into the start target
  • some whitespace cleanup, when it makes much sense (XXX when I get the person who wrote these scripts...)
  • optimise dropbear a little

ok and approved wbx@

git-svn-id: svn://www.freewrt.org/trunk/freewrt@191 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100755
File size: 524 bytes
Line 
1#!/bin/sh
2
3. /etc/rc.conf
4
5case $1 in
6autostart)
7 test x"$ssh" = x"NO" && exit 0
8 # FALLTHROUGH
9start)
10 # check for keys
11 for type in rsa dss; do
12 key=/etc/dropbear/dropbear_${type}_host_key
13 [ -f $key ] || {
14 mkdir -p /etc/dropbear
15 [ -x /usr/bin/dropbearkey ] && {
16 /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && \
17 exec $0 $*; } &
18 exit 0
19 }
20 done
21 /usr/sbin/dropbear -w
22 ;;
23stop)
24 killall dropbear
25 ;;
26restart)
27 $0 stop
28 $0 start
29 ;;
30*)
31 echo "Usage: $0 {start | stop | restart}"
32 ;;
33esac
34exit 0
Note: See TracBrowser for help on using the repository browser.