# HG changeset patch # User Nathan Neulinger # Date 1442619110 0 # Node ID 995a8662f5ad45760c60581019adb20478c1971e # Parent 23f30a856a5b4a134d42c3a0de1860588cca4130 Add: WIP open-vm-tools (10.0.0) diff -r 23f30a856a5b -r 995a8662f5ad open-vm-tools/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/open-vm-tools/receipt Fri Sep 18 23:31:50 2015 +0000 @@ -0,0 +1,81 @@ +# SliTaz package receipt. + +PACKAGE="open-vm-tools" +VERSION="10.0.0-3000743" +CATEGORY="utilities" +TAGS="vmware kernel" +SHORT_DESC="Open VMware Tools" +MAINTAINER="nobody@slitaz.org" +LICENSE="GPL" +TARBALL="open-vm-tools-$VERSION.tar.gz" +WEB_SITE="https://github.com/vmware/open-vm-tools" +WGET_URL="https://github.com/vmware/open-vm-tools/archive/$TARBALL" +HOST_ARCH="i486 x86_64" + +DEPENDS="shutdown glib libffi libmspack" +BUILD_DEPENDS="autoconf automake libtool linux-source glib-dev libffi-dev libdnet-dev libmspack-dev slitaz-toolchain" + + +# Rules to configure and make the package. +compile_rules() +{ + [ -d /lib/modules/$(uname -r)/source ] || get-linux-source + + cd open-vm-tools + sed -i -e "s/-Werror//" configure.ac + autoreconf -i + ./configure \ + --with-distro="SliTaz" \ + --without-pam \ + --without-x \ + --without-icu \ + --without-gtk2 \ + --without-gtkmm \ + --without-xmlsecurity \ + --without-xerces \ + $CONFIGURE_ARGS && + make && make DESTDIR=$install install +} + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + mkdir -p $fs/usr/lib + mkdir -p $fs/usr/share + mkdir -p $fs/sbin + mkdir -p $fs/etc + mkdir -p $fs/lib + mkdir -p $fs/include + mkdir -p $fs/etc/init.d + + cp $stuff/vmtoolsd $fs/etc/init.d + chmod 755 $fs/etc/init.d + + cp -a $install/etc/vmware-tools $fs/etc + + # Replace with slitaz customized default network script + cp $stuff/network $fs/etc/vmware-tools/scripts/vmware/network + chmod 755 $fs/etc/vmware-tools/scripts/vmware/network + + cp -a $install/sbin $fs/sbin + + cp -a $install/lib/modules $fs/lib + + cp -a $install/usr/include $fs/usr + cp -a $install/usr/bin $fs/usr + cp -a $install/usr/sbin $fs/usr + + cp -a $install/usr/share/open-vm-tools $fs/usr/share + + cp -a $install/usr/lib/*.so* $fs/usr/lib + cp -a $install/usr/lib/*.a $fs/usr/lib + cp -a $install/usr/lib/open-vm-tools $fs/usr/lib + cp -a $install/usr/lib/pkgconfig $fs/usr/lib +} + +post_install() +{ + echo -n "Processing post-install commands..." + chroot "$1/" depmod -a + status +} diff -r 23f30a856a5b -r 995a8662f5ad open-vm-tools/stuff/network --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/open-vm-tools/stuff/network Fri Sep 18 23:31:50 2015 +0000 @@ -0,0 +1,186 @@ +#!/bin/sh +########################################################## +# Copyright (C) 2001-2010 VMware, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation version 2.1 and no later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +########################################################## + + +# +# network (Linux) +# +# Using a combination of a system networking script, ifconfig, and ifup, +# attempt to release and renew DHCP leases upon receipt of suspend and resume +# events, respectively. +# + + +echo `date` ": Executing '$0'" +echo + +. `dirname "$0"`/../../statechange.subr + + +# +# find_networking_script -- +# +# Searches common Linux distro init/rc paths to find a singular network +# services script. +# +# Result: +# Returns a valid networking script path on success or "error" on failure. +# +# Side effects: +# None. +# + +find_networking_script() { + echo "network.sh" +} + + +# +# run_network_script -- +# +# Finds out how to run the system's script used to control networking, and +# runs it with the given argument (which should be one of the usual SysV +# init script arguments). +# +run_network_script() +{ + script=`find_networking_script` + [ "$script" != "error" ] || Panic "Cannot find system networking script." + + "$script" "$1" +} + + +# +# save_active_NIC_list -- +# +# Records a list of every active NIC to /var/run/vmware-active-nics. +# +# XXX What's the story on aliases? Should they still be included, or will +# they be recreated automatically upon resume? +# +# Results: +# $activeList has, one per line, a list of all active NICs. +# +# Side effects: +# None. +# + +save_active_NIC_list() { + >$activeList + + for nic in `ifconfig | awk '/^eth/ { print $1 }'`; do + ifconfig $nic | egrep -q '\bUP\b' && echo $nic >> $activeList + exitCode=`expr $exitCode \| $?` + done +} + + +# +# rescue_NIC -- +# +# For each NIC recorded in $activeList that is not currently "up", run +# "INTERFACE=$nic network.sh start". +# +# Results: +# All downed NICs should be active. +# + +rescue_NIC() { + if [ -f "$activeList" ]; then + while read nic; do + if ifconfig $nic | egrep -q '\bUP\b'; then + echo `date` "[rescue_nic] $nic is already active." + else + echo `date` "[rescue_nic] activating $nic ..." + + INTERFACE=$nic /etc/init.d/network.sh start + exitCode=`expr $exitCode \| $?` + fi + done < $activeList + + rm -f $activeList + fi +} + + +# +# main -- +# +# Main entry point. Perform some sanity checking, then map state change +# events to relevant networking operations. +# +# Results: +# See comment at top of file. +# + +main() { + exitCode=0 + activeList=/var/run/vmware-active-nics + + # XXX Are these really necessary? If so, we should have seen customer + # complaints by now. + which ifconfig >/dev/null 2>&1 || Panic "ifconfig not in search path." + + case "$1" in + poweron-vm) + rm -f $activeList + ;; + suspend-vm) + exitCode=$? + if [ $exitCode != 0 ]; then + save_active_NIC_list + run_network_script stop + exitCode=$? + fi + ;; + resume-vm) + WakeNetworkManager + exitCode=$? + if [ $exitCode != 0 ]; then + # According to hfu, "/etc/init.d/networking restart" on Debian 5.0 + # may bring down ethernet interfaces tagged as "allow-hotplug" without + # bringing them back up. + # + # This is especially a problem when reverting to a live, running + # VM snapshot where an active NIC list hadn't yet been generated, + # resulting in sudden loss of an otherwise operational NIC. + # + # So, if the active list doesn't exist, assume we're coming back to + # a live snapshot and capture the current active list now for + # rescue later. + if [ ! -s $activeList ]; then + save_active_NIC_list + fi + + # We shall use start not restart here. Otherwise we may not be able + # to bring back active list on distros like sles11sp2 + # -- PR 816791 + run_network_script start + rescue_NIC + exitCode=$? + fi + ;; + *) ;; + esac + + return $exitCode +} + +main "$@" diff -r 23f30a856a5b -r 995a8662f5ad open-vm-tools/stuff/vmtoolsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/open-vm-tools/stuff/vmtoolsd Fri Sep 18 23:31:50 2015 +0000 @@ -0,0 +1,61 @@ +#!/bin/sh +# /etc/init.d/vmtoolsd : Start, stop and restart Open VM Tools daemon on SliTaz, at +# boot time or with the command line. +# +# To start VMTools daemon at boot time, just put vmtoolsd in the $RUN_DAEMONS +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf +# +. /etc/init.d/rc.functions +. /etc/daemons.conf + +NAME=VMTools +DESC="VMTools" +DAEMON=/usr/bin/vmtoolsd +PIDFILE=/var/run/vmtoolsd.pid +OPTIONS="-b $PIDFILE" + +case "$1" in + start) + if active_pidfile $PIDFILE vmtoolsd ; then + echo "$NAME already running." + exit 1 + fi + echo -n "Starting $DESC: $NAME... " + modprobe vmblock + modprobe vmhgfs + modprobe vmci + modprobe vmsync + modprobe vsock + $DAEMON $OPTIONS + status + ;; + stop) + if ! active_pidfile $PIDFILE vmtoolsd ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Stopping $DESC: $NAME... " + kill `cat $PIDFILE` + status + ;; + restart) + if ! active_pidfile $PIDFILE vmtoolsd ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Restarting $DESC: $NAME... " + kill `cat $PIDFILE` + sleep 2 + $DAEMON $OPTIONS + status + ;; + *) + echo "" + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" + echo "" + exit 1 + ;; +esac + +exit 0 +