Message ID | 20200109124124.1377-1-freifunk@adrianschmutzler.de |
---|---|
State | New |
Headers | show |
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.@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
Reviewed-by: Christian Dresel <fff@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@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.@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 >
Hi Adrian, der Patch applied bei mir nicht auf den aktuellen master: error: Anwendung des Patches fehlgeschlagen: src/packages/fff/fff-config/Makefile:1 error: Anwendung des Patches fehlgeschlagen: src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff:15 Viele Grüße Robert Am 09.01.20 um 13:41 schrieb Adrian Schmutzler: > 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@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.@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
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@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