fff-network: wrap CPUPORT into a function

Instead of exposing the CPUPORT variable to the calling script
directly, wrap it into a function which can be called there.

Fixes: #52 (gitea)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Christian Dresel <freifunk@dresel.systems>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
This commit is contained in:
Adrian Schmutzler 2020-09-19 02:00:02 +02:00
parent cb4bce7cc2
commit 6ff350fcf9
4 changed files with 42 additions and 37 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-layer3-config
PKG_RELEASE:=4
PKG_RELEASE:=5
include $(INCLUDE_DIR)/package.mk

View File

@ -16,7 +16,7 @@ configure() {
uci set network.$name='switch_vlan'
uci set network.$name.device="$(uci get network.$SWITCHDEV.name)"
uci set network.$name.vlan="$vlan"
uci set network.$name.ports="$CPUPORT $ports"
uci set network.$name.ports="$(get_cpu_port) $ports"
}
remove_vlan() {

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-network
PKG_RELEASE:=30
PKG_RELEASE:=31
include $(INCLUDE_DIR)/package.mk

View File

@ -1,38 +1,43 @@
# Copyright 2019 Adrian Schmutzler
# License GPLv3
BOARD="$(uci get board.model.name)"
get_cpu_port() {
local BOARD=$(uci get board.model.name)
local CPUPORT
case "$BOARD" in
tplink,tl-wr1043nd-v1)
CPUPORT="5t"
;;
tplink,c50-v3|\
tplink,c50-v4|\
tplink,tl-wr1043nd-v2|\
tplink,tl-wr1043nd-v3|\
tl-wr841n-v13|\
r6220|\
ubnt-erx|\
ubnt-erx-sfp)
CPUPORT="6t"
;;
tplink,cpe210-v2|\
tplink,cpe210-v3|\
tplink,tl-mr3020-v1|\
tplink,tl-wa850re-v1|\
tplink,tl-wa860re-v1|\
tplink,tl-wa901nd-v2|\
ubnt,bullet-m|\
ubnt,nanostation-loco-m|\
ubnt,nanostation-loco-m-xw|\
ubnt,nanostation-m|\
ubnt,picostation-m|\
ubnt,unifi|\
ubnt,unifiac-mesh)
CPUPORT=""
;;
*)
CPUPORT="0t"
;;
esac
case "$BOARD" in
tplink,c50-v3|\
tplink,c50-v4|\
tplink,tl-wr1043nd-v2|\
tplink,tl-wr1043nd-v3|\
tl-wr841n-v13|\
r6220|\
ubnt-erx|\
ubnt-erx-sfp)
CPUPORT="6t"
;;
tplink,cpe210-v2|\
tplink,cpe210-v3|\
tplink,tl-mr3020-v1|\
tplink,tl-wa850re-v1|\
tplink,tl-wa860re-v1|\
tplink,tl-wa901nd-v2|\
ubnt,bullet-m|\
ubnt,nanostation-loco-m|\
ubnt,nanostation-loco-m-xw|\
ubnt,nanostation-m|\
ubnt,picostation-m|\
ubnt,unifi|\
ubnt,unifiac-mesh)
CPUPORT=""
;;
tplink,tl-wr1043nd-v1)
CPUPORT="5t"
;;
*)
CPUPORT="0t"
;;
esac
echo "$CPUPORT"
}