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

Submitted by Adrian Schmutzler on Jan. 7, 2020, 11:58 a.m.

Details

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

Commit Message

Adrian Schmutzler Jan. 7, 2020, 11:58 a.m.
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>

---

Changes in v2:
- just a resend with extended commit message
---
 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 24bdb951..3f16fded 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 4439ecfc..8af02361 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

Comments

Christian Dresel Jan. 7, 2020, 12:55 p.m.
Hi Adrian

ich finde die Idee gut simple-tc in ein eigenes packages auszulagern da
gehörts mMn auch hin. Für den Code angucken ist es mir gerade zeitlich
zu knapp aber ein

Acked-by: Christian Dresel <fff@chrisi01.de>

von mir schonmal.

Gruß

Christian

On 07.01.20 12:58, Adrian Schmutzler wrote:
> 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>
> 
> ---
> 
> Changes in v2:
> - just a resend with extended commit message
> ---
>  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
> 
> 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 24bdb951..3f16fded 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 4439ecfc..8af02361 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
>