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 include $(TOPDIR)/rules.mk
PKG_NAME:=fff-layer3-config PKG_NAME:=fff-layer3-config
PKG_RELEASE:=4 PKG_RELEASE:=5
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

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

View File

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

View File

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