[PATCH v2 05/10] fff-config: Split uci-defaults script into early and late part

Christian Dresel fff at chrisi01.de
Mo Apr 22 09:44:47 CEST 2019


hi

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

Sachen inline die ich gerne noch geklärt haben möchte bevor ich ein
Review drauf werfe:

On 14.04.19 01:25, Adrian Schmutzler wrote:
> So far, the 98-configure-fff script did both the setup of the
> /etc/config/fff file (if it is was not there) and the application
> of settings from it.
>
> In this script, the setup part is moved to a much earlier stage,
> so /etc/config/fff is initialized when we need it in other scripts.
>
> While at it, remove error suppression for uci set commands and
> refine uci commit entries.
>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>
> ---
>
> Changes in v2:
> - Removed ui.portsetup: Should be added in subsequent patch
> - Change package release number
> ---
>  src/packages/fff/fff-config/Makefile                |  3 +--
>  .../fff-config/files/etc/uci-defaults/10-setup-fff  | 14 ++++++++++++++
>  .../files/etc/uci-defaults/98-configure-fff         | 21 +++++++++------------
>  3 files changed, 24 insertions(+), 14 deletions(-)
>  create mode 100644 src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
>
> diff --git a/src/packages/fff/fff-config/Makefile b/src/packages/fff/fff-config/Makefile
> index 89bdc93d..0ea4a798 100644
> --- a/src/packages/fff/fff-config/Makefile
> +++ b/src/packages/fff/fff-config/Makefile
> @@ -1,8 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-config
> -PKG_VERSION:=1
> -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/10-setup-fff b/src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
> new file mode 100644
> index 00000000..3014f50d
> --- /dev/null
> +++ b/src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +# Copyright 2017 Adrian Schmutzler
> +# License GPLv3
> +
> +# Set default values in /etc/config/fff
> +
> +touch /etc/config/fff
> +
> +if ! uci -q get fff.system > /dev/null ; then
> +	uci set fff.system=fff
> +	uci set "fff.system.hostname=FFF"
> +fi
> +
> +uci commit fff
> 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..4d1748d4 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
> @@ -2,27 +2,24 @@
>  # Copyright 2017 Adrian Schmutzler
>  # License GPLv3
>  
> -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"
> -fi
> +# Apply configuration
>  
>  FFF_hostname=$(uci -q get "fff.system.hostname")
> -test -n "${FFF_hostname}" && uci -q set "system. at system[0].hostname=${FFF_hostname}"
> +test -n "${FFF_hostname}" && uci set "system. at system[0].hostname=${FFF_hostname}"
>  test -n "${FFF_hostname}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
>  
> +uci commit system


hier fehlt ziemlich sicher reload_config ->
root at Testfritz:/rom/etc/uci-defaults# uci set
"system. at system[0].hostname=fritz2"
root at Testfritz:/rom/etc/uci-defaults# uci commit system
root at Testfritz:/rom/etc/uci-defaults#
root at Testfritz:/rom/etc/uci-defaults# reload_config
root at Testfritz:/rom/etc/uci-defaults#
root at fritz2:/rom/etc/uci-defaults#


> +
>  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}"
> +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 -q commit
> +uci commit simple-tc

hier vielleicht auch? Ich nutzte kein simple-tc daher keine Ahnung

Gruß

Christian

>  
>  poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
>  if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then


Mehr Informationen über die Mailingliste franken-dev