Skip to content

Commit

Permalink
uhttpd: Execute uci commit and reload_config once
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
hauke committed Mar 21, 2021
1 parent d25d281 commit 501221a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions package/network/services/uhttpd/files/ubus.default
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 501221a

Please sign in to comment.