lantiq: replace backticks by $(...) and remove useless echo
[oweals/openwrt.git] / target / linux / lantiq / base-files / etc / hotplug.d / dsl / pppoa.sh
1 #!/bin/sh
2
3 [ "$DSL_NOTIFICATION_TYPE" = "DSL_INTERFACE_STATUS" ] || exit 0
4
5 . /usr/share/libubox/jshn.sh
6 . /lib/functions.sh
7
8 include /lib/network
9 scan_interfaces
10
11 interfaces=$(ubus list network.interface.\* | cut -d"." -f3)
12 for ifc in $interfaces; do
13
14         json_load "$(ifstatus $ifc)"
15
16         json_get_var proto proto
17         if [ "$proto" != "pppoa" ]; then
18                 continue
19         fi
20
21         json_get_var up up
22         config_get_bool auto "$ifc" auto 1
23         if [ "$DSL_INTERFACE_STATUS" = "UP" ]; then
24                 if [ "$up" != 1 ] && [ "$auto" = 1 ]; then
25                         ( sleep 1; ifup "$ifc" ) &
26                 fi
27         else
28                 if [ "$up" = 1 ] && [ "$auto" = 1 ]; then
29                         ( sleep 1; ifdown "$ifc" ) &
30                 else
31                         json_get_var autostart autostart
32                         if [ "$up" != 1 ] && [ "$autostart" = 1 ]; then
33                                 ( sleep 1; ifdown "$ifc" ) &
34                         fi
35                 fi
36         fi
37 done