packages/net/xl2tpd: netifd support
[openwrt/svn-archive/archive.git] / net / xl2tpd / files / xl2tpd.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006-2010 OpenWrt.org
3
4 START=60
5 BIN=xl2tpd
6 DEFAULT=/etc/default/$BIN
7 RUN_D=/var/run
8 PID_F=$RUN_D/$BIN.pid
9
10 start() {
11 # make sure kernel modules are loaded before starting xl2tpd, otherwise
12 # kernel-mode l2tp support won't work
13 local load
14 for module in slhc ppp_generic ppp_async pppox l2tp_core l2tp_netlink l2tp_ppp ; do
15 grep -q "$module" /proc/modules && continue
16 /sbin/insmod $module 2>&- >&-
17 load=1
18 done
19 [ "$load" = "1" ] && sleep 1
20
21 mkdir -p $RUN_D/$BIN
22 [ -f $DEFAULT ] && . $DEFAULT
23 $BIN $OPTIONS
24 }
25
26 stop() {
27 [ -f $PID_F ] && kill $(cat $PID_F)
28 }