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)
This commit is contained in:
parent
97a4d27fb5
commit
741260d281
@ -1,15 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
commit=0
|
||||||
|
|
||||||
if [ -z "$(uci -q get uhttpd.main.ubus_prefix)" ]; then
|
if [ -z "$(uci -q get uhttpd.main.ubus_prefix)" ]; then
|
||||||
uci set uhttpd.main.ubus_prefix=/ubus
|
uci set uhttpd.main.ubus_prefix=/ubus
|
||||||
uci commit uhttpd
|
commit=1
|
||||||
/etc/init.d/uhttpd reload
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$(uci -q get uhttpd.main.ubus_socket)" = "/var/run/ubus.sock" ] && {
|
[ "$(uci -q get uhttpd.main.ubus_socket)" = "/var/run/ubus.sock" ] && {
|
||||||
uci set uhttpd.main.ubus_socket='/var/run/ubus/ubus.sock'
|
uci set uhttpd.main.ubus_socket='/var/run/ubus/ubus.sock'
|
||||||
uci commit uhttpd
|
commit=1
|
||||||
/etc/init.d/uhttpd reload
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ "$commit" = 1 ] && uci commit uhttpd && /etc/init.d/uhttpd reload
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user