[oe] [meta-oe][PATCH] open-vm-tools: add sysvinit script to start vmtoolsd daemon at boot time

Jagadeesh Krishnanjanappa jkrishnanjanappa at mvista.com
Tue Jan 9 17:41:26 UTC 2018


Please ignore this patch, I will send v2 to
1. to record PID of vmtoolsd in /var/pid/vmtools.pid.
2. check the status of vmtoolsd via init script.
3. restart vmtoolsd correctly.

Regards,
Jagadeesh

On Tue, Jan 9, 2018 at 4:13 PM, Jagadeesh Krishnanjanappa <
jkrishnanjanappa at mvista.com> wrote:

> It adds support to start vmtoolsd daemon during system startup,
> when init manager is SysVinit.
>
> Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.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(-)
>  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 0000000..b78b9f5
> --- /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=""
> +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..e9e0f92 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():
> --
> 2.7.4
>
>



More information about the Openembedded-devel mailing list