diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-01-14 21:45:43 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-01-14 22:04:37 +0100 |
commit | 18e089aaed58cb474c40b63da8562d7805f8b776 (patch) | |
tree | 71a7b579e1514f019cf0ce654b5542f6dde45dca | |
parent | 355f0444f3622347650776dd8f1e388dc5d000ca (diff) | |
download | upstream-18e089aaed58cb474c40b63da8562d7805f8b776.tar.gz upstream-18e089aaed58cb474c40b63da8562d7805f8b776.tar.bz2 upstream-18e089aaed58cb474c40b63da8562d7805f8b776.zip |
lantiq: move common DSL setup into lantiq.sh
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>
6 files changed, 20 insertions, 52 deletions
diff --git a/target/linux/lantiq/ase/base-files/etc/board.d/02_network b/target/linux/lantiq/ase/base-files/etc/board.d/02_network index d37e999243..2334d6c25b 100755 --- a/target/linux/lantiq/ase/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/ase/base-files/etc/board.d/02_network @@ -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" diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq.sh b/target/linux/lantiq/base-files/lib/functions/lantiq.sh index 62c7a6b662..e88e638285 100644 --- a/target/linux/lantiq/base-files/lib/functions/lantiq.sh +++ b/target/linux/lantiq/base-files/lib/functions/lantiq.sh @@ -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" +} diff --git a/target/linux/lantiq/falcon/base-files/etc/board.d/02_network b/target/linux/lantiq/falcon/base-files/etc/board.d/02_network index 76f134d6d4..997f4c741f 100755 --- a/target/linux/lantiq/falcon/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/falcon/base-files/etc/board.d/02_network @@ -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" diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index f56de32614..05e235b096 100755 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -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" diff --git a/target/linux/lantiq/xway/base-files/etc/board.d/02_network b/target/linux/lantiq/xway/base-files/etc/board.d/02_network index b1b742bd1f..71d36696db 100755 --- a/target/linux/lantiq/xway/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xway/base-files/etc/board.d/02_network @@ -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" diff --git a/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network index 120857de4c..2d5dbade62 100755 --- a/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network @@ -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" |