Created init script for FunKey-GPIO-Mapping

This commit is contained in:
Michel-FK 2020-05-31 19:31:56 +02:00
parent 58c941b7df
commit 1d361b9901
2 changed files with 39 additions and 1 deletions

View File

@ -20,10 +20,12 @@ endef
define FUNKEY_GPIO_MAPPING_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/sbin
$(INSTALL) -m 0755 $(@D)/funkey_gpio_management $(TARGET_DIR)/usr/local/sbin/funkey_gpio_manag
$(INSTALL) -m 0755 $(@D)/funkey_gpio_management $(TARGET_DIR)/usr/local/sbin/funkey_gpio_management
$(INSTALL) -m 0755 $(@D)/termfix $(TARGET_DIR)/usr/local/sbin/termfix
$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc
$(INSTALL) -m 0644 $(@D)/funkey_gpio_mapping.conf $(TARGET_DIR)/etc/funkey_gpio_mapping.conf
$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 0755 $(FUNKEY_GPIO_MAPPING_PKGDIR)etc/init.d/S06funkey-gpio-management $(TARGET_DIR)/etc/init.d/S06funkey-gpio-management
endef
$(eval $(generic-package))

View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# Start/stop funkey_gpio_management
#
DAEMON=/usr/local/sbin/funkey_gpio_management
PIDFILE=/var/run/funkey_gpio_management.pid
case "$1" in
start)
echo -n "Starting funkey_gpio_management: "
start-stop-daemon -S -x ${DAEMON} -p ${PIDFILE} -m -b -- > /dev/null 2>&1
if [ ${?} -eq 0 ]; then
echo "OK"
else
echo "ERROR"
fi
;;
stop)
echo -n "Stopping funkey_gpio_management: "
start-stop-daemon -K -x ${DAEMON} -p ${PIDFILE} -o > /dev/null 2>&1
if [ ${?} -eq 0 ]; then
echo "OK"
else
echo "ERROR"
fi
;;
restart)
${0} stop
sleep 1 # Prevent race condition: ensure funkey_gpio_management stops before start.
${0} start
;;
*)
echo "Usage: ${0} {start|stop|restart}"
exit 1
esac