#
# description: Manages the services needed to run VMware networking
#
-# chkconfig: 5 90 8
+# chkconfig: 235 90 8
#
# probe: true
# hide: true
for f in $vmware_locations $vmnet_cfg; do
if [ -r $f ]; then
. $f
- else
+ else
echo "FATAL: Unable to read $f"
exit 1
fi
-done
+done
# System wide functions
. /etc/rc.d/init.d/functions
+# Create /dev/vmnetXX device
+vmware_create_vmnet() {
+ local vHubNr="$1" # IN
+ local vDevice="/dev/vmnet$vHubNr"
+
+ if [ ! -e "$vDevice" ]; then
+ mknod -m 600 "$vDevice" c 119 "$vHubNr"
+ fi
+}
+
#
# Create a temporary directory
#
start)
if [ -f /var/lock/subsys/"$subsys" ]; then
msg_already_running "VMware Workstation networking"
- fi
+ fi
# Try to load parport_pc. Failure is allowed as it does not exist
# on kernels 2.0
/sbin/modprobe parport_pc >/dev/null 2>&1
+ msg_starting 'Virtual machine monitor'
+ busy
+ /sbin/modprobe $driver
+ [ "$?" -eq "0" ] && ok || fail
if [ "$VM_NETWORKING" = 'yes' ]; then
msg_starting 'Virtual ethernet'
busy
/sbin/modprobe $vnet
[ "$?" -eq 0 ] && ok || fail
vHubNr=0
- while [ $vHubNr -lt 8 ]; do
+ while [ $vHubNr -lt 9 ]; do
eval 'interface="$VNET_'"$vHubNr"'_INTERFACE"'
eval 'hostaddr="$VNET_'"$vHubNr"'_HOSTONLY_HOSTADDR"'
eval 'netmask="$VNET_'"$vHubNr"'_HOSTONLY_NETMASK"'
if [ -n "$interface" ]; then
+ vmware_create_vmnet "$vHubNr"
# Connect a physical host ethernet interface to a virtual ethernet hub
msg_starting 'Bridged networking on /dev/vmnet'"$vHubNr"
busy
-d /var/run/"$bridge"-"$vHubNr".pid /dev/vmnet"$vHubNr" "$interface"
[ "$?" -eq 0 ] && ok || fail
elif [ -n "$hostaddr" -a -n "$netmask" ]; then
+ vmware_create_vmnet "$vHubNr"
eval 'samba="$VNET_'"$vHubNr"'_SAMBA"'
msg_starting 'Host-only networking on /dev/vmnet'"$vHubNr"
busy
- daemon vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" "$hostaddr" \
+ vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" "$hostaddr" \
"$netmask" 'yes' "$samba"
[ "$?" -eq 0 ] && ok || fail
eval 'nat="$VNET_'"$vHubNr"'_NAT"'
cd "$VM_BINDIR" && "$VM_BINDIR"/"$natd" \
-d /var/run/"$natd"-"$vHubNr".pid \
-m /var/run/"$natd"-"$vHubNr".mac \
- -c "$vmware_etc_dir"/vmnet"$vHubNr"/nat/nat.conf
+ -c "$vmware_etc_dir"/vmnet"$vHubNr"/nat/nat.conf >/dev/null 2>&1
[ "$?" -eq 0 ] && ok || fail
fi
fi
fi
if [ ! -f /var/lock/subsys/"$subsys" ]; then
msg_not_running "VMware Workstation networking"
- fi
+ fi
# Try to unload parport_pc. Failure is allowed as it does not exist
# on kernels 2.0, and some other process could be using it.
/sbin/modprobe -r parport_pc >/dev/null 2>&1
# NB: must kill off processes using vmnet before
# unloading module
vHubNr=0
- while [ $vHubNr -lt 8 ]; do
+ while [ $vHubNr -lt 9 ]; do
eval 'interface="$VNET_'"$vHubNr"'_INTERFACE"'
eval 'hostaddr="$VNET_'"$vHubNr"'_HOSTONLY_HOSTADDR"'
eval 'netmask="$VNET_'"$vHubNr"'_HOSTONLY_NETMASK"'
fi
vHubNr=$(($vHubNr + 1))
done
+ msg_stopping 'Virtual machine monitor'
+ busy
+ if /sbin/lsmod | grep -q ^"$driver"; then
+ /sbin/rmmod "$driver"
+ fi
+ [ "$?" -eq "0" ] && ok || fail
msg_stopping 'Virtual ethernet'
busy
if /sbin/lsmod | grep -q ^"$vnet"; then