summaryrefslogtreecommitdiff
path: root/package/mosquitto/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/mosquitto/files')
-rw-r--r--package/mosquitto/files/mosquitto.init29
-rw-r--r--package/mosquitto/files/mosquitto.postinst7
2 files changed, 36 insertions, 0 deletions
diff --git a/package/mosquitto/files/mosquitto.init b/package/mosquitto/files/mosquitto.init
new file mode 100644
index 000000000..7b9c7a827
--- /dev/null
+++ b/package/mosquitto/files/mosquitto.init
@@ -0,0 +1,29 @@
+#!/bin/sh
+#PKG mosquitto
+#INIT 60
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${mosquitto:-NO}" = x"NO" && exit 0
+ test x"$mosquitto" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
+ exec sh $0 start
+ ;;
+start)
+ [ -d /var/lib/mosquitto ] || mkdir -p /var/lib/mosquitto
+ /usr/sbin/mosquitto $mosquitto_flags
+ ;;
+stop)
+ kill $(pgrep -f /usr/sbin/mosquitto)
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ exit 1
+ ;;
+esac
+exit $?
diff --git a/package/mosquitto/files/mosquitto.postinst b/package/mosquitto/files/mosquitto.postinst
new file mode 100644
index 000000000..5c39e9bde
--- /dev/null
+++ b/package/mosquitto/files/mosquitto.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+. $IPKG_INSTROOT/etc/functions.sh
+add_rcconf mosquitto NO
+add_rcconf mosquitto_flags ''
+gid=$(get_next_gid)
+add_group mosquitto $gid
+add_user mosquitto $(get_next_uid) $gid /etc/mosquitto