Skip to content
Permalink
Browse files

open-vm-tools: Add new package open-vm-tools

Add new package,
open-vm-tools is Open Virtual Machine Tools for VMware guest OS

tested: OpenWrt master and 18.06.2 (x86_64) on ESXi 6.5, 6.7

Signed-off-by: Yuhei OKAWA <tochiro.srchack@gmail.com>
  • Loading branch information...
srchack authored and yousong committed Feb 25, 2019
1 parent 7c0c22f commit 48eadd2ffd274031053415eeb7a6e35409511022
@@ -0,0 +1,115 @@
#
# Copyright (C) 2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=open-vm-tools
PKG_VERSION:=10.3.5
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-10430147.tar.gz
PKG_SOURCE_URL:=https://github.com/vmware/open-vm-tools/releases/download/stable-$(PKG_VERSION)
PKG_HASH:=364cd0fdfa5a05e872d08609659e6231ec99788669f7ebba24bfb8c94168daef
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-10430147
PKG_INSTALL:=1

PKG_FIXUP:=autoreconf
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk

define Package/open-vm-tools
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=@TARGET_x86 +glib2 +libpthread +libtirpc
TITLE:=open-vm-tools
URL:=https://github.com/vmware/open-vm-tools
MAINTAINER:=Yuhei OKAWA <tochiro.srchack@gmail.com>
endef

define Package/open-vm-tools-vm-tools/description
Open Virtual Machine Tools for VMware guest OS
endef


CONFIGURE_ARGS+= \
--without-icu \
--disable-multimon \
--disable-docs \
--disable-tests \
--without-gtkmm \
--without-gtkmm3 \
--without-xerces \
--without-pam \
--disable-grabbitmqproxy \
--disable-vgauth \
--disable-deploypkg \
--without-root-privileges \
--without-kernel-modules \
--without-dnet \
--with-tirpc \
--without-x \
--without-gtk2 \
--without-gtk3 \
--without-xerces


define Package/open-vm-tools/install
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/vmtoolsd.init $(1)/etc/init.d/vmtoolsd

$(INSTALL_DIR) $(1)/etc/vmware-tools/
$(INSTALL_DATA) ./files/tools.conf $(1)/etc/vmware-tools/
$(CP) $(PKG_INSTALL_DIR)/etc/vmware-tools $(1)/etc/

$(INSTALL_DIR) $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmtoolsd $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmware-checkvm $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmware-hgfsclient $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmware-namespace-cmd $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmware-rpctool $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmware-toolbox-cmd $(1)/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vmware-xferlogs $(1)/bin/

$(INSTALL_DIR) $(1)/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mount.vmhgfs $(1)/sbin/
$(INSTALL_BIN) ./files/shutdown $(1)/sbin/

$(INSTALL_DIR) $(1)/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libguestlib.so* $(1)/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libhgfs.so* $(1)/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libvmtools.so* $(1)/lib/

$(INSTALL_DIR) $(1)/usr/lib/open-vm-tools/plugins/common/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/common/libhgfsServer.so $(1)/usr/lib/open-vm-tools/plugins/common/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/common/libvix.so $(1)/usr/lib/open-vm-tools/plugins/common/

$(INSTALL_DIR) $(1)/usr/lib/open-vm-tools/plugins/vmsvc/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/vmsvc/libguestInfo.so $(1)/usr/lib/open-vm-tools/plugins/vmsvc/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/vmsvc/libpowerOps.so $(1)/usr/lib/open-vm-tools/plugins/vmsvc/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/vmsvc/libresolutionKMS.so $(1)/usr/lib/open-vm-tools/plugins/vmsvc/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/vmsvc/libtimeSync.so $(1)/usr/lib/open-vm-tools/plugins/vmsvc/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/open-vm-tools/plugins/vmsvc/libvmbackup.so $(1)/usr/lib/open-vm-tools/plugins/vmsvc/

$(INSTALL_DIR) $(1)/etc/hotplug.d/block/
$(INSTALL_BIN) ./files/vmware-scsi.hotplug $(1)/etc/hotplug.d/block/80-vmware-scsi

$(INSTALL_DIR) $(1)/usr/share/open-vm-tools/messages/de/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/de/toolboxcmd.vmsg $(1)/usr/share/open-vm-tools/messages/de/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/de/vmtoolsd.vmsg $(1)/usr/share/open-vm-tools/messages/de/
$(INSTALL_DIR) $(1)/usr/share/open-vm-tools/messages/ko/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/ko/toolboxcmd.vmsg $(1)/usr/share/open-vm-tools/messages/ko/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/ko/vmtoolsd.vmsg $(1)/usr/share/open-vm-tools/messages/ko/
$(INSTALL_DIR) $(1)/usr/share/open-vm-tools/messages/zh_CN/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/zh_CN/toolboxcmd.vmsg $(1)/usr/share/open-vm-tools/messages/zh_CN/
$(INSTALL_DIR) $(1)/usr/share/open-vm-tools/messages/ja/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/ja/toolboxcmd.vmsg $(1)/usr/share/open-vm-tools/messages/ja/
$(CP) $(PKG_INSTALL_DIR)/usr/share/open-vm-tools/messages/ja/vmtoolsd.vmsg $(1)/usr/share/open-vm-tools/messages/ja/
endef

$(eval $(call BuildPackage,open-vm-tools))
@@ -0,0 +1,8 @@
#!/bin/sh
#compatibility script for openvmtools

if [ "$1" == "-r" ]; then
/sbin/reboot
else
/sbin/poweroff
fi
@@ -0,0 +1,2 @@
[guestinfo]
disable-perf-mon=1
@@ -0,0 +1,13 @@
#!/bin/sh /etc/rc.common

START=10

USE_PROCD=1
PROG=/bin/vmtoolsd

start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
@@ -0,0 +1,20 @@
#!/bin/sh

if [ "$DEVTYPE" = disk ]; then
if [ "$ACTION" = add ]; then
vendor=`cat /sys/block/$DEVNAME/device/vendor`
case "$vendor" in
"VMware"*)
model=`cat /sys/block/$DEVNAME/device/model`
case "$model" in
"Virtual disk"*)
echo 180 > /sys/block/$DEVNAME/device/timeout
;;
"VMware Virtual S")
echo 180 > /sys/block/$DEVNAME/device/timeout
;;
esac
;;
esac
fi
fi
@@ -0,0 +1,21 @@
diff -urN a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -949,7 +949,7 @@
AC_VMW_CHECK_LIB([dnet],
[DNET],
[],
- [dnet-config],
+ [],
[],
[dnet.h],
[intf_open],
@@ -959,7 +959,7 @@

if test $have_dnet = "no"; then
AC_MSG_ERROR(
- [dnet-config was not found on your PATH. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net])
+ [dnet was not found. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net])
fi
fi

@@ -0,0 +1,13 @@
diff -urN a/lib/wiper/wiperPosix.c b/lib/wiper/wiperPosix.c
--- a/lib/wiper/wiperPosix.c
+++ b/lib/wiper/wiperPosix.c
@@ -43,6 +43,9 @@
# include <libgen.h>
# endif /* __FreeBSD_version >= 500000 */
#endif
+#if defined(__linux__)
+#include <sys/sysmacros.h>
+#endif
#include <unistd.h>

#include "vmware.h"
@@ -0,0 +1,29 @@
diff -urN a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1208,6 +1208,7 @@
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
+AC_CHECK_MEMBERS([struct timespec.tv_sec],[],[],[[#include <time.h>]])
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE
diff -urN a/lib/include/hgfsUtil.h b/lib/include/hgfsUtil.h
--- a/lib/include/hgfsUtil.h
+++ b/lib/include/hgfsUtil.h
@@ -53,13 +53,7 @@
# include <time.h>
# endif
# include "vm_basic_types.h"
-# if !defined _STRUCT_TIMESPEC && \
- !defined _TIMESPEC_DECLARED && \
- !defined __timespec_defined && \
- !defined sun && \
- !defined __FreeBSD__ && \
- !__APPLE__ && \
- !defined _WIN32
+# if !defined HAVE_STRUCT_TIMESPEC_TV_SEC
struct timespec {
time_t tv_sec;
long tv_nsec;
@@ -0,0 +1,40 @@
diff -urN a/lib/hgfsServer/hgfsServerLinux.c b/lib/hgfsServer/hgfsServerLinux.c
--- a/lib/hgfsServer/hgfsServerLinux.c
+++ b/lib/hgfsServer/hgfsServerLinux.c
@@ -105,11 +105,13 @@
#endif

/*
- * ALLPERMS (mode 07777) and ACCESSPERMS (mode 0777) are not defined in the
- * Solaris version of <sys/stat.h>.
+ * ALLPERMS (mode 07777) and ACCESSPERMS (mode 0777) are not specified in
+ * POSIX.
*/
-#ifdef sun
+#ifndef ACCESSPERMS
# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
+#endif
+#ifndef ALLPERMS
# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
#endif

diff -urN a/services/plugins/dndcp/dnd/dndLinux.c b/services/plugins/dndcp/dnd/dndLinux.c
--- a/services/plugins/dndcp/dnd/dndLinux.c
+++ b/services/plugins/dndcp/dnd/dndLinux.c
@@ -52,7 +52,7 @@

#define DND_ROOTDIR_PERMS (S_IRWXU | S_IRWXG | S_IRWXO)
#define DND_STAGINGDIR_PERMS (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
-#ifdef sun
+#ifndef ACCESSPERMS
#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO)
#endif
#ifdef __ANDROID__
@@ -61,7 +61,6 @@
*/
#define NO_SETMNTENT
#define NO_ENDMNTENT
-#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO)
#endif


@@ -0,0 +1,105 @@
diff -urN a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -897,6 +897,7 @@

AC_CHECK_FUNCS([ecvt])
AC_CHECK_FUNCS([fcvt])
+AC_CHECK_FUNCS([getifaddrs getauxval issetugid __secure_getenv])

AC_CHECK_FUNC([mkdtemp], [have_mkdtemp=yes])

@@ -1145,10 +1146,13 @@
###

AC_CHECK_HEADERS([crypt.h])
+AC_CHECK_HEADERS([ifaddrs.h])
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([wchar.h])
+AC_CHECK_HEADERS([net/if.h])
+AC_CHECK_HEADERS([sys/auxv.h])
AC_CHECK_HEADERS([sys/inttypes.h])
AC_CHECK_HEADERS([sys/io.h])
AC_CHECK_HEADERS([sys/param.h]) # Required to make the sys/user.h check work correctly on FreeBSD
diff -urN a/lib/misc/idLinux.c b/lib/misc/idLinux.c
--- a/lib/misc/idLinux.c
+++ b/lib/misc/idLinux.c
@@ -27,12 +27,9 @@
#include <sys/syscall.h>
#include <string.h>
#include <unistd.h>
-#ifdef __linux__
-#if defined(__GLIBC__) && \
- (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#ifdef HAVE_SYS_AUXV_H
#include <sys/auxv.h>
#endif
-#endif
#ifdef __APPLE__
#include <sys/socket.h>
#include <TargetConditionals.h>
@@ -997,31 +994,32 @@
static Bool
IdIsSetUGid(void)
{
-#if defined(__ANDROID__)
- /* Android does not have a secure_getenv, so be conservative. */
- return TRUE;
-#else
/*
* We use __secure_getenv, which returns NULL if the binary is
- * setuid or setgid. Alternatives include,
+ * setuid or setgid, when issetugid or getauxval(AT_SECURE) is not
+ * available. Alternatives include,
*
- * a) getauxval(AT_SECURE); not available until glibc 2.16.
- * b) __libc_enable_secure; may not be exported.
+ * a) issetugid(); not (yet?) available in glibc.
+ * b) getauxval(AT_SECURE); not available until glibc 2.16.
+ * c) __libc_enable_secure; may not be exported.
*
- * Use (a) when we are based on glibc 2.16, or newer.
+ * Use (b) when we are based on glibc 2.16, or newer.
*/

-#if defined(__GLIBC__) && \
- (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#if HAVE_ISSETUGID
+ return issetugid();
+#elif HAVE_GETAUXVAL
return getauxval(AT_SECURE) != 0;
-#else
+#elif HAVE___SECURE_GETENV
static const char envName[] = "VMW_SETUGID_TEST";

if (setenv(envName, "1", TRUE) == -1) {
return TRUE; /* Conservative */
}
return __secure_getenv(envName) == NULL;
-#endif
+#else
+ /* Android does not have a secure_getenv, so be conservative. */
+ return TRUE;
#endif
}
#endif
diff -urN a/lib/nicInfo/nicInfoPosix.c b/lib/nicInfo/nicInfoPosix.c
--- a/lib/nicInfo/nicInfoPosix.c
+++ b/lib/nicInfo/nicInfoPosix.c
@@ -34,9 +34,13 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <errno.h>
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
+#endif
+#if HAVE_IFADDRS_H
# include <ifaddrs.h>
+#endif
+#if HAVE_NET_IF_H
# include <net/if.h>
#endif
#ifndef NO_DNET
@@ -0,0 +1,12 @@
diff -urN a/services/plugins/vix/vixTools.c b/services/plugins/vix/vixTools.c
--- a/services/plugins/vix/vixTools.c
+++ b/services/plugins/vix/vixTools.c
@@ -66,7 +66,7 @@
#include <unistd.h>
#endif

-#if defined(sun) || defined(__FreeBSD__) || defined(__APPLE__)
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif

Oops, something went wrong.

0 comments on commit 48eadd2

Please sign in to comment.
You can’t perform that action at this time.