From patchwork Thu Dec 10 13:35:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: fff-gateway: Add script to load vlan defaults From: Christian Dresel X-Patchwork-Id: 1445 Message-Id: <20201210133537.799039-1-freifunk@dresel.systems> To: franken-dev@freifunk.net Date: Thu, 10 Dec 2020 14:35:37 +0100 With this script a user can load easy a vlan default setting to /etc/config/gateway We use the same port configuration as the node firmware except the Batman-adv ports are use as Babel ports With this script it is easier to use the layer 3 firmware for user without knowledge for openwrt vlan settings Signed-off-by: Christian Dresel --- .../files/usr/sbin/loadvlandefault | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/packages/fff/fff-gateway/files/usr/sbin/loadvlandefault diff --git a/src/packages/fff/fff-gateway/files/usr/sbin/loadvlandefault b/src/packages/fff/fff-gateway/files/usr/sbin/loadvlandefault new file mode 100644 index 0000000..1c2f1a4 --- /dev/null +++ b/src/packages/fff/fff-gateway/files/usr/sbin/loadvlandefault @@ -0,0 +1,49 @@ +#!/bin/sh + +echo "This script might remove all existing vlans and babelpeers and load a default vlan setup." +read -r -p "Do you really want to continue? (y/n) " response +if ! ( [ "$response" == "y" ] || [ "$response" == "Y" ] ); then + exit 1 +fi + +# load uci functions +. /lib/functions.sh + +# load board specific properties +BOARD="$(uci get board.model.name)" +. /etc/network.$BOARD + +remove_vlan() { + local name="$1" + uci del gateway.$name +} +remove_babelpeer() { + local name="$1" + + # remove interface + uci -q del gateway.$name +} + +config_load gateway +config_foreach remove_vlan vlan + +config_load gateway +config_foreach remove_babelpeer babelpeer + +uci batch <