lantiq: move common DSL setup into lantiq.sh
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 14 Jan 2020 20:45:43 +0000 (21:45 +0100)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 14 Jan 2020 21:04:37 +0000 (22:04 +0100)
DSL setup consists of the same commands for all subtargets, so move it
into a helper function.

While at it, remove shebang from library file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/lantiq/ase/base-files/etc/board.d/02_network
target/linux/lantiq/base-files/lib/functions/lantiq.sh
target/linux/lantiq/falcon/base-files/etc/board.d/02_network
target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
target/linux/lantiq/xway/base-files/etc/board.d/02_network
target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network

index d37e9992434f4acc4420fffe39c975a086af0eb5..2334d6c25b49ed2b242fbbf14e4eaf066b3a5109 100755 (executable)
@@ -32,16 +32,7 @@ netgear,dgn1000b)
        ;;
 esac
 
-ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
-       ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
-
-if lantiq_is_vdsl_system; then
-       ucidef_add_vdsl_modem "$annex" "av"
-else
-       ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
-fi
-
-ucidef_set_interface_wan "dsl0" "pppoe"
+lantiq_setup_dsl_helper "$annex"
 
 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
index 62c7a6b66267df7d8662a590a4d5f268399e9d4c..e88e638285a47c9baf335af25f04a00cb7677195 100644 (file)
@@ -1,5 +1,18 @@
-#!/bin/sh
-
 lantiq_is_vdsl_system() {
        grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo
 }
+
+lantiq_setup_dsl_helper() {
+       local annex="$1"
+
+       ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
+               ucidef_add_atm_bridge "1" "32" "llc" "bridged" "dsl"
+
+       if lantiq_is_vdsl_system; then
+               ucidef_add_vdsl_modem "$annex" "av"
+       else
+               ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
+       fi
+
+       ucidef_set_interface_wan "dsl0" "pppoe"
+}
index 76f134d6d415824720ba5a13bd7aca481c4c0eac..997f4c741f70eedb47da40551a8d14c092d147fc 100755 (executable)
@@ -16,16 +16,7 @@ wan_mac=""
 
 ucidef_set_interface_lan 'eth0'
 
-ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
-       ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
-
-if lantiq_is_vdsl_system; then
-       ucidef_add_vdsl_modem "$annex" "av"
-else
-       ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
-fi
-
-ucidef_set_interface_wan "dsl0" "pppoe"
+lantiq_setup_dsl_helper "$annex"
 
 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
index f56de3261433dfd8d54a0ec632ed911b6373a375..05e235b096665b2370ce89d033b77d02dc965704 100755 (executable)
@@ -123,16 +123,7 @@ zyxel,p-2812hnu-f3)
        ;;
 esac
 
-ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
-       ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
-
-if lantiq_is_vdsl_system; then
-       ucidef_add_vdsl_modem "$annex" "av"
-else
-       ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
-fi
-
-ucidef_set_interface_wan "dsl0" "pppoe"
+lantiq_setup_dsl_helper "$annex"
 
 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
index b1b742bd1f9d51a9eb498b99adc4de624332f15d..71d36696db3fce51ff52dcd672b11ca2ad441ce8 100755 (executable)
@@ -102,16 +102,7 @@ zyxel,p-2601hn)
        ;;
 esac
 
-ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
-       ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
-
-if lantiq_is_vdsl_system; then
-       ucidef_add_vdsl_modem "$annex" "av"
-else
-       ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
-fi
-
-ucidef_set_interface_wan "dsl0" "pppoe"
+lantiq_setup_dsl_helper "$annex"
 
 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
index 120857de4c142b212bd03b19a023e480dcc43169..2d5dbade62d9a5833ebeafb90d1006be45d92be2 100755 (executable)
@@ -32,16 +32,7 @@ arcadyan,arv452cqw)
        ;;
 esac
 
-ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
-       ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
-
-if lantiq_is_vdsl_system; then
-       ucidef_add_vdsl_modem "$annex" "av"
-else
-       ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
-fi
-
-ucidef_set_interface_wan "dsl0" "pppoe"
+lantiq_setup_dsl_helper "$annex"
 
 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"