blob: 41360bb3781bd2b3c8d43d8d86a211a71146a283 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#!/bin/sh
# Copyright (c) 2009 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# §filename§
# - §desc§
# §generated§
# -----------------------------------------------------------------------------
export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/openslx/usr/sbin
#functions: helper functions
tempdir () {
# Create a special tempfs directory
mkdir -m 1777 -p /tmp/vmware
# Don't mount special tempfs, when using local harddrive for /tmp
[ ! -n "$(cat /proc/mounts |grep ' /tmp '|grep '/dev/sd')" ] \
&& mount -t tmpfs -o size=180%,mode=1777 tmpfs /tmp/vmware
}
load_modules () {
# VMplayer common stuff
insmod /lib/modules/vmware/vmmon.ko || return 1
insmod /lib/modules/vmware/vmnet.ko || return 1
# VMplayer 3.X specific stuff
insmod /lib/modules/vmware/vmci.ko
insmod /lib/modules/vmware/vmblock.ko
insmod /lib/modules/vmware/vsock.ko
}
unload_modules () {
rmmod vmnet vmmonvsock vmci vmblock 2>/dev/null
}
vmnetif () {
# let point the path directly to the directory where the binary lives
location="/usr/bin"
if [ -n "$vmnet0" ] ; then
# the path might be directly point to the plugin dir
$location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0
fi
if [ -n "$vmnet1" ] ; then
$location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \
/dev/vmnet1 vmnet1
ip addr add $vmnet1 dev vmnet1
ip link set vmnet1 up
if [ -n "$vmnet1nat" ] ; then
echo "1" >/proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null
echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
fi
/opt/openslx/usr/sbin/udhcpd \
-S /etc/vmware/udhcpd/udhcpd-vmnet1.conf
fi
if [ -n "$vmnet8" ] ; then
$location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet8.pid \
/dev/vmnet8 vmnet8
ip addr add $vmnet8 dev vmnet8
ip link set vmnet8 up
echo "1" >/proc/sys/net/ipv4/conf/vmnet8/forwarding 2>/dev/null
echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
# TODO: iptables in stage32?
# iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
# /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50
$location/vmnet-natd -d /var/run/vmnet-natd-8.pid \
-m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf 2>/dev/null # or logfile
/opt/openslx/usr/sbin/udhcpd \
-S /etc/vmware/udhcpd/udhcpd-vmnet8.conf
fi
}
vmblock () {
# let point the path directly to the directory where the binary lives
# TODO: get it to work
/usr/bin/vmware-usbarbitrator
}
case "$1" in
start)
#start: defines start function for initscript
# load the configuration file
. /etc/openslx/vmware/vmware.conf
# hack to access the first serial/parallel port
chmod a+rw /dev/ttyS0
chmod a+rw /dev/parport0
tempdir
load_modules
vmnetif
# vmblock
;;
stop)
#stop: defines stop function for initscript
killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \
vmware-tray vmnet-dhcpd 2>/dev/null
# might take a while until all services are shut down
sleep 1
umount -l /tmp/vmware 2>/dev/null
unload_modules
;;
restart)
#restart: defines restart function for initscript
$0 stop && $0 start
;;
status)
#status: defines status function for initscript
vmstatus
;;
*)
#usage: defines usage function for initscript
## print out usage
echo "Usage: $0 {start, stop, restart, status}" >&2
exit 1
;;
esac
exit 0
|