open-vm-tools: add sysvinit script to start vmtoolsd daemon at boot time
PATCH v2 1/1 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 <[email protected]>
--- .../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
meta-oe/recipes-support/open-vm-tools/files/vmtoolsd.init new file +66 -0
@@ -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
meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb +14 -3
@@ -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():
Signature · 1 line
2.7.4