Files
poky/meta/recipes-devtools/tcf-agent/tcf-agent/fix_tcf-agent.init.patch
Ioana Grigoropol 9dccc97bfc tcf-agent: Use kill instead of killproc to stop agent
When shutting down a core-image-lsb-sdk image, there is a lot of time spend stopping tcf-agent,
which slows down the whole process. The reason for this slowdown is the fact that it tries in a
loop to kill tcf-agent service by using killproc with the path of the executable and killproc
does not seem to available in lsb images. This patch fixes the issue by using "kill" instead of
"killproc".

[Yocto #3928]

(From OE-Core rev: 251361eb78176a04e3da00e0f77b7f3ff459d571)

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
Signed-off-by: Bogdan Marinescu <bogdan.a.marinescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-08 18:02:47 +01:00

97 lines
2.5 KiB
Diff

Upstream-Status: Inappropriate [poky-specific script]
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@
install -d -m 755 $(INSTALLROOT)$(INCLUDE)/tcf/services
install -c $(BINDIR)/agent -m 755 $(INSTALLROOT)$(SBIN)/tcf-agent
install -c $(BINDIR)/client -m 755 $(INSTALLROOT)$(SBIN)/tcf-client
- install -c main/tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent
+ install -c tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent
install -c config.h -m 755 $(INSTALLROOT)$(INCLUDE)/tcf/config.h
install -c -t $(INSTALLROOT)$(INCLUDE)/tcf/framework -m 644 framework/*.h
install -c -t $(INSTALLROOT)$(INCLUDE)/tcf/services -m 644 services/*.h
--- /dev/null
+++ b/tcf-agent.init
@@ -0,0 +1,80 @@
+#!/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
+ pid=$(/bin/pidof $DAEMON_PATH)
+ while [ -n "`/bin/pidof $DAEMON_PATH`" -a $count -lt 10 ] ; do
+ kill $pid > /dev/null 2>&1
+ sleep 1
+ RETVAL=$?
+ if [ $RETVAL != 0 -o -n "`/bin/pidof $DAEMON_PATH`" ] ; then
+ sleep 3
+ fi
+ count=`expr $count + 1`
+ pid=$(/bin/pidof $DAEMON_PATH)
+ 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)
+ if [ -n "`/bin/pidof $DAEMON_PATH`" ] ; then
+ echo "$DAEMON_NAME is running"
+ else
+ echo "$DAEMON_NAME is not running"
+ fi
+ ;;
+
+ condrestart)
+ [ -f /var/lock/subsys/$DAEMON_NAME ] && $0 restart
+ ;;
+
+ *)
+ echo "usage: $0 { start | stop | restart | condrestart | status }"
+ ;;
+esac
+
+exit $RETVAL
+