aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-03-20 13:26:20 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2021-03-21 22:39:32 +0100
commit741260d2816c8a989553a19685988cc906f43259 (patch)
treefb206780387c517261b3cdd01f3e3f43aa530341 /package/network
parent97a4d27fb5707d3a0b943f2af326b04d26f98731 (diff)
downloadupstream-741260d2816c8a989553a19685988cc906f43259.tar.gz
upstream-741260d2816c8a989553a19685988cc906f43259.tar.bz2
upstream-741260d2816c8a989553a19685988cc906f43259.zip
uhttpd: Execute uci commit and reload_config once
Instead of doing uci commit and reload_config for each setting do it only once when one of these options was changed. This should make it a little faster when both conditions are taken. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> (cherry picked from commit 501221af542b5154fbf8788f8426bc7f5443764a)
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/uhttpd/files/ubus.default10
1 files changed, 6 insertions, 4 deletions
diff --git a/package/network/services/uhttpd/files/ubus.default b/package/network/services/uhttpd/files/ubus.default
index b218d3f85d..474016c1c5 100644
--- a/package/network/services/uhttpd/files/ubus.default
+++ b/package/network/services/uhttpd/files/ubus.default
@@ -1,15 +1,17 @@
#!/bin/sh
+commit=0
+
if [ -z "$(uci -q get uhttpd.main.ubus_prefix)" ]; then
uci set uhttpd.main.ubus_prefix=/ubus
- uci commit uhttpd
- /etc/init.d/uhttpd reload
+ commit=1
fi
[ "$(uci -q get uhttpd.main.ubus_socket)" = "/var/run/ubus.sock" ] && {
uci set uhttpd.main.ubus_socket='/var/run/ubus/ubus.sock'
- uci commit uhttpd
- /etc/init.d/uhttpd reload
+ commit=1
}
+[ "$commit" = 1 ] && uci commit uhttpd && /etc/init.d/uhttpd reload
+
exit 0