[OE-core] [PATCH 5/5] tcf-agent: add init.d/tcf-agent status command

Yue Tao Yue.Tao at windriver.com
Wed Nov 27 07:55:44 UTC 2013


From: Li Wang <li.wang at windriver.com>

Signed-off-by: Li Wang <li.wang at windriver.com>
---
 .../tcf-agent/tcf-agent/tcf-agent.init             |   75 ++++++++++++++++++++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |    4 +-
 2 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100755 meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init

diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init b/meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init
new file mode 100755
index 0000000..6303280
--- /dev/null
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init
@@ -0,0 +1,75 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          tcf-agent
+# Default-Start:     3 5
+# Default-Stop:      0 1 2 6
+# Short-Description: Target Communication Framework agent
+### END INIT INFO
+
+DAEMON_PATH=/usr/sbin/tcf-agent
+DAEMON_NAME=`basename $DAEMON_PATH`
+
+. /etc/init.d/functions
+
+test -x $DAEMON_PATH || exit 0
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+export PATH
+
+RETVAL=0
+
+case "$1" in
+    start)
+        echo -n "Starting $DAEMON_NAME: "
+        $DAEMON_PATH -d -L- -l0
+        RETVAL=$?
+        if [ $RETVAL -eq 0 ] ; then
+            echo "OK"
+            touch /var/lock/subsys/$DAEMON_NAME
+        else
+            echo "FAIL"
+        fi
+        ;;
+
+    stop)
+        echo -n "Stopping $DAEMON_NAME: "
+        count=0
+        while [ -n "`/bin/pidof $DAEMON_PATH`" -a $count -lt 10 ] ; do
+            killproc $DAEMON_PATH >& /dev/null
+            sleep 1
+            RETVAL=$?
+            if [ $RETVAL != 0 -o -n "`/bin/pidof $DAEMON_PATH`" ] ; then
+                sleep 3
+            fi
+            count=`expr $count + 1`
+        done
+        rm -f /var/lock/subsys/$DAEMON_NAME
+        if [ -n "`/bin/pidof $DAEMON_PATH`" ] ; then
+            echo "FAIL"
+        else
+            echo "OK"
+        fi
+        ;;
+
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    status)
+        status $DAEMON_NAME
+        RETVAL=$?
+        ;;
+
+    condrestart)
+        [ -f /var/lock/subsys/$DAEMON_NAME ] && $0 restart
+        ;;
+
+    *)
+        echo "usage: $0 { start | stop | status | restart | condrestart | status }"
+        ;;
+esac
+
+exit $RETVAL
+
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
index 09b153e..e7779cd 100644
--- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
@@ -11,7 +11,7 @@ PR = "r2"
 
 SRC_URI = "git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git \
            file://fix_ranlib.patch \
-           file://fix_tcf-agent.init.patch \
+           file://tcf-agent.init \
           "
 
 DEPENDS = "util-linux openssl"
@@ -42,5 +42,7 @@ do_compile() {
 
 do_install() {
 	oe_runmake install INSTALLROOT=${D}
+	install -d ${D}${sysconfdir}/init.d/
+	install -m 0755 ${WORKDIR}/tcf-agent.init ${D}${sysconfdir}/init.d/tcf-agent
 }
 
-- 
1.7.5.4




More information about the Openembedded-core mailing list