[oe-commits] [meta-openembedded] 17/32: open-vm-tools: add sysvinit script to start vmtoolsd daemon at boot time

git at git.openembedded.org git at git.openembedded.org
Tue Jan 16 16:02:32 UTC 2018


This is an automated email from the git hooks/post-receive script.

armin_kuster pushed a commit to branch master-next
in repository meta-openembedded.

commit 2a0e49c7e1f4c4abb7016b73e1803e4f77bb2cab
Author: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
AuthorDate: Wed Jan 10 00:01:06 2018 +0530

    open-vm-tools: add sysvinit script to start vmtoolsd daemon at boot time
    
    It adds support to start vmtoolsd daemon during system startup,
    when init manager is SysVinit.
    
    Patch V2 adds option to store pid file in /var/run/vmtoolsd.pid file,
    which is helpful to stop/restart vmtoolsd daemon.
    
    Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 .../open-vm-tools/files/vmtoolsd.init              | 66 ++++++++++++++++++++++
 .../open-vm-tools/open-vm-tools_10.1.5.bb          | 17 +++++-
 2 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/meta-oe/recipes-support/open-vm-tools/files/vmtoolsd.init b/meta-oe/recipes-support/open-vm-tools/files/vmtoolsd.init
new file mode 100644
index 0000000..3828046
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/files/vmtoolsd.init
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+#   vmtoolsd          Start/stop the vmware tools daemon
+#
+# chkconfig:  2345 90 60
+# description: vmtoolsd is a daemon that starts up.  for some reason, it
+#              doesn't include a sysv init startup file in the latest release.
+#              so i have to write this
+#
+
+### BEGIN INIT INFO
+# Provides: vmtoolsd
+# Required-Start: $local_fs $syslog
+# Required-Stop: $local_fs $syslog
+# Default-Start: 2345
+# Default-Stop: 90
+# Short-Description: Run vmware tools daemon
+### END INIT INFO
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/vmtoolsd
+NAME=vmtoolsd
+DESC="vmware tools daemon"
+VMTOOLSDARGS=" -b /var/run/vmtoolsd.pid "
+RETVAL="1"
+
+# source function library
+. /etc/init.d/functions
+
+test -f $DAEMON || exit 0
+
+
+case "$1" in
+  start)
+    echo -n "Starting vmware tools daemon: "
+    start-stop-daemon --start --quiet --exec $DAEMON -- $VMTOOLSDARGS
+    RETVAL=$?
+    if [ $RETVAL -eq 0 ] ; then
+        echo "OK"
+    else
+        echo "FAIL"
+    fi
+    ;;
+  stop)
+    echo -n "Stopping vmware tools daemon: "
+    start-stop-daemon --stop --quiet --pidfile /var/run/vmtoolsd.pid
+    RETVAL=$?
+    if [ $RETVAL -eq 0 ] ; then
+        echo "OK"
+    else
+        echo "FAIL"
+    fi
+    ;;
+  status)
+    status vmtoolsd
+    exit $?
+    ;;
+  restart)
+    $0 stop && sleep 1 && $0 start
+    ;;
+  *)
+    echo "Usage: /etc/init.d/vmtoolsd {start|stop|status|restart}"
+    exit 1
+esac
+
+exit $RETVAL
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
index 81e8e96..c32d2c5 100644
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
@@ -24,6 +24,7 @@ LICENSE_modules/solaris = "CDDL-1.0"
 SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \
            file://tools.conf \
            file://vmtoolsd.service \
+           file://vmtoolsd.init \
            file://0001-configure.ac-don-t-use-dnet-config.patch \
            file://0002-add-include-sys-sysmacros.h.patch \
            file://0001-Remove-assumptions-about-glibc-being-only-libc-imple.patch \
@@ -50,7 +51,7 @@ DEPENDS_append_libc-musl = " libtirpc"
 # open-vm-tools is supported only on x86.
 COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'
 
-inherit autotools pkgconfig systemd
+inherit autotools pkgconfig systemd update-rc.d
 
 SYSTEMD_SERVICE_${PN} = "vmtoolsd.service"
 
@@ -85,8 +86,14 @@ RDEPENDS_${PN} = "util-linux libdnet fuse"
 
 do_install_append() {
     ln -sf ${sbindir}/mount.vmhgfs ${D}/sbin/mount.vmhgfs
-    install -d ${D}${systemd_unitdir}/system ${D}${sysconfdir}/vmware-tools
-    install -m 644 ${WORKDIR}/*.service ${D}${systemd_unitdir}/system
+    install -d ${D}${sysconfdir}/vmware-tools
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 644 ${WORKDIR}/*.service ${D}${systemd_unitdir}/system
+    else
+        install -d ${D}${sysconfdir}/init.d
+        install -m 0755 ${WORKDIR}/vmtoolsd.init ${D}${sysconfdir}/init.d/vmtoolsd
+    fi
     install -m 0644 ${WORKDIR}/tools.conf ${D}${sysconfdir}/vmware-tools/tools.conf
 }
 
@@ -95,6 +102,10 @@ do_configure_prepend() {
     export CUSTOM_DNET_LIBS=-L${STAGING_LIBDIR}/libdnet.so
 }
 
+INITSCRIPT_PACKAGES = "${PN}"
+INITSCRIPT_NAME_${PN} = "vmtoolsd"
+INITSCRIPT_PARAMS_${PN} = "start 90 2 3 4 5 . stop 60 0 1 6 ."
+
 python() {
     if 'networking-layer' not in d.getVar('BBFILE_COLLECTIONS').split() or \
 	'filesystems-layer' not in d.getVar('BBFILE_COLLECTIONS').split():

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list