piccontrol: Add init script, tidy up
authorTim 'timtim' Ellis <tim.ellis@foonas.org>
Sat, 24 Jan 2009 00:43:58 +0000 (00:43 +0000)
committerTim 'timtim' Ellis <tim.ellis@foonas.org>
Sat, 24 Jan 2009 00:43:58 +0000 (00:43 +0000)
packages/piccontrol/files/init [new file with mode: 0644]
packages/piccontrol/files/piccontrol-0.4.conf
packages/piccontrol/piccontrol_0.4.bb

diff --git a/packages/piccontrol/files/init b/packages/piccontrol/files/init
new file mode 100644 (file)
index 0000000..3f2e511
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+# piccontrol - simple init.d piccontrol script - tim.ellis@foonas.org
+set -e
+
+if [ ! -f /usr/sbin/piccontrol ]; then
+    echo -n "Warning: piccontrol binary not found. Shutting down"
+    shutdown -h now
+    exit -1
+fi
+
+case "$1" in
+  start)
+        echo -n "Starting piccontrol: "
+        rm -f /var/run/piccontrol.sock
+        start-stop-daemon -S -b -n piccontrol -a /usr/sbin/piccontrol -- -d
+        sleep 1
+        piccontrol statusled greenon
+        piccontrol powerled on
+        piccontrol buzzer short
+        echo "done"
+        ;;
+  stop)
+        echo -n "Stopping piccontrol: "
+        start-stop-daemon -K -n piccontrol >&- 2>&- &
+        echo "done"
+        ;;
+  restart)
+        $0 stop
+        $0 start
+        ;;
+  *)
+        echo "Usage: piccontrol { start | stop | restart }" >&2
+        exit 1
+        ;;
+esac
+
+exit 0
index 2504d75..9d8bf31 100644 (file)
@@ -1,6 +1,6 @@
 register("ts209")
 
-register("evdev", "/dev/event0",
+register("evdev", "/dev/input/event0",
          116, "restart_button",
          408, "media_button")
 
@@ -42,4 +42,4 @@ end
 
 function media_button( time )
        piccmd("usbled", "8hz")
-end
\ No newline at end of file
+end
index 7ec7e4c..cfdef98 100644 (file)
@@ -1,25 +1,27 @@
 DESCRIPTION = "Microcontroller utility for ARM turbostations by Byron Bradley"
 SECTION = "console/network"
 DEPENDS = "lua5.1"
-FILE_PR = "r0"
+PR = "r1"
 LICENSE = "GPL"
-
 COMPATIBLE_MACHINE = "tsx09"
 
-LDFLAGS        += " ${STAGING_LIBDIR}/liblua5.1.a -lpthread -lm -ldl "
-CFLAGS += " -I${STAGING_INCDIR}/lua5.1 "
-
-S = "${WORKDIR}/qcontrol-${PV}"
-
 SRC_URI = "http://byronbradley.co.uk/piccontrol/qcontrol-0.4.tar.gz \
            file://luafix-0.4.patch;patch=0 \
            file://configlocation.patch;patch=1 \
-           file://piccontrol-0.4.conf"
+           file://piccontrol-0.4.conf \
+           file://init"
+S = "${WORKDIR}/qcontrol-${PV}"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "piccontrol"
+INITSCRIPT_PARAMS = "defaults"
+
+LDFLAGS        += " ${STAGING_LIBDIR}/liblua5.1.a -lpthread -lm -ldl "
+CFLAGS += " -I${STAGING_INCDIR}/lua5.1 "
 
 do_install() {
-       install -d ${D}${sbindir} \
-                  ${D}${sysconfdir}
-       install -c -m 755 ${S}/piccontrol ${D}${sbindir}/piccontrol
-       install -m 0644 ${WORKDIR}/piccontrol-0.4.conf ${D}${sysconfdir}/piccontrol.conf
+       install -D -m 0755 ${S}/piccontrol ${D}${sbindir}/piccontrol
+       install -D -m 0644 ${WORKDIR}/piccontrol-0.4.conf ${D}${sysconfdir}/piccontrol.conf
+       install -D -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/piccontrol
 }
-