[PATCH] fff-config: set up /etc/config/fff earlier and provide defaults

Christian Dresel fff at chrisi01.de
Fr Jan 10 12:14:08 CET 2020


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

Gruß

Christian

On 09.01.20 13:41, Adrian Schmutzler wrote:
> This adds a uci-defaults script with index 10 to set up the
> /etc/config/fff config file with default values early in the
> uci-defaults process, allowing to alter its values
> in subsequent scripts.
> 
> Providing default values will make adjustment of settings easier
> for users, as they do not have to look up the names of options.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  src/packages/fff/fff-config/Makefile               |  2 +-
>  .../fff-config/files/etc/uci-defaults/10-setup-fff | 14 ++++++++++++++
>  .../files/etc/uci-defaults/98-configure-fff        |  8 ++------
>  3 files changed, 17 insertions(+), 7 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 821cdda5..fb553264 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:=2
> +PKG_RELEASE:=3
>  
>  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 f71eadcd..07fea1c8 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,12 +2,7 @@
>  # 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}"
> @@ -15,6 +10,7 @@ test -n "${FFF_hostname}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
>  
>  uci commit system
>  
> +# run configuration scripts
>  poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
>  if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then
>  	/usr/lib/fff-support/activate_poe_passthrough.sh
> 

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 833 bytes
Beschreibung: OpenPGP digital signature
URL         : <https://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20200110/21a40c89/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev