From eaa1d5aa18b28cf354a9c481eb036b317d1a7591 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 5 Dec 2018 00:53:00 +0200 Subject: [PATCH] motion: add basic procd init script Disable the init script by default to avoid log pollution; motion is very verbose when it cannot open the configured camera. Signed-off-by: Stijn Tintel --- multimedia/motion/Makefile | 7 +++++-- multimedia/motion/files/motion.conf | 2 ++ multimedia/motion/files/motion.init | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 multimedia/motion/files/motion.conf create mode 100644 multimedia/motion/files/motion.init diff --git a/multimedia/motion/Makefile b/multimedia/motion/Makefile index 037afcd0ca..c696d71523 100644 --- a/multimedia/motion/Makefile +++ b/multimedia/motion/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=motion PKG_VERSION:=4.2.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Roger D PKG_LICENSE:=GPLv2 @@ -35,6 +35,7 @@ define Package/motion endef define Package/motion/conffiles +/etc/config/motion /etc/motion.conf endef @@ -50,7 +51,9 @@ CONFIGURE_ARGS+= \ --without-webp define Package/motion/install - $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_CONF) ./files/motion.conf $(1)/etc/config/motion + $(INSTALL_BIN) ./files/motion.init $(1)/etc/init.d/motion $(CP) $(PKG_BUILD_DIR)/motion-dist.conf $(1)/etc/motion.conf $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/motion $(1)/usr/bin/ diff --git a/multimedia/motion/files/motion.conf b/multimedia/motion/files/motion.conf new file mode 100644 index 0000000000..3155b5e026 --- /dev/null +++ b/multimedia/motion/files/motion.conf @@ -0,0 +1,2 @@ +config motion general + option enabled '0' diff --git a/multimedia/motion/files/motion.init b/multimedia/motion/files/motion.init new file mode 100644 index 0000000000..2aae92092c --- /dev/null +++ b/multimedia/motion/files/motion.init @@ -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 +}