fff-babel: Make implementation runtime switchable
Some users might want to prefer one babel implementation over another for various reasons. Having to compile the firmware from scratch can be quite tedious in that case. Instead, make the babel implementation switchable at runtime. The implementation can be switched manually using the uci option `babelimpl.impl.impl`, which currently is not upgrade-safe. Signed-off-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
4e7f394ba3
commit
9444aaa959
|
@ -12,7 +12,6 @@ define Package/fff-babel-bird2
|
|||
URL:=https://www.freifunk-franken.de
|
||||
DEPENDS:=+bird2 +bird2c +owipcalc
|
||||
PROVIDES:=fff-babel-implementation
|
||||
CONFLICTS:=fff-babeld
|
||||
endef
|
||||
|
||||
define Package/fff-babel-bird2/description
|
||||
|
|
|
@ -49,7 +49,7 @@ babel_remove_custom_redistribute_filters() {
|
|||
return 0
|
||||
}
|
||||
|
||||
babel_apply() {
|
||||
babel_apply_implementation() {
|
||||
# error output hidden because apply might be executed without a preceding configure step.
|
||||
if [ -d /tmp/bird/fff ]; then
|
||||
rm -rf /etc/bird/fff
|
||||
|
@ -59,7 +59,7 @@ babel_apply() {
|
|||
return 0
|
||||
}
|
||||
|
||||
babel_reload() {
|
||||
babel_reload_implementation() {
|
||||
/etc/init.d/fff-bird reload
|
||||
}
|
||||
|
|
@ -1,4 +1,8 @@
|
|||
. /lib/functions/fff/babeldaemon
|
||||
|
||||
implementation=$(uci -q get babelimpl.impl.impl)
|
||||
[ -z "$implementation" ] && implementation=babeld
|
||||
|
||||
. /lib/functions/fff/babeldaemon/$implementation
|
||||
|
||||
babel_add_iifrules() {
|
||||
[ "$#" -ne "1" ] && return 1
|
||||
|
@ -73,3 +77,40 @@ babel_add_peer6addr() {
|
|||
|
||||
return 0
|
||||
}
|
||||
|
||||
babel_reload() {
|
||||
# switch implementation temporarily
|
||||
case $implementation in
|
||||
bird2)
|
||||
/etc/init.d/babeld stop 2>/dev/null
|
||||
/etc/init.d/fff-bird start
|
||||
;;
|
||||
babeld)
|
||||
/etc/init.d/fff-bird stop 2>/dev/null
|
||||
/etc/init.d/babeld start
|
||||
;;
|
||||
esac
|
||||
|
||||
# call implementation-specific reload commands
|
||||
babel_reload_implementation
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
babel_apply() {
|
||||
# switch implementation persistently
|
||||
case $implementation in
|
||||
bird2)
|
||||
/etc/init.d/babeld disable
|
||||
/etc/init.d/fff-bird enable
|
||||
;;
|
||||
babeld)
|
||||
/etc/init.d/fff-bird disable
|
||||
/etc/init.d/babeld enable
|
||||
;;
|
||||
esac
|
||||
|
||||
babel_apply_implementation
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/etc/init.d/babeld disable
|
||||
|
||||
exit 0
|
|
@ -86,11 +86,11 @@ babel_remove_custom_redistribute_filters() {
|
|||
return 0
|
||||
}
|
||||
|
||||
babel_apply() {
|
||||
babel_apply_implementation() {
|
||||
uci commit babeld
|
||||
}
|
||||
|
||||
babel_reload() {
|
||||
babel_reload_implementation() {
|
||||
return 0
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ define Package/fff-layer3
|
|||
DEPENDS:=+fff-alfred-monitoring-proxy \
|
||||
+fff-babel \
|
||||
+fff-babeld \
|
||||
+fff-babel-bird2 \
|
||||
+fff-boardname \
|
||||
+fff-dhcp \
|
||||
+fff-layer3-config \
|
||||
|
|
Loading…
Reference in New Issue