batman-adv-legacy: move binaries, scripts and config to avoid conflicts

This renames batman-adv.ko to batman-adv-legacy.ko. And also moves
scripts to a "-legacy" variant to avoid build errors when both
batman-adv and batman-adv-legacy are selected. Finally, moves the
batman-adv-legacy config to /etc/config/batman-adv-legacy.

This allows to select and install the batman-adv mainline and
batman-adv-legacy simultaneously.
This commit is contained in:
Linus Lüssing 2019-07-27 06:32:51 +02:00
parent 3e3db36a2e
commit a382d21c6a
5 changed files with 19 additions and 14 deletions

View File

@ -26,7 +26,7 @@ define KernelPackage/batman-adv-legacy
SUBMENU:=Network Support
DEPENDS:=+kmod-lib-crc16 +kmod-crypto-crc32c +kmod-lib-crc32c +libc
TITLE:=B.A.T.M.A.N. Adv
FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
FILES:=$(PKG_BUILD_DIR)/batman-adv-legacy.$(LINUX_KMOD_SUFFIX)
endef
define KernelPackage/batman-adv-legacy/description
@ -58,12 +58,17 @@ define Build/Prepare
$(PKG_BUILD_DIR)/main.h
endef
define Build/Compile
$(call Build/Compile/Default,)
mv $(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) $(PKG_BUILD_DIR)/batman-adv-legacy.$(LINUX_KMOD_SUFFIX)
endef
define KernelPackage/batman-adv-legacy/install
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto
$(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
$(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv-legacy $(1)/usr/sbin $(1)/lib/netifd/proto
$(INSTALL_DATA) ./files/etc/config/batman-adv-legacy $(1)/etc/config
$(INSTALL_DATA) ./files/lib/batman-adv-legacy/config.sh $(1)/lib/batman-adv-legacy
$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv-legacy $(1)/etc/hotplug.d/net
$(INSTALL_BIN) ./files/lib/netifd/proto/batadv_legacy.sh $(1)/lib/netifd/proto
endef
$(eval $(call KernelPackage,batman-adv-legacy))

View File

@ -1,9 +1,9 @@
#!/bin/sh
. /lib/batman-adv/config.sh
. /lib/batman-adv-legacy/config.sh
bat_load_module
config_load batman-adv
config_load batman-adv-legacy
case "$ACTION" in
add)

View File

@ -5,7 +5,7 @@ bat_load_module()
[ -d "/sys/module/batman_adv/" ] && return
. /lib/functions.sh
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv*
load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-crypto* /etc/modules.d/*-lib-crc* /etc/modules.d/*-batman-adv-legacy*
}
bat_config()
@ -29,7 +29,7 @@ bat_config()
config_get orig_interval "$mesh" orig_interval
config_get vis_mode "$mesh" vis_mode
[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
[ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv-legacy mesh $mesh does not exist - check your interface configuration" && return 1
[ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
[ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation

View File

@ -4,12 +4,12 @@
. ../netifd-proto.sh
init_proto "$@"
proto_batadv_init_config() {
proto_batadv_legacy_init_config() {
proto_config_add_string "mesh"
proto_config_add_string "mesh_no_rebroadcast"
}
proto_batadv_setup() {
proto_batadv_legacy_setup() {
local config="$1"
local iface="$2"
@ -23,11 +23,11 @@ proto_batadv_setup() {
proto_send_update "$config"
}
proto_batadv_teardown() {
proto_batadv_legacy_teardown() {
local config="$1"
local iface="$2"
(echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface") 2>/dev/null
}
add_protocol batadv
add_protocol batadv_legacy