source: freewrt/package/fwwif/fwwif.init@ 9946423

Last change on this file since 9946423 was 9946423, checked in by Thorsten Glaser <tg@…>, 18 years ago

stopping didn't always reliably work, use killall tntnet

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

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#!/bin/mksh
2# The FreeWRT Webinterface – Initialisation script
3# Based in part on /etc/rc from MirOS BSD
4#-
5# Copyright © 2006, 2007
6# Thorsten Glaser <tg@mirbsd.de>
7#
8# Provided that these terms and disclaimer and all copyright notices
9# are retained or reproduced in an accompanying document, permission
10# is granted to deal in this work without restriction, including un-
11# limited rights to use, publicly perform, distribute, sell, modify,
12# merge, give away, or sublicence.
13#
14# Advertising materials mentioning features or use of this work must
15# display the following acknowledgement:
16# This product includes material provided by Thorsten Glaser.
17#
18# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
19# the utmost extent permitted by applicable law, neither express nor
20# implied; without malicious intent or gross negligence. In no event
21# may a licensor, author or contributor be held liable for indirect,
22# direct, other damage, loss, or other issues arising in any way out
23# of dealing in the work, even if advised of the possibility of such
24# damage or existence of a defect, except proven that it results out
25# of said person's immediate fault when using the work as intended.
26#-
27#FWINIT 89
28
29. /etc/rc.conf
30case $1 in
31autostart)
32 test x"$fwwif" = x"NO" && exit 0
33 exec mksh $0 start
34 ;;
35start)
36 mkdir -p /var/run
37 (cd /etc/fwwif; if test ! -e https.cer || test ! -e https.key; then
38 echo >&2 fwwif: generating SSL key/cert pair...
39 rm -f https.*
40 umask 077
41 if ! openssl genrsa -out https.key 1024; then
42 echo >&2 fwwif: key generation failed
43 rm -f https.key
44 exit 1
45 fi
46 chown 0:0 https.key; chmod 0400 https.key
47 umask 022
48 if ! openssl req -batch -new -subj "/CN=192.168.1.1/" \
49 -key https.key -x509 -out https.cer; then
50 echo >&2 fwwif: cert generation failed
51 rm -f https.cer
52 exit 1
53 fi
54 echo >&2 done
55 fi || :)
56 /usr/bin/tntnet -c /etc/fwwif/fwwif.conf
57 ;;
58autostop|stop)
59 trap '' HUP TERM KILL
60 killall tntnet
61 sleep 3
62 killall tntnet
63 sleep 3
64 ;;
65restart)
66 mksh $0 stop
67 mksh $0 start
68 ;;
69version)
70 /usr/ucb/what /usr/lib/fwwif/*.so
71 exit 0
72 ;;
73*)
74 echo "Usage: $0 {start | stop | restart | version}"
75 exit 1
76 ;;
77esac
78exit $?
Note: See TracBrowser for help on using the repository browser.