]> code.ossystems Code Review - openembedded-core.git/commitdiff
qemu-config: Autostart oprofile-server in qemu images
authorRichard Purdie <richard@openedhand.com>
Wed, 23 Jan 2008 17:00:31 +0000 (17:00 +0000)
committerRichard Purdie <richard@openedhand.com>
Wed, 23 Jan 2008 17:00:31 +0000 (17:00 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3575 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/packages/oh/qemu-config.bb
meta/packages/oh/qemu-config/qemu-autostart [new file with mode: 0755]

index d7c401eb2ef8c2330b8c09201031c49ff2e281a4..f50d367c96a58a95f8d43fc06790aede0dd0984f 100644 (file)
@@ -1,13 +1,14 @@
 DESCRIPTION = "Adds scripts to use distcc on the host system under qemu"
 LICENSE = "GPL"
-RDEPENDS = "distcc task-poky-nfs-server fakeroot"
-PR = "r6"
+RDEPENDS = "distcc task-poky-nfs-server fakeroot oprofileui-server"
+PR = "r9"
 
 SRC_URI = "file://distcc.sh \
            file://anjuta-remote-run \
            file://exports \
           file://shutdown.desktop \
-          file://shutdown.png"
+          file://shutdown.png \
+           file://qemu-autostart"
 
 S = "${WORKDIR}"
 
@@ -28,4 +29,12 @@ do_install() {
 
     install -d ${D}${datadir}/pixmaps
     install -m 0644 shutdown.png ${D}${datadir}/pixmaps/
-}    
+
+    install -d ${D}/etc/init.d
+    install qemu-autostart ${D}/etc/init.d
+}
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "qemu-autostart"
+INITSCRIPT_PARAMS = "start 999 5 2 . stop 20 0 1 6 ."
diff --git a/meta/packages/oh/qemu-config/qemu-autostart b/meta/packages/oh/qemu-config/qemu-autostart
new file mode 100755 (executable)
index 0000000..5c11269
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+killproc() {            # kill the named process(es)
+        pid=`/bin/ps -e x |
+             /bin/grep $1 |
+             /bin/grep -v grep |
+             /bin/sed -e 's/^  *//' -e 's/ .*//'`
+        [ "$pid" != "" ] && kill $pid
+}
+
+case "$1" in
+  start)
+        echo "Starting automatic qemu services"
+       . /etc/profile
+       /usr/bin/oprofile-server &
+  ;;
+
+  stop)
+        echo "Stopping qemu services"
+        killproc oprofile-server
+  ;;
+
+  restart)
+       $0 stop
+        sleep 1
+        $0 start
+  ;;
+
+  *)
+        echo "usage: $0 { start | stop | restart }"
+  ;;
+esac
+
+exit 0