gateone: Add sysv init script
authorDan McGregor <dan.mcgregor@usask.ca>
Mon, 3 Jun 2013 22:15:20 +0000 (22:15 +0000)
committerPatrick Ohly <patrick.ohly@intel.com>
Fri, 9 Jan 2015 16:30:44 +0000 (08:30 -0800)
(From meta-openembedded rev: 348e00fedd4cc380c5c74d90b546f2444327f224)

Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
meta-openembedded/meta-oe/recipes-connectivity/gateone/gateone/gateone-init [new file with mode: 0644]
meta-openembedded/meta-oe/recipes-connectivity/gateone/gateone_git.bb

diff --git a/meta-openembedded/meta-oe/recipes-connectivity/gateone/gateone/gateone-init b/meta-openembedded/meta-oe/recipes-connectivity/gateone/gateone/gateone-init
new file mode 100644 (file)
index 0000000..a1cf5ce
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          gateone
+# Required-Start:    networking
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Gateone HTML5 ssh client
+# Description:       Gateone HTML5 terminal emulator and SSH client.
+### END INIT INFO
+
+. /etc/init.d/functions
+
+NAME=gateone
+DAEMON=/var/lib/gateone/gateone.py
+PIDFILE=/var/run/gateone.pid
+WORKDIR=/var/lib/gateone
+
+do_start() {
+    cd $WORKDIR
+    /usr/bin/python $DAEMON > /dev/null 2>&1 &
+    cd $OLDPWD
+}
+
+do_stop() {
+    kill -TERM `cat $PIDFILE`
+}
+
+case "$1" in
+    start)
+        echo "Starting gateone"
+        do_start
+        ;;
+    stop)
+        echo "Stopping gateone"
+        do_stop
+        ;;
+    restart|force-reload)
+        echo "Restart gateone"
+        do_stop
+        sleep 1
+        do_start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart|force-reload}" >&2
+        exit 1
+        ;;
+esac
index e5b8527..85c32cc 100644 (file)
@@ -10,11 +10,12 @@ SRC_URI = "git://github.com/liftoff/GateOne.git \
            file://gateone-avahi.service \
            file://server.conf \
            file://gateone.service \
+           file://gateone-init \
 "
 
 S = "${WORKDIR}/git"
 
-inherit distutils allarch python-dir systemd
+inherit distutils allarch python-dir systemd update-rc.d
 
 export prefix = "${localstatedir}/lib"
 
@@ -28,6 +29,9 @@ do_install_append() {
     
     install -d ${D}${systemd_unitdir}/system
     install -m 0644 ${WORKDIR}/gateone.service ${D}${systemd_unitdir}/system
+
+    install -d ${D}${sysconfdir}/init.d
+    install -m 0755 ${WORKDIR}/gateone-init ${D}${sysconfdir}/init.d/gateone
 }
 
 FILES_${PN} = "${localstatedir}/lib ${localstatedir}/log ${localstatedir}/volatile/log ${base_libdir} ${sysconfdir} ${PYTHON_SITEPACKAGES_DIR}"
@@ -63,3 +67,4 @@ RDEPENDS_${PN} = "file \
 "
 
 SYSTEMD_SERVICE_${PN} = "gateone.service"
+INITSCRIPT_NAME = "gateone"