packages/fff: Add fff-simple-tc

This new packages is meant to serve as meta-package to store
setup for simple-tc.

This achieves two objectives:
- Increase general maintainability by having relevant code in one
  location.
- Provide the option to include/exclude simple-tc functionality
  just by selecting/deselecting the fff-simple-tc package.

This will allow for easier testing of image size impact of this
functionality, too.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2019-07-26 15:56:12 +02:00
parent aa0d237fa9
commit 93cebbf3f7
6 changed files with 57 additions and 15 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-config
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -5,24 +5,16 @@
touch /etc/config/fff
if ! uci -q get fff.system > /dev/null ; then
uci -q set fff.system=fff
uci -q set "fff.system.hostname=FFF"
uci set fff.system=fff
uci set "fff.system.hostname=FFF"
uci commit fff
fi
FFF_hostname=$(uci -q get "fff.system.hostname")
test -n "${FFF_hostname}" && uci -q set "system.@system[0].hostname=${FFF_hostname}"
test -n "${FFF_hostname}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
traffic_enabled=$(uci -q get "fff.trafficcontrol.enabled")
traffic_in=$(uci -q get "fff.trafficcontrol.limit_in")
traffic_out=$(uci -q get "fff.trafficcontrol.limit_out")
test -n "${traffic_enabled}" && uci -q set "simple-tc.example.enabled=${traffic_enabled}"
uci -q set "simple-tc.example.ifname=wan"
uci -q set "simple-tc.example.limit_ingress=${traffic_in}"
uci -q set "simple-tc.example.limit_egress=${traffic_out}"
uci -q commit
uci commit system
poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then

View File

@ -0,0 +1,38 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-simple-tc
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=base
CATEGORY:=Freifunk
TITLE:=Freifunk-Franken simple-tc config
URL:=https://www.freifunk-franken.de
DEPENDS:=+simple-tc
endef
define Package/$(PKG_NAME)/description
This meta-package configures simple-tc for FFF
endef
define Build/Prepare
echo "all: " > $(PKG_BUILD_DIR)/Makefile
endef
define Build/Configure
# nothing
endef
define Build/Compile
# nothing
endef
define Package/$(PKG_NAME)/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -0,0 +1,12 @@
#!/bin/sh
traffic_enabled=$(uci -q get "fff.trafficcontrol.enabled")
traffic_in=$(uci -q get "fff.trafficcontrol.limit_in")
traffic_out=$(uci -q get "fff.trafficcontrol.limit_out")
test -n "${traffic_enabled}" && uci set "simple-tc.example.enabled=${traffic_enabled}"
uci set "simple-tc.example.ifname=wan"
uci set "simple-tc.example.limit_ingress=${traffic_in}"
uci set "simple-tc.example.limit_egress=${traffic_out}"
uci commit simple-tc

View File

@ -12,7 +12,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:= Freifunk-Franken Webinterface
URL:=http://www.freifunk-franken.de
DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc \
DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +fff-simple-tc \
+fff-boardname +fff-config +fff-network +fff-hoodutils \
+@BUSYBOX_CONFIG_WGET +@BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT
endef

View File

@ -24,7 +24,7 @@ define Package/fff-base
+fff-sysupgrade \
+fff-wireless \
+fff-timeserver \
+simple-tc
+fff-simple-tc
endef
define Package/fff-base/description