uhttpd: Execute uci commit and reload_config once
[openwrt/openwrt.git] / package / network / services / uhttpd / files / ubus.default
index b218d3f85d11a94534b36878e23db892ca721689..474016c1c55705597e2558560d589c0f40d81e56 100644 (file)
@@ -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