From bb1465863da8bde10f62fd3a1bbfb981e449dc47 Mon Sep 17 00:00:00 2001 From: Jagadeesh Krishnanjanappa Date: Wed, 10 Jan 2018 00:01:06 +0530 Subject: 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 Signed-off-by: Armin Kuster --- .../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(-) create mode 100644 meta-oe/recipes-support/open-vm-tools/files/vmtoolsd.init 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 0000000000..38280464a7 --- /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 81e8e96249..c32d2c5b33 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(): -- cgit 1.2.3-korg