motion: add basic procd init script
[feed/packages.git] / multimedia / motion / files / motion.init
diff --git a/multimedia/motion/files/motion.init b/multimedia/motion/files/motion.init
new file mode 100644 (file)
index 0000000..2aae920
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+
+START=94
+USE_PROCD=1
+
+PROG="/usr/bin/motion"
+CONF="/etc/motion.conf"
+
+start_service() {
+       local enabled
+
+       config_load "motion"
+       config_get_bool enabled "general" "enabled" 0
+       [ "$enabled" -gt 0 ] || return 1
+
+       procd_open_instance
+
+       procd_set_param command "$PROG"
+       procd_append_param command -c "$CONF"
+
+       procd_close_instance
+}