[tools] add bc as required by kernels 3.9+
[openwrt.git] / package / kernel / lantiq / ltq-vdsl-app / files / dsl_notify.sh
1 #!/bin/sh
2 #
3 # This script is called by dsl_cpe_control whenever there is a DSL event,
4 # we only actually care about the DSL_INTERFACE_STATUS events as these
5 # tell us the line has either come up or gone down.
6 #
7 # The rest of the code is basically the same at the atm hotplug code
8 #
9
10 [ "$DSL_NOTIFICATION_TYPE" = "DSL_INTERFACE_STATUS" ] || exit 0
11
12 . /lib/functions.sh
13
14 include /lib/network
15 scan_interfaces
16
17 local found=0
18 local ifc
19 for ifc in $interfaces; do
20         local up
21         config_get_bool up "$ifc" up 0
22
23         local auto
24         config_get_bool auto "$ifc" auto 1
25
26         local proto
27         config_get proto "$ifc" proto
28
29         if [ "$DSL_INTERFACE_STATUS" = "UP" ]; then
30                 if [ "$proto" = "pppoa" ] && [ "$up" != 1 ] && [ "$auto" = 1 ]; then
31                         found=1
32                         ( sleep 1; ifup "$ifc" ) &
33                 fi
34         else
35                 if [ "$proto" = "pppoa" ] && [ "$up" = 1 ] && [ "$auto" = 1 ]; then
36                         found=1
37                         ( sleep 1; ifdown "$ifc" ) &
38                 fi
39         fi
40 done
41
42 if [ "$found" != 1 ]; then
43         logger "Found no matching interface for DSL notification ($DSL_INTERFACE_STATUS)"
44 fi