Make babel modular
Signed-off-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
7d7e0ae891
commit
f7e1ec318f
|
@ -0,0 +1,28 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=fff-babel
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/fff-babel
|
||||||
|
SECTION:=base
|
||||||
|
CATEGORY:=Freifunk
|
||||||
|
TITLE:=Freifunk-Franken babel
|
||||||
|
URL:=https://www.freifunk-franken.de
|
||||||
|
DEPENDS:=+fff-babel-implementation
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/fff-babel/description
|
||||||
|
This is the Freifunk Franken Firmware babel package.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
# nothing
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/fff-babel/install
|
||||||
|
$(CP) ./files/* $(1)/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,fff-babel))
|
|
@ -94,10 +94,14 @@ configure() {
|
||||||
|
|
||||||
apply() {
|
apply() {
|
||||||
uci commit network
|
uci commit network
|
||||||
uci commit babeld
|
babel_apply
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
babel_reload
|
||||||
}
|
}
|
||||||
|
|
||||||
revert() {
|
revert() {
|
||||||
uci revert network
|
uci revert network
|
||||||
uci revert babeld
|
babel_revert
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
. /lib/functions/fff/babeldaemon
|
||||||
|
|
||||||
babel_add_iifrules() {
|
babel_add_iifrules() {
|
||||||
[ "$#" -ne "1" ] && return 1
|
[ "$#" -ne "1" ] && return 1
|
||||||
|
|
||||||
|
@ -60,62 +62,3 @@ babel_add_peer6addr() {
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
babel_add_interface() {
|
|
||||||
[ "$#" -ne "4" ] && return 1
|
|
||||||
|
|
||||||
local name="$1"
|
|
||||||
local interface="$2"
|
|
||||||
local type="$3"
|
|
||||||
local rxcost="$4"
|
|
||||||
|
|
||||||
uci set babeld.$name=interface
|
|
||||||
uci set babeld.$name.ifname="$interface"
|
|
||||||
uci set babeld.$name.type="$type"
|
|
||||||
uci set babeld.$name.rxcost="$rxcost"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
babel_delete_interface() {
|
|
||||||
[ "$#" -ne "1" ] && return 1
|
|
||||||
|
|
||||||
local name="$1"
|
|
||||||
|
|
||||||
uci -q del babeld.$name
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
babel_add_redistribute_filter() {
|
|
||||||
[ "$#" -ne "1" ] && return 1
|
|
||||||
|
|
||||||
local prefix="$1"
|
|
||||||
|
|
||||||
config=$(uci add babeld filter)
|
|
||||||
uci set babeld.$config.type='redistribute'
|
|
||||||
uci set babeld.$config.ip="$prefix"
|
|
||||||
uci set babeld.$config.addedbyautoconfig='true'
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
babel_remove_custom_redistribute_filters() {
|
|
||||||
[ "$#" -ne "0" ] && return 1
|
|
||||||
|
|
||||||
remove_filters() {
|
|
||||||
local name="$1"
|
|
||||||
|
|
||||||
# check if filter was added by configuregateway
|
|
||||||
if ! [ "$(uci -q get babeld.$name.addedbyautoconfig)" = 'true' ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
uci -q del babeld.$name
|
|
||||||
}
|
|
||||||
|
|
||||||
config_load babeld
|
|
||||||
config_foreach remove_filters filter
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -11,6 +11,7 @@ define Package/fff-babeld
|
||||||
TITLE:=Freifunk-Franken babeld configuration example
|
TITLE:=Freifunk-Franken babeld configuration example
|
||||||
URL:=http://www.freifunk-franken.de
|
URL:=http://www.freifunk-franken.de
|
||||||
DEPENDS:=+babeld
|
DEPENDS:=+babeld
|
||||||
|
PROVIDES:=fff-babel-implementation
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/fff-babeld/description
|
define Package/fff-babeld/description
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
babel_add_interface() {
|
||||||
|
[ "$#" -ne "4" ] && return 1
|
||||||
|
|
||||||
|
local name="$1"
|
||||||
|
local interface="$2"
|
||||||
|
local type="$3"
|
||||||
|
local rxcost="$4"
|
||||||
|
|
||||||
|
uci set babeld.$name=interface
|
||||||
|
uci set babeld.$name.ifname="$interface"
|
||||||
|
uci set babeld.$name.type="$type"
|
||||||
|
uci set babeld.$name.rxcost="$rxcost"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
babel_delete_interface() {
|
||||||
|
[ "$#" -ne "1" ] && return 1
|
||||||
|
|
||||||
|
local name="$1"
|
||||||
|
|
||||||
|
uci -q del babeld.$name
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
babel_add_redistribute_filter() {
|
||||||
|
[ "$#" -ne "1" ] && return 1
|
||||||
|
|
||||||
|
local prefix="$1"
|
||||||
|
|
||||||
|
config=$(uci add babeld filter)
|
||||||
|
uci set babeld.$config.type='redistribute'
|
||||||
|
uci set babeld.$config.ip="$prefix"
|
||||||
|
uci set babeld.$config.addedbyautoconfig='true'
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
babel_remove_custom_redistribute_filters() {
|
||||||
|
[ "$#" -ne "0" ] && return 1
|
||||||
|
|
||||||
|
remove_filters() {
|
||||||
|
local name="$1"
|
||||||
|
|
||||||
|
# check if filter was added by configuregateway
|
||||||
|
if ! [ "$(uci -q get babeld.$name.addedbyautoconfig)" = 'true' ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
uci -q del babeld.$name
|
||||||
|
}
|
||||||
|
|
||||||
|
config_load babeld
|
||||||
|
config_foreach remove_filters filter
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
babel_apply() {
|
||||||
|
uci apply babeld
|
||||||
|
}
|
||||||
|
|
||||||
|
babel_reload() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
babel_revert() {
|
||||||
|
uci revert babeld
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ define Package/fff-layer3
|
||||||
TITLE:=Freifunk-Franken gateway configuration
|
TITLE:=Freifunk-Franken gateway configuration
|
||||||
URL:=https://www.freifunk-franken.de
|
URL:=https://www.freifunk-franken.de
|
||||||
DEPENDS:=+fff-alfred-monitoring-proxy \
|
DEPENDS:=+fff-alfred-monitoring-proxy \
|
||||||
+fff-babeld \
|
+fff-babel \
|
||||||
+fff-boardname \
|
+fff-boardname \
|
||||||
+fff-dhcp \
|
+fff-dhcp \
|
||||||
+fff-layer3-config \
|
+fff-layer3-config \
|
||||||
|
|
|
@ -13,7 +13,7 @@ define Package/fff-wireguard
|
||||||
DEPENDS:= \
|
DEPENDS:= \
|
||||||
+owipcalc \
|
+owipcalc \
|
||||||
+wireguard \
|
+wireguard \
|
||||||
+fff-babeld \
|
+fff-babel \
|
||||||
+fff-network
|
+fff-network
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -135,12 +135,16 @@ configure() {
|
||||||
|
|
||||||
apply() {
|
apply() {
|
||||||
uci commit network
|
uci commit network
|
||||||
uci commit babeld
|
|
||||||
uci commit gateway
|
uci commit gateway
|
||||||
|
babel_apply
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
babel_reload
|
||||||
}
|
}
|
||||||
|
|
||||||
revert() {
|
revert() {
|
||||||
uci revert network
|
uci revert network
|
||||||
uci revert babeld
|
|
||||||
uci revert gateway
|
uci revert gateway
|
||||||
|
babel_revert
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue