From 501221af542b5154fbf8788f8426bc7f5443764a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 20 Mar 2021 13:26:20 +0100 Subject: [PATCH] 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 --- package/network/services/uhttpd/files/ubus.default | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package/network/services/uhttpd/files/ubus.default b/package/network/services/uhttpd/files/ubus.default index b218d3f85d1..474016c1c55 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 -- 2.30.2