fff-network: Commit only network

Submitted by Adrian Schmutzler on Nov. 23, 2017, 8:26 p.m.

Details

Message ID 1511468792-50044-1-git-send-email-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler Nov. 23, 2017, 8:26 p.m.
Since we change only the network part of uci, we only need to
commit this part and not the whole config five times.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index 8ff91b4..c84e3ba 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -118,7 +118,7 @@  if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
         uci set network.wan.ifname=$WANDEV
     fi
 
-    uci commit
+    uci commit network
 fi
 
 if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ) ; then
@@ -152,7 +152,7 @@  if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
         uci set network.ethmesh.ifname="$SWITCHDEV"
         ETH0MAC=1
     fi
-    uci commit
+    uci commit network
 fi
 
 /etc/init.d/network restart
@@ -166,7 +166,7 @@  if [[ -n "$ETHMESHMAC" ]]; then
         sleep 10
 
         uci set network.ethmesh.macaddr=$ETHMESHMAC
-        uci commit
+        uci commit network
 
         ifconfig $SWITCHDEV.3 down
         ifconfig $SWITCHDEV.3 hw ether $ETHMESHMAC
@@ -184,7 +184,7 @@  if [[ -n "$ROUTERMAC" ]]; then
         sleep 10
 
         uci set network.mesh.macaddr=$ROUTERMAC
-        uci commit
+        uci commit network
 
         ifconfig br-mesh down
         ifconfig br-mesh hw ether $ROUTERMAC
@@ -198,7 +198,7 @@  if [[ -n "$ETH0MAC" ]]; then
         sleep 10
         NEW_MACADDR=$(macFlipLocalBit "$ROUTERMAC")
         uci set network.eth0.macaddr=$NEW_MACADDR
-        uci commit
+        uci commit network
         ifconfig eth0 down
         ifconfig eth0 hw ether $NEW_MACADDR
         ifconfig eth0 up

Comments

Fabian Blaese Dec. 1, 2017, 9:46 a.m.
Müsste soweit passen.

Reviewed-by: Fabian Bläse <fabian@blaese.de>

Fabian

> On 23. Nov 2017, at 21:26, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote:
> 
> Since we change only the network part of uci, we only need to
> commit this part and not the whole config five times.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
> src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> index 8ff91b4..c84e3ba 100755
> --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> @@ -118,7 +118,7 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
>         uci set network.wan.ifname=$WANDEV
>     fi
> 
> -    uci commit
> +    uci commit network
> fi
> 
> if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ) ; then
> @@ -152,7 +152,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
>         uci set network.ethmesh.ifname="$SWITCHDEV"
>         ETH0MAC=1
>     fi
> -    uci commit
> +    uci commit network
> fi
> 
> /etc/init.d/network restart
> @@ -166,7 +166,7 @@ if [[ -n "$ETHMESHMAC" ]]; then
>         sleep 10
> 
>         uci set network.ethmesh.macaddr=$ETHMESHMAC
> -        uci commit
> +        uci commit network
> 
>         ifconfig $SWITCHDEV.3 down
>         ifconfig $SWITCHDEV.3 hw ether $ETHMESHMAC
> @@ -184,7 +184,7 @@ if [[ -n "$ROUTERMAC" ]]; then
>         sleep 10
> 
>         uci set network.mesh.macaddr=$ROUTERMAC
> -        uci commit
> +        uci commit network
> 
>         ifconfig br-mesh down
>         ifconfig br-mesh hw ether $ROUTERMAC
> @@ -198,7 +198,7 @@ if [[ -n "$ETH0MAC" ]]; then
>         sleep 10
>         NEW_MACADDR=$(macFlipLocalBit "$ROUTERMAC")
>         uci set network.eth0.macaddr=$NEW_MACADDR
> -        uci commit
> +        uci commit network
>         ifconfig eth0 down
>         ifconfig eth0 hw ether $NEW_MACADDR
>         ifconfig eth0 up
> --
> 2.7.4
> 
> --
> franken-dev mailing list
> franken-dev@freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Tim Niemeyer Dec. 23, 2017, 11:59 a.m.
Hi

Rebased und applied.

Tim

Am Donnerstag, den 23.11.2017, 21:26 +0100 schrieb Adrian Schmutzler:
> Since we change only the network part of uci, we only need to
> commit this part and not the whole config five times.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 10
> +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/packages/fff/fff-
> network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-
> network/files/usr/sbin/configurenetwork
> index 8ff91b4..c84e3ba 100755
> --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> @@ -118,7 +118,7 @@ if ! uci -q get network.$SWITCHDEV > /dev/null ||
> [ "$FORCEPARSE" = '1' ] ; then
>          uci set network.wan.ifname=$WANDEV
>      fi
>  
> -    uci commit
> +    uci commit network
>  fi
>  
>  if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get
> network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ) ; then
> @@ -152,7 +152,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get
> network.$SWITCHDEV.ifname || [ "$FO
>          uci set network.ethmesh.ifname="$SWITCHDEV"
>          ETH0MAC=1
>      fi
> -    uci commit
> +    uci commit network
>  fi
>  
>  /etc/init.d/network restart
> @@ -166,7 +166,7 @@ if [[ -n "$ETHMESHMAC" ]]; then
>          sleep 10
>  
>          uci set network.ethmesh.macaddr=$ETHMESHMAC
> -        uci commit
> +        uci commit network
>  
>          ifconfig $SWITCHDEV.3 down
>          ifconfig $SWITCHDEV.3 hw ether $ETHMESHMAC
> @@ -184,7 +184,7 @@ if [[ -n "$ROUTERMAC" ]]; then
>          sleep 10
>  
>          uci set network.mesh.macaddr=$ROUTERMAC
> -        uci commit
> +        uci commit network
>  
>          ifconfig br-mesh down
>          ifconfig br-mesh hw ether $ROUTERMAC
> @@ -198,7 +198,7 @@ if [[ -n "$ETH0MAC" ]]; then
>          sleep 10
>          NEW_MACADDR=$(macFlipLocalBit "$ROUTERMAC")
>          uci set network.eth0.macaddr=$NEW_MACADDR
> -        uci commit
> +        uci commit network
>          ifconfig eth0 down
>          ifconfig eth0 hw ether $NEW_MACADDR
>          ifconfig eth0 up
> -- 
> 2.7.4
>