wok-current rev 18391
Add: WIP open-vm-tools (10.0.0)
author | Nathan Neulinger <nneul@neulinger.org> |
---|---|
date | Fri Sep 18 23:31:50 2015 +0000 (2015-09-18) |
parents | 23f30a856a5b |
children | a4a380229dc9 |
files | open-vm-tools/receipt open-vm-tools/stuff/network open-vm-tools/stuff/vmtoolsd |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/open-vm-tools/receipt Fri Sep 18 23:31:50 2015 +0000 1.3 @@ -0,0 +1,81 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="open-vm-tools" 1.7 +VERSION="10.0.0-3000743" 1.8 +CATEGORY="utilities" 1.9 +TAGS="vmware kernel" 1.10 +SHORT_DESC="Open VMware Tools" 1.11 +MAINTAINER="nobody@slitaz.org" 1.12 +LICENSE="GPL" 1.13 +TARBALL="open-vm-tools-$VERSION.tar.gz" 1.14 +WEB_SITE="https://github.com/vmware/open-vm-tools" 1.15 +WGET_URL="https://github.com/vmware/open-vm-tools/archive/$TARBALL" 1.16 +HOST_ARCH="i486 x86_64" 1.17 + 1.18 +DEPENDS="shutdown glib libffi libmspack" 1.19 +BUILD_DEPENDS="autoconf automake libtool linux-source glib-dev libffi-dev libdnet-dev libmspack-dev slitaz-toolchain" 1.20 + 1.21 + 1.22 +# Rules to configure and make the package. 1.23 +compile_rules() 1.24 +{ 1.25 + [ -d /lib/modules/$(uname -r)/source ] || get-linux-source 1.26 + 1.27 + cd open-vm-tools 1.28 + sed -i -e "s/-Werror//" configure.ac 1.29 + autoreconf -i 1.30 + ./configure \ 1.31 + --with-distro="SliTaz" \ 1.32 + --without-pam \ 1.33 + --without-x \ 1.34 + --without-icu \ 1.35 + --without-gtk2 \ 1.36 + --without-gtkmm \ 1.37 + --without-xmlsecurity \ 1.38 + --without-xerces \ 1.39 + $CONFIGURE_ARGS && 1.40 + make && make DESTDIR=$install install 1.41 +} 1.42 + 1.43 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.44 +genpkg_rules() 1.45 +{ 1.46 + mkdir -p $fs/usr/lib 1.47 + mkdir -p $fs/usr/share 1.48 + mkdir -p $fs/sbin 1.49 + mkdir -p $fs/etc 1.50 + mkdir -p $fs/lib 1.51 + mkdir -p $fs/include 1.52 + mkdir -p $fs/etc/init.d 1.53 + 1.54 + cp $stuff/vmtoolsd $fs/etc/init.d 1.55 + chmod 755 $fs/etc/init.d 1.56 + 1.57 + cp -a $install/etc/vmware-tools $fs/etc 1.58 + 1.59 + # Replace with slitaz customized default network script 1.60 + cp $stuff/network $fs/etc/vmware-tools/scripts/vmware/network 1.61 + chmod 755 $fs/etc/vmware-tools/scripts/vmware/network 1.62 + 1.63 + cp -a $install/sbin $fs/sbin 1.64 + 1.65 + cp -a $install/lib/modules $fs/lib 1.66 + 1.67 + cp -a $install/usr/include $fs/usr 1.68 + cp -a $install/usr/bin $fs/usr 1.69 + cp -a $install/usr/sbin $fs/usr 1.70 + 1.71 + cp -a $install/usr/share/open-vm-tools $fs/usr/share 1.72 + 1.73 + cp -a $install/usr/lib/*.so* $fs/usr/lib 1.74 + cp -a $install/usr/lib/*.a $fs/usr/lib 1.75 + cp -a $install/usr/lib/open-vm-tools $fs/usr/lib 1.76 + cp -a $install/usr/lib/pkgconfig $fs/usr/lib 1.77 +} 1.78 + 1.79 +post_install() 1.80 +{ 1.81 + echo -n "Processing post-install commands..." 1.82 + chroot "$1/" depmod -a 1.83 + status 1.84 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/open-vm-tools/stuff/network Fri Sep 18 23:31:50 2015 +0000 2.3 @@ -0,0 +1,186 @@ 2.4 +#!/bin/sh 2.5 +########################################################## 2.6 +# Copyright (C) 2001-2010 VMware, Inc. All rights reserved. 2.7 +# 2.8 +# This program is free software; you can redistribute it and/or modify it 2.9 +# under the terms of the GNU Lesser General Public License as published 2.10 +# by the Free Software Foundation version 2.1 and no later version. 2.11 +# 2.12 +# This program is distributed in the hope that it will be useful, but 2.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 2.14 +# or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public 2.15 +# License for more details. 2.16 +# 2.17 +# You should have received a copy of the GNU Lesser General Public License 2.18 +# along with this program; if not, write to the Free Software Foundation, Inc., 2.19 +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.20 +# 2.21 +########################################################## 2.22 + 2.23 + 2.24 +# 2.25 +# network (Linux) 2.26 +# 2.27 +# Using a combination of a system networking script, ifconfig, and ifup, 2.28 +# attempt to release and renew DHCP leases upon receipt of suspend and resume 2.29 +# events, respectively. 2.30 +# 2.31 + 2.32 + 2.33 +echo `date` ": Executing '$0'" 2.34 +echo 2.35 + 2.36 +. `dirname "$0"`/../../statechange.subr 2.37 + 2.38 + 2.39 +# 2.40 +# find_networking_script -- 2.41 +# 2.42 +# Searches common Linux distro init/rc paths to find a singular network 2.43 +# services script. 2.44 +# 2.45 +# Result: 2.46 +# Returns a valid networking script path on success or "error" on failure. 2.47 +# 2.48 +# Side effects: 2.49 +# None. 2.50 +# 2.51 + 2.52 +find_networking_script() { 2.53 + echo "network.sh" 2.54 +} 2.55 + 2.56 + 2.57 +# 2.58 +# run_network_script -- 2.59 +# 2.60 +# Finds out how to run the system's script used to control networking, and 2.61 +# runs it with the given argument (which should be one of the usual SysV 2.62 +# init script arguments). 2.63 +# 2.64 +run_network_script() 2.65 +{ 2.66 + script=`find_networking_script` 2.67 + [ "$script" != "error" ] || Panic "Cannot find system networking script." 2.68 + 2.69 + "$script" "$1" 2.70 +} 2.71 + 2.72 + 2.73 +# 2.74 +# save_active_NIC_list -- 2.75 +# 2.76 +# Records a list of every active NIC to /var/run/vmware-active-nics. 2.77 +# 2.78 +# XXX What's the story on aliases? Should they still be included, or will 2.79 +# they be recreated automatically upon resume? 2.80 +# 2.81 +# Results: 2.82 +# $activeList has, one per line, a list of all active NICs. 2.83 +# 2.84 +# Side effects: 2.85 +# None. 2.86 +# 2.87 + 2.88 +save_active_NIC_list() { 2.89 + >$activeList 2.90 + 2.91 + for nic in `ifconfig | awk '/^eth/ { print $1 }'`; do 2.92 + ifconfig $nic | egrep -q '\bUP\b' && echo $nic >> $activeList 2.93 + exitCode=`expr $exitCode \| $?` 2.94 + done 2.95 +} 2.96 + 2.97 + 2.98 +# 2.99 +# rescue_NIC -- 2.100 +# 2.101 +# For each NIC recorded in $activeList that is not currently "up", run 2.102 +# "INTERFACE=$nic network.sh start". 2.103 +# 2.104 +# Results: 2.105 +# All downed NICs should be active. 2.106 +# 2.107 + 2.108 +rescue_NIC() { 2.109 + if [ -f "$activeList" ]; then 2.110 + while read nic; do 2.111 + if ifconfig $nic | egrep -q '\bUP\b'; then 2.112 + echo `date` "[rescue_nic] $nic is already active." 2.113 + else 2.114 + echo `date` "[rescue_nic] activating $nic ..." 2.115 + 2.116 + INTERFACE=$nic /etc/init.d/network.sh start 2.117 + exitCode=`expr $exitCode \| $?` 2.118 + fi 2.119 + done < $activeList 2.120 + 2.121 + rm -f $activeList 2.122 + fi 2.123 +} 2.124 + 2.125 + 2.126 +# 2.127 +# main -- 2.128 +# 2.129 +# Main entry point. Perform some sanity checking, then map state change 2.130 +# events to relevant networking operations. 2.131 +# 2.132 +# Results: 2.133 +# See comment at top of file. 2.134 +# 2.135 + 2.136 +main() { 2.137 + exitCode=0 2.138 + activeList=/var/run/vmware-active-nics 2.139 + 2.140 + # XXX Are these really necessary? If so, we should have seen customer 2.141 + # complaints by now. 2.142 + which ifconfig >/dev/null 2>&1 || Panic "ifconfig not in search path." 2.143 + 2.144 + case "$1" in 2.145 + poweron-vm) 2.146 + rm -f $activeList 2.147 + ;; 2.148 + suspend-vm) 2.149 + exitCode=$? 2.150 + if [ $exitCode != 0 ]; then 2.151 + save_active_NIC_list 2.152 + run_network_script stop 2.153 + exitCode=$? 2.154 + fi 2.155 + ;; 2.156 + resume-vm) 2.157 + WakeNetworkManager 2.158 + exitCode=$? 2.159 + if [ $exitCode != 0 ]; then 2.160 + # According to hfu, "/etc/init.d/networking restart" on Debian 5.0 2.161 + # may bring down ethernet interfaces tagged as "allow-hotplug" without 2.162 + # bringing them back up. 2.163 + # 2.164 + # This is especially a problem when reverting to a live, running 2.165 + # VM snapshot where an active NIC list hadn't yet been generated, 2.166 + # resulting in sudden loss of an otherwise operational NIC. 2.167 + # 2.168 + # So, if the active list doesn't exist, assume we're coming back to 2.169 + # a live snapshot and capture the current active list now for 2.170 + # rescue later. 2.171 + if [ ! -s $activeList ]; then 2.172 + save_active_NIC_list 2.173 + fi 2.174 + 2.175 + # We shall use start not restart here. Otherwise we may not be able 2.176 + # to bring back active list on distros like sles11sp2 2.177 + # -- PR 816791 2.178 + run_network_script start 2.179 + rescue_NIC 2.180 + exitCode=$? 2.181 + fi 2.182 + ;; 2.183 + *) ;; 2.184 + esac 2.185 + 2.186 + return $exitCode 2.187 +} 2.188 + 2.189 +main "$@"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/open-vm-tools/stuff/vmtoolsd Fri Sep 18 23:31:50 2015 +0000 3.3 @@ -0,0 +1,61 @@ 3.4 +#!/bin/sh 3.5 +# /etc/init.d/vmtoolsd : Start, stop and restart Open VM Tools daemon on SliTaz, at 3.6 +# boot time or with the command line. 3.7 +# 3.8 +# To start VMTools daemon at boot time, just put vmtoolsd in the $RUN_DAEMONS 3.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf 3.10 +# 3.11 +. /etc/init.d/rc.functions 3.12 +. /etc/daemons.conf 3.13 + 3.14 +NAME=VMTools 3.15 +DESC="VMTools" 3.16 +DAEMON=/usr/bin/vmtoolsd 3.17 +PIDFILE=/var/run/vmtoolsd.pid 3.18 +OPTIONS="-b $PIDFILE" 3.19 + 3.20 +case "$1" in 3.21 + start) 3.22 + if active_pidfile $PIDFILE vmtoolsd ; then 3.23 + echo "$NAME already running." 3.24 + exit 1 3.25 + fi 3.26 + echo -n "Starting $DESC: $NAME... " 3.27 + modprobe vmblock 3.28 + modprobe vmhgfs 3.29 + modprobe vmci 3.30 + modprobe vmsync 3.31 + modprobe vsock 3.32 + $DAEMON $OPTIONS 3.33 + status 3.34 + ;; 3.35 + stop) 3.36 + if ! active_pidfile $PIDFILE vmtoolsd ; then 3.37 + echo "$NAME is not running." 3.38 + exit 1 3.39 + fi 3.40 + echo -n "Stopping $DESC: $NAME... " 3.41 + kill `cat $PIDFILE` 3.42 + status 3.43 + ;; 3.44 + restart) 3.45 + if ! active_pidfile $PIDFILE vmtoolsd ; then 3.46 + echo "$NAME is not running." 3.47 + exit 1 3.48 + fi 3.49 + echo -n "Restarting $DESC: $NAME... " 3.50 + kill `cat $PIDFILE` 3.51 + sleep 2 3.52 + $DAEMON $OPTIONS 3.53 + status 3.54 + ;; 3.55 + *) 3.56 + echo "" 3.57 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 3.58 + echo "" 3.59 + exit 1 3.60 + ;; 3.61 +esac 3.62 + 3.63 +exit 0 3.64 +