[1/2] packages/fff: Add fff-simple-tc

Submitted by Adrian Schmutzler on July 26, 2019, 2:12 p.m.

Details

Message ID 20190726141208.4620-1-freifunk@adrianschmutzler.de
State New
Headers show

Commit Message

Adrian Schmutzler July 26, 2019, 2:12 p.m.
This new packages is meant to serve as meta-package to store
setup for simple-tc.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-config/Makefile          |  2 +-
 .../files/etc/uci-defaults/98-configure-fff   | 11 +-----
 src/packages/fff/fff-simple-tc/Makefile       | 38 +++++++++++++++++++
 .../files/etc/uci-defaults/98-configure-tc    | 12 ++++++
 src/packages/fff/fff-web/Makefile             |  2 +-
 src/packages/fff/fff/Makefile                 |  2 +-
 6 files changed, 54 insertions(+), 13 deletions(-)
 create mode 100644 src/packages/fff/fff-simple-tc/Makefile
 create mode 100644 src/packages/fff/fff-simple-tc/files/etc/uci-defaults/98-configure-tc

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-config/Makefile b/src/packages/fff/fff-config/Makefile
index 1b7af481..821cdda5 100644
--- a/src/packages/fff/fff-config/Makefile
+++ b/src/packages/fff/fff-config/Makefile
@@ -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)
 
diff --git a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
index aa6ac425..f71eadcd 100644
--- a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
+++ b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
@@ -13,16 +13,7 @@  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
diff --git a/src/packages/fff/fff-simple-tc/Makefile b/src/packages/fff/fff-simple-tc/Makefile
new file mode 100644
index 00000000..fc565f14
--- /dev/null
+++ b/src/packages/fff/fff-simple-tc/Makefile
@@ -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:=http://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)))
diff --git a/src/packages/fff/fff-simple-tc/files/etc/uci-defaults/98-configure-tc b/src/packages/fff/fff-simple-tc/files/etc/uci-defaults/98-configure-tc
new file mode 100644
index 00000000..b6389cac
--- /dev/null
+++ b/src/packages/fff/fff-simple-tc/files/etc/uci-defaults/98-configure-tc
@@ -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
diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile
index 6bdd9cd0..f701d50a 100644
--- a/src/packages/fff/fff-web/Makefile
+++ b/src/packages/fff/fff-web/Makefile
@@ -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
diff --git a/src/packages/fff/fff/Makefile b/src/packages/fff/fff/Makefile
index 8f5ffca8..46fd019c 100644
--- a/src/packages/fff/fff/Makefile
+++ b/src/packages/fff/fff/Makefile
@@ -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