let ipkg fail when a package file to be installed is not found
[openwrt/staging/wigyori.git] / openwrt / package / pptp / files / ifup.pptp
1 #!/bin/sh
2 [ $# = 0 ] && { echo " $0 <group>"; exit; }
3 . /etc/config/network
4 type=$1
5
6 eval "proto=\"\${${type}_proto}\""
7 [ "$proto" = "pptp" ] || {
8 echo "$0: ${type}_proto isn't pptp"
9 exit
10 }
11
12 mkdir -p /var/lock
13
14 for module in slhc ppp_generic ppp_async ip_gre; do
15 /sbin/insmod $module 2>&- >&-
16 done
17
18 KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5}
19 case "$ppp_demand" in
20 on|1|enabled)
21 DEMAND=${ppp_idletime:+demand idle $ppp_idletime}
22 [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
23 ;;
24 *) DEMAND="persist";;
25 esac
26 MTU=${ppp_mtu:-1452}
27
28 [ "$pptp_proto" = "static" ] || pptp_proto="dhcp"
29 do_ifup $pptp_proto $type
30
31 /usr/sbin/pppd \
32 pty "/usr/sbin/pptp $pptp_server_ip --loglevel 0 --nolaunchpppd" \
33 file /etc/ppp/options.pptp \
34 connect /bin/true \
35 usepeerdns \
36 defaultroute \
37 replacedefaultroute \
38 linkname "$type" \
39 ipparam "$type" \
40 user "$ppp_username" \
41 password "$ppp_passwd" \
42 mtu $MTU mru $MTU \
43 $DEMAND \
44 $KEEPALIVE
45