[oe-commits] Tim 'timtim' Ellis : piccontrol: Add init script, tidy up

GIT User account git at amethyst.openembedded.net
Sat Jan 24 00:45:18 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: b1777b1bdf7d5971397ac6615257af56eced2602
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=b1777b1bdf7d5971397ac6615257af56eced2602

Author: Tim 'timtim' Ellis <tim.ellis at foonas.org>
Date:   Sat Jan 24 00:43:58 2009 +0000

piccontrol: Add init script, tidy up

---

 packages/piccontrol/files/init                |   37 +++++++++++++++++++++++++
 packages/piccontrol/files/piccontrol-0.4.conf |    4 +-
 packages/piccontrol/piccontrol_0.4.bb         |   28 ++++++++++---------
 3 files changed, 54 insertions(+), 15 deletions(-)

diff --git a/packages/piccontrol/files/init b/packages/piccontrol/files/init
new file mode 100644
index 0000000..3f2e511
--- /dev/null
+++ b/packages/piccontrol/files/init
@@ -0,0 +1,37 @@
+#! /bin/sh
+# piccontrol - simple init.d piccontrol script - tim.ellis at 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
diff --git a/packages/piccontrol/files/piccontrol-0.4.conf b/packages/piccontrol/files/piccontrol-0.4.conf
index 2504d75..9d8bf31 100644
--- a/packages/piccontrol/files/piccontrol-0.4.conf
+++ b/packages/piccontrol/files/piccontrol-0.4.conf
@@ -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
diff --git a/packages/piccontrol/piccontrol_0.4.bb b/packages/piccontrol/piccontrol_0.4.bb
index 7ec7e4c..cfdef98 100644
--- a/packages/piccontrol/piccontrol_0.4.bb
+++ b/packages/piccontrol/piccontrol_0.4.bb
@@ -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
 }
-





More information about the Openembedded-commits mailing list