Update mosquitto to 0.15
[openwrt/svn-archive/archive.git] / net / mosquitto / files / mosquitto.init
index b6ce6177ee4f4c0178f70790976f4ae87de7d2d3..aafa105acb9e1cce74c9475b799021d53415fc26 100755 (executable)
@@ -1,16 +1,27 @@
 #!/bin/sh /etc/rc.common
 # Basic init script for mosquitto
 # April 2012, OpenWrt.org
+# Provides support for the luci-app-mosquitto package, if installed
 
 START=80
 APP=`which mosquitto`
+USE_UCI_CONFIG=$(uci -q get mosquitto.owrt.use_uci)
+if [ $? -eq 1 ]; then
+    USE_UCI_CONFIG=0
+fi
 
 SERVICE_DAEMONIZE=1
 SERVICE_WRITE_PID=1
 
 start() {
         user_exists mosquitto 200 || user_add mosquitto 200
-        service_start $APP -c /etc/mosquitto/mosquitto.conf
+        if [ "$USE_UCI_CONFIG" -eq 1 ]; then
+            CONF=/tmp/mosquitto.converted.$$.conf
+            mosquitto.uci.convert -f $CONF
+        else
+            CONF=/etc/mosquitto/mosquitto.conf
+        fi
+        service_start $APP -c $CONF
 }
 
 stop() {