3 # Copyright 1998 VMware, Inc. All rights reserved.
6 # vmware: Manages the services needed to run VMware software
8 # description: Manages the services needed to run VMware software
16 . /etc/rc.d/init.d/functions
19 # Create a temporary directory
22 # They are a lot of small utility programs to create temporary files in a
23 # secure way, but none of them is standard. So I wrote this --hpreg
25 local dirname="$1" # OUT
26 local prefix="$2" # IN
33 # Don't overwrite existing user data
34 # -> Create a directory with a name that didn't exist before
36 # This may never succeed (if we are racing with a malicious process), but at
40 while [ "$loop" = 'yes' ]; do
41 # Check the validity of the temporary directory. We do this in the loop
42 # because it can change over time
43 if [ ! -d "$tmp" ]; then
44 echo 'Error: "'"$tmp"'" is not a directory.'
48 if [ ! -w "$tmp" -o ! -x "$tmp" ]; then
49 echo 'Error: "'"$tmp"'" should be writable and executable.'
55 # -> Don't give write access to other users (so that they can not use this
56 # directory to launch a symlink attack)
57 if mkdir -m 0755 "$tmp"'/'"$prefix$serial" >/dev/null 2>&1; then
60 serial=`expr "$serial" + 1`
61 if [ "`expr "$serial" % 200`" = '0' ]; then
62 echo 'Warning: The "'"$tmp"'" directory may be under attack.'
68 eval "$dirname"'="$tmp"'"'"'/'"'"'"$prefix$serial"'
71 # END_OF_TMPDIR_DOT_SH
73 vmware_etc_dir=/etc/vmware
76 # From now on, this is a normal startup script. I swear.
79 # Since this script is installed, our main database should be installed too and
80 # should contain the basic information
81 vmware_db="$vmware_etc_dir"/locations
82 if [ ! -r "$vmware_db" ]; then
83 echo 'Warning: Unable to find '"`vmware_product_name`""'"'s main database '"$vmware_db"'.'
89 # BEGINNING_OF_DB_DOT_SH
92 # Manage an installer database
95 # Add an answer to a database in memory
97 local dbvar="$1" # IN/OUT
103 eval "$dbvar"'_answer_'"$id"'="$value"'
105 eval 'answers="$'"$dbvar"'_answers"'
106 # There is no double quote around $answers on purpose
107 for i in $answers; do
108 if [ "$i" = "$id" ]; then
112 answers="$answers"' '"$id"
113 eval "$dbvar"'_answers="$answers"'
116 # Remove an answer from a database in memory
118 local dbvar="$1" # IN/OUT
124 eval 'unset '"$dbvar"'_answer_'"$id"
127 eval 'answers="$'"$dbvar"'_answers"'
128 # There is no double quote around $answers on purpose
129 for i in $answers; do
130 if [ "$i" != "$id" ]; then
131 new_answers="$new_answers"' '"$i"
134 eval "$dbvar"'_answers="$new_answers"'
137 # Load all answers from a database on stdin to memory (<dbvar>_answer_*
139 db_load_from_stdin() {
140 local dbvar="$1" # OUT
142 eval "$dbvar"'_answers=""'
144 # read doesn't support -r on FreeBSD 3.x.
145 # For this reason, the folowing line is patched to remove the -r in case of
146 # Free BSD tools build. Please look at
147 # bora-vmsoft/install/FreeBSD/tools-tar.make before making drastic changes to
150 while read -r action p1 p2; do
151 if [ "$action" = 'answer' ]; then
152 db_answer_add "$dbvar" "$p1" "$p2"
153 elif [ "$action" = 'remove_answer' ]; then
154 db_answer_remove "$dbvar" "$p1"
159 # Load all answers from a database on disk to memory (<dbvar>_answer_*
162 local dbvar="$1" # OUT
163 local dbfile="$2" # IN
165 db_load_from_stdin "$dbvar" < "$dbfile"
168 # Iterate through all answers in a database in memory, calling <func> with
169 # id/value pairs and the remaining arguments to this function
171 local dbvar="$1" # IN
178 eval 'answers="$'"$dbvar"'_answers"'
179 # There is no double quote around $answers on purpose
180 for i in $answers; do
181 eval 'value="$'"$dbvar"'_answer_'"$i"'"'
182 "$func" "$i" "$value" "$@"
186 # If it exists in memory, remove an answer from a database (disk and memory)
188 local dbvar="$1" # IN/OUT
189 local dbfile="$2" # IN
194 eval 'answers="$'"$dbvar"'_answers"'
195 # There is no double quote around $answers on purpose
196 for i in $answers; do
197 if [ "$i" = "$id" ]; then
198 echo 'remove_answer '"$id" >> "$dbfile"
199 db_answer_remove "$dbvar" "$id"
205 # Add an answer to a database (disk and memory)
207 local dbvar="$1" # IN/OUT
208 local dbfile="$2" # IN
210 local value="$4" # IN
212 db_remove_answer "$dbvar" "$dbfile" "$id"
213 echo 'answer '"$id"' '"$value" >> "$dbfile"
214 db_answer_add "$dbvar" "$id" "$value"
217 # Add a file to a database on disk
218 # 'file' is the file to put in the database (it may not exist on the disk)
219 # 'tsfile' is the file to get the timestamp from, '' if no timestamp
221 local dbfile="$1" # IN
223 local tsfile="$3" # IN
226 if [ "$tsfile" = '' ]; then
227 echo 'file '"$file" >> "$dbfile"
229 date=`date -r "$tsfile" '+%s' 2> /dev/null`
230 if [ "$date" != '' ]; then
233 echo 'file '"$file$date" >> "$dbfile"
237 # Add a directory to a database on disk
239 local dbfile="$1" # IN
242 echo 'directory '"$dir" >> "$dbfile"
246 db_load 'vmdb' "$vmware_db"
248 # This comment is a hack to prevent RedHat distributions from outputing
249 # "Starting <basename of this script>" when running this startup script.
250 # We just need to write the word daemon followed by a space --hpreg.
252 # This defines echo_success() and echo_failure() on RedHat
253 if [ -r "$vmdb_answer_INITSCRIPTSDIR"'/functions' ]; then
254 . "$vmdb_answer_INITSCRIPTSDIR"'/functions'
257 # This defines $rc_done and $rc_failed on S.u.S.E.
258 if [ -f /etc/rc.config ]; then
259 # Don't include the entire file: there could be conflicts
260 rc_done=`(. /etc/rc.config; echo "$rc_done")`
261 rc_failed=`(. /etc/rc.config; echo "$rc_failed")`
263 # Make sure the ESC byte is literal: Ash does not support echo -e
264 rc_done='
\e[71G done'
265 rc_failed='
\e[71Gfailed'
274 netifup=vmnet-netifup
284 # BEGINNING_OF_IPV4_DOT_SH
287 # IPv4 address functions
289 # Thanks to Owen DeLong <owen@delong.com> for pointing me at bash's arithmetic
290 # expansion ability, which is a lot faster than using 'expr' --hpreg
293 # Compute the subnet address associated to a couple IP/netmask
298 # Split quad-dotted addresses into bytes
299 # There is no double quote around the back-quoted expression on purpose
300 # There is no double quote around $ip and $netmask on purpose
301 set -- `IFS='.'; echo $ip $netmask`
303 echo $(($1 & $5)).$(($2 & $6)).$(($3 & $7)).$(($4 & $8))
306 # Compute the broadcast address associated to a couple IP/netmask
311 # Split quad-dotted addresses into bytes
312 # There is no double quote around the back-quoted expression on purpose
313 # There is no double quote around $ip and $netmask on purpose
314 set -- `IFS='.'; echo $ip $netmask`
316 echo $(($1 | (255 - $5))).$(($2 | (255 - $6))).$(($3 | (255 - $7))).$(($4 | (255 - $8)))
321 # Are we running in a VM?
323 "$vmware_etc_dir"/checkvm >/dev/null 2>&1
326 # This is a function in case a future product name contains language-specific
328 vmware_product_name() {
329 echo 'VMware Workstation'
335 # Count the number of running virtual machines
336 # by looking at the number of references to the
340 # Beware of module dependancies here. An exact match is important
341 /sbin/lsmod | awk 'BEGIN {n = 0;} {if ($1 == "'"$driver"'") n = $3;} END {print n;}'
344 # Is a given module loaded?
348 /sbin/lsmod | awk 'BEGIN {n = "no";} {if ($1 == "'"$module"'") n = "yes";} END {print n;}'
351 # Check if there is an IP route for a given subnet via a given interface
352 # Return true if there is _NO_ such route
354 local subnet="$1" # IN
357 # Beware, there may be several identical routes
358 [ "`/sbin/route -n | grep '^'"$subnet"'.*'"$intf"'$'`" = '' ]
362 # Check that the IP address we are going to assign to the host machine on
363 # a private IP network does not already exist
365 # NB: If you don't want to do this test, just substitute
368 lookForHostOnlyNetwork() {
371 "$vmdb_answer_BINDIR"/"$ping" -q "$ip"
374 # Build a Linux kernel integer version
375 kernel_version_integer() {
376 echo $(((($1 * 256) + $2) * 256 + $3))
379 # Get the running kernel integer version
380 get_version_integer() {
386 version_uts=`uname -r`
388 # There is no double quote around the back-quoted expression on purpose
389 # There is no double quote around $version_uts on purpose
390 set -- `IFS='.'; echo $version_uts`
394 # There is no double quote around the back-quoted expression on purpose
395 # There is no double quote around $v3 on purpose
396 set -- `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v3`
399 kernel_version_integer "$v1" "$v2" "$v3"
402 # Do we need the ppuser module?
404 local version_integer
406 version_integer=`get_version_integer`
407 echo $(((`kernel_version_integer '2' '1' '127'` <= $version_integer) && ($version_integer <= `kernel_version_integer '2' '3' '9'`)))
411 if [ "`type -t 'echo_failure' 2>/dev/null`" = 'function' ]; then
419 if [ "`type -t 'echo_success' 2>/dev/null`" = 'function' ]; then
434 # On Caldera 2.2, SIGHUP is sent to all our children when this script exits
435 # I wanted to use shopt -u huponexit instead but their bash version
436 # 1.14.7(1) is too old
438 # Ksh does not recognize the SIG prefix in front of a signal name
439 if [ "$VMWARE_DEBUG" = 'yes' ]; then
440 (trap '' HUP; "$func" "$@")
442 (trap '' HUP; "$func" "$@") >/dev/null 2>&1
444 if [ "$?" -gt 0 ]; then
455 # Execute a macro in the background
461 if [ "$VMWARE_DEBUG" = 'yes' ]; then
462 # Force synchronism when debugging
463 vmware_exec "$msg" "$func" "$@"
465 echo -n ' '"$msg"' (background)'
467 # On Caldera 2.2, SIGHUP is sent to all our children when this script exits
468 # I wanted to use shopt -u huponexit instead but their bash version
469 # 1.14.7(1) is too old
471 # Ksh does not recognize the SIG prefix in front of a signal name
472 (trap '' HUP; "$func" "$@") 2>&1 | logger -t 'VMware[init]' -p daemon.err &
484 # . Each daemon must be started from its own directory to avoid busy devices
485 # . Each PID file doesn't need to be added to the installer database, because
486 # it is going to be automatically removed when it becomes stale (after a
487 # reboot). It must go directly under /var/run, or some distributions
488 # (RedHat 6.0) won't clean it
491 # Terminate a process synchronously
492 vmware_synchrone_kill() {
494 local signal="$2" # IN
497 kill -"$signal" "$pid"
499 # Wait a bit to see if the dirty job has really been done
500 for second in 0 1 2 3 4 5 6 7 8 9 10; do
501 if [ ! -d /proc/"$pid" ]; then
513 # Kill the process associated to a pidfile
514 vmware_stop_pidfile() {
515 local pidfile="$1" # IN
518 pid=`cat "$pidfile" 2>/dev/null`
519 if [ "$pid" = '' ]; then
520 # The file probably does not exist or is empty. Success
523 # Keep only the first number we find, because some Samba pid files are really
524 # trashy: they end with NUL characters
525 # There is no double quote around $pid on purpose
529 # First try a nice SIGTERM
530 if vmware_synchrone_kill "$pid" 15; then
534 # Then send a strong SIGKILL
535 if vmware_synchrone_kill "$pid" 9; then
542 vmware_load_module() {
543 # /sbin/insmod -s -f "/lib/modules/`uname -r`/misc/$1.o" || exit 1
544 /sbin/modprobe $1 || exit 1
548 vmware_unload_module() {
549 if [ "`isLoaded "$1"`" = 'yes' ]; then
550 /sbin/rmmod "$1" || exit 1
555 # Start the virtual machine monitor kernel service
556 vmware_start_vmmon() {
557 vmware_load_module $driver
560 # Stop the virtual machine monitor kernel service
561 vmware_stop_vmmon() {
562 vmware_unload_module $driver
565 # Start the virtual machine parallel port kernel service
566 vmware_start_vmppuser() {
567 if ! grep -q ' parport_release[^'$'\t'']*$' /proc/ksyms; then
568 # parport support is not built in the kernel
569 /sbin/modprobe parport || exit 1
571 if ! grep -q ' parport_pc_[^'$'\t'']*$' /proc/ksyms; then
572 # parport_pc support is not built in the kernel
573 /sbin/modprobe parport_pc || exit 1
575 vmware_load_module $ppuser
578 # Stop the virtual machine parallel port kernel service
579 vmware_stop_vmppuser() {
580 if [ "`isLoaded "$ppuser"`" = 'yes' ]; then
581 /sbin/rmmod "$ppuser" || exit 1
583 # Try to unload the modules. Failure is allowed because some other process
584 # could be using them.
585 /sbin/modprobe -r parport_pc
586 /sbin/modprobe -r parport
588 # Return the right exitcode even if the previous commands failed
592 # Start the virtual ethernet kernel service
593 vmware_start_vmnet() {
594 vmware_load_module $vnet
597 # Stop the virtual ethernet kernel service
598 vmware_stop_vmnet() {
599 vmware_unload_module $vnet
602 # Create a virtual host ethernet interface and connect it to a virtual
604 vmware_start_netifup() {
605 local vHostIf="$1" # IN
606 local vHubNr="$2" # IN
608 cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$netifup" \
609 -d /var/run/"$netifup"-"$vHostIf".pid /dev/vmnet"$vHubNr" "$vHostIf"
612 # Disconnect a virtual host ethernet interface from a virtual ethernet hub
613 # and destroy the virtual host ethernet interface
614 vmware_stop_netifup() {
615 local vHostIf="$1" # IN
617 vmware_stop_pidfile /var/run/"$netifup"-"$vHostIf".pid
620 # Connect a physical host ethernet interface to a virtual ethernet hub
621 vmware_start_bridge() {
622 local vHubNr="$1" # IN
623 local pHostIf="$2" # IN
625 cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$bridge" \
626 -d /var/run/"$bridge"-"$vHubNr".pid /dev/vmnet"$vHubNr" "$pHostIf"
629 # Disconnect a physical host ethernet interface from a virtual ethernet hub
630 vmware_stop_bridge() {
631 local vHubNr="$1" # IN
633 vmware_stop_pidfile /var/run/"$bridge"-"$vHubNr".pid
636 # Start a SMB name server on a private IP network
637 vmware_start_nmbd() {
638 local vHostIf="$1" # IN
640 # Disable logging to avoid the uncontrolled creation of unmanaged files
641 cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$nmbd" -D -l /dev/null \
642 -s "$vmware_etc_dir"/"$vHostIf"/smb/smb.conf \
643 -f /var/run/"$nmbd"-"$vHostIf".pid
646 # Stop a SMB name server on a private IP network
648 local vHostIf="$1" # IN
650 vmware_stop_pidfile /var/run/"$nmbd"-"$vHostIf".pid
653 # Start a SMB share server on a private IP network
654 vmware_start_smbd() {
655 local vHostIf="$1" # IN
657 # Disable logging to avoid the uncontrolled creation of unmanaged files
658 cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$smbd" -D -l /dev/null \
659 -s "$vmware_etc_dir"/"$vHostIf"/smb/smb.conf \
660 -f /var/run/"$smbd"-"$vHostIf".pid
663 # Stop a SMB share server on a private IP network
665 local vHostIf="$1" # IN
667 vmware_stop_pidfile /var/run/"$smbd"-"$vHostIf".pid
670 # Start a DHCP server on a private IP network
671 vmware_start_dhcpd() {
672 local vHostIf="$1" # IN
674 # The daemon already logs its output in the system log, so we can safely
676 cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$dhcpd" \
677 -cf "$vmware_etc_dir"/"$vHostIf"/dhcpd/dhcpd.conf \
678 -lf "$vmware_etc_dir"/"$vHostIf"/dhcpd/dhcpd.leases \
679 -pf /var/run/"$dhcpd"-"$vHostIf".pid "$vHostIf" >/dev/null 2>&1
682 # Stop a DHCP server on a private IP network
683 vmware_stop_dhcpd() {
684 local vHostIf="$1" # IN
686 vmware_stop_pidfile /var/run/"$dhcpd"-"$vHostIf".pid
689 # Start the host-only network user service
690 vmware_start_hostonly() {
691 local vHubNr="$1" # IN
692 local vHostIf="$2" # IN
694 local ifMask="$4" # IN
695 local run_dhcpd="$5" # IN
696 local run_samba="$6" # IN
700 # Do a cursory check to see if the host-only network
701 # configuration is still ok. We do this so that mobile
702 # hosts don't get setup at install time and then moved to
703 # a new locale where the host-only network config is no
706 # NB: This really needs to be done at power-on time when
707 # VM is configured to use host-only networking so that
708 # we aren't fooled by dynamic changes in the network.
710 # XXX ping takes 10 seconds to timeout if nobody answers
711 # that slows boot too much so we do this bit in the
714 if lookForHostOnlyNetwork "$ifIp"; then
715 echo 'Host-only networking disabled because '"$ifIp"
716 echo 'appears to be a real, physical, existing address.'
717 echo 'Please run "'"$vmdb_answer_BINDIR"'/vmware-config.pl" to'
718 echo 'modify your host-only network configuration.'
722 vmware_start_netifup "$vHostIf" "$vHubNr" || exit 1
724 # Configure the virtual host ethernet interface and define the private IP
727 # . We provide the broadcast address explicitly because versions of ifconfig
728 # prior to 1.39 (1999-03-18) seem to miscompute it
729 # . 2.0.x kernels don't install a route when the interface is marked up, but
730 # 2.2.x kernel do. Since we want to see any errors from route we don't
731 # just discard messages from route, but instead check if the route got
732 # installed before manually adding one.
733 ifNet=`ipv4_subnet "$ifIp" "$ifMask"`
734 if ifconfig "$vHostIf" inet "$ifIp" netmask "$ifMask" \
735 broadcast "`ipv4_broadcast "$ifIp" "$ifMask"`" up \
736 && noRoutePresent "$ifNet" "$vHostIf"; then
737 route add -net "$ifNet" netmask "$ifMask" "$vHostIf"
740 if [ "$run_dhcpd" = 'yes' ]; then
741 vmware_start_dhcpd "$vHostIf" || exit 1
744 if [ "$run_samba" = 'yes' ]; then
745 vmware_start_nmbd "$vHostIf" || exit 1
746 vmware_start_smbd "$vHostIf" || exit 1
752 # Stop the host-only network user service
753 vmware_stop_hostonly() {
754 local vHostIf="$1" # IN
756 local ifMask="$3" # IN
759 # Terminate the private network
760 ifNet=`ipv4_subnet "$ifIp" "$ifMask"`
761 noRoutePresent "$ifNet" "$vHostIf" \
762 || route del -net "$ifNet" netmask "$ifMask" || exit 1
763 # To test if the interface exists, we can not just look at the exitcode
764 # because old versions of ifconfig don't exit with 1 when invoked with a
765 # non-existing interface
766 if [ "`ifconfig "$vHostIf" 2>/dev/null`" != '' ]; then
767 ifconfig "$vHostIf" down || exit 1
770 vmware_stop_netifup "$vHostIf" || exit 1
775 # Start the NAT network user service
777 local vHubNr="$1" # IN
779 cd "$vmdb_answer_BINDIR" && "$vmdb_answer_BINDIR"/"$natd" \
780 -d /var/run/"$natd"-"$vHubNr".pid \
781 -m /var/run/"$natd"-"$vHubNr".mac \
782 -c "$vmware_etc_dir"/vmnet"$vHubNr"/nat/nat.conf
785 # Stop the NAT network user service
787 local vHubNr="$1" # IN
789 vmware_stop_pidfile /var/run/"$natd"-"$vHubNr".pid
792 # See how we were called.
795 if [ -e "$vmware_etc_dir"/not_configured ]; then
796 echo "`vmware_product_name`"' is installed, but it has not been (correctly) configured'
797 echo 'for the running kernel. To (re-)configure it, invoke the'
798 echo 'following command: '"$vmdb_answer_BINDIR"'/vmware-config.pl.'
805 # Refuse to start services in a VM: they are useless
809 echo 'Starting VMware services:'
812 vmware_exec 'Virtual machine monitor' vmware_start_vmmon
813 exitcode=`expr "$exitcode" + "$?"`
815 if [ "`isPpuserNeeded`" = '1' ]; then
816 vmware_exec 'Virtual bidirectional parallel port' \
817 vmware_start_vmppuser
818 exitcode=`expr "$exitcode" + "$?"`
820 # Try to load parport_pc. Failure is allowed as it does not exist
822 /sbin/modprobe parport_pc >/dev/null 2>&1
825 if [ "$vmdb_answer_NETWORKING" = 'yes' ]; then
826 msg_starting 'Virtual ethernet'
829 exitcode=`expr "$exitcode" + "$?"`
833 while [ $vHubNr -lt 256 ]; do
834 eval 'interface="$vmdb_answer_VNET_'"$vHubNr"'_INTERFACE"'
835 eval 'hostaddr="$vmdb_answer_VNET_'"$vHubNr"'_HOSTONLY_HOSTADDR"'
836 eval 'netmask="$vmdb_answer_VNET_'"$vHubNr"'_HOSTONLY_NETMASK"'
837 if [ -n "$interface" ]; then
838 vmware_exec 'Bridged networking on /dev/vmnet'"$vHubNr" \
839 vmware_start_bridge "$vHubNr" "$interface"
840 exitcode=`expr "$exitcode" + "$?"`
841 elif [ -n "$hostaddr" -a -n "$netmask" ]; then
842 eval 'samba="$vmdb_answer_VNET_'"$vHubNr"'_SAMBA"'
843 vmware_bg_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
844 vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" \
845 "$hostaddr" "$netmask" 'yes' "$samba"
846 exitcode=`expr "$exitcode" + "$?"`
848 eval 'nat="$vmdb_answer_VNET_'"$vHubNr"'_NAT"'
849 if [ "$nat" = 'yes' ]; then
850 vmware_exec 'NAT networking on /dev/vmnet'"$vHubNr" \
851 vmware_start_nat "$vHubNr"
852 exitcode=`expr "$exitcode" + "$?"`
855 vHubNr=`expr $vHubNr + 1`
860 if [ "$exitcode" -gt 0 ]; then
861 # Set the 'not configured' flag
862 touch "$vmware_etc_dir"'/not_configured'
863 chmod 644 "$vmware_etc_dir"'/not_configured'
864 db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \
865 "$vmware_etc_dir"'/not_configured'
869 [ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys
870 touch /var/lock/subsys/"$subsys"
874 if [ "`countVMs`" -gt 0 ]; then
875 echo 'At least one instance of '"`vmware_product_name`"' is still running. Please stop all running'
876 echo 'instances of '"`vmware_product_name`"' first.'
879 # The unconfigurator handle this exit code differently
883 echo 'Stopping VMware services:'
886 vmware_exec 'Virtual machine monitor' vmware_stop_vmmon
887 exitcode=`expr "$exitcode" + "$?"`
889 if [ "`isPpuserNeeded`" = '1' ]; then
890 vmware_exec 'Virtual bidirectional parallel port' \
892 exitcode=`expr "$exitcode" + "$?"`
894 # Try to unload parport_pc. Failure is allowed as it does not exist
895 # on kernels 2.0, and some other process could be using it.
896 /sbin/modprobe -r parport_pc >/dev/null 2>&1
899 if [ "$vmdb_answer_NETWORKING" = "yes" ]; then
900 # NB: must kill off processes using vmnet before
903 while [ $vHubNr -lt 256 ]; do
904 eval 'interface="$vmdb_answer_VNET_'"$vHubNr"'_INTERFACE"'
905 eval 'hostaddr="$vmdb_answer_VNET_'"$vHubNr"'_HOSTONLY_HOSTADDR"'
906 eval 'netmask="$vmdb_answer_VNET_'"$vHubNr"'_HOSTONLY_NETMASK"'
907 if [ -n "$interface" ]; then
908 vmware_exec "Bridged networking on /dev/vmnet$vHubNr" vmware_stop_bridge "$vHubNr"
909 exitcode=`expr "$exitcode" + "$?"`
910 elif [ -n "$hostaddr" -a -n "$netmask" ]; then
911 vmware_exec "DHCP server on /dev/vmnet$vHubNr" vmware_stop_dhcpd \
913 exitcode=`expr "$exitcode" + "$?"`
915 eval 'samba="$vmdb_answer_VNET_'"$vHubNr"'_SAMBA"'
916 if [ "$samba" = "yes" ]; then
917 vmware_exec 'SMB share server on /dev/vmnet'"$vHubNr" \
918 vmware_stop_smbd 'vmnet'"$vHubNr"
919 exitcode=`expr "$exitcode" + "$?"`
921 vmware_exec 'SMB name server on /dev/vmnet'"$vHubNr" \
922 vmware_stop_nmbd 'vmnet'"$vHubNr"
923 exitcode=`expr "$exitcode" + "$?"`
926 eval 'nat="$vmdb_answer_VNET_'"$vHubNr"'_NAT"'
927 if [ "$nat" = "yes" ]; then
928 vmware_exec 'NAT networking on /dev/vmnet'"$vHubNr" \
929 vmware_stop_nat "$vHubNr"
930 exitcode=`expr "$exitcode" + "$?"`
933 vmware_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
934 vmware_stop_hostonly 'vmnet'"$vHubNr" "$hostaddr" "$netmask"
937 vHubNr=`expr $vHubNr + 1`
940 vmware_exec 'Virtual ethernet' vmware_stop_vmnet
941 exitcode=`expr "$exitcode" + "$?"`
944 if [ "$exitcode" -gt 0 ]; then
948 rm -f /var/lock/subsys/"$subsys"
952 if [ "`countVMs`" -gt 0 ]; then
953 echo 'At least one instance of '"`vmware_product_name`"' is still running.'
957 if [ "$vmdb_answer_NETWORKING" = "yes" ]; then
963 echo -n "Module $driver "
964 /sbin/modprobe "$driver" >/dev/null 2>&1 && echo installed || echo "not installed"
965 if [ "`isPpuserNeeded`" = '1' ]; then
966 echo -n "Module $ppuser "
967 /sbin/modprobe "$ppuser" >/dev/null 2>&1 && echo installed || echo "not installed"
969 if [ "$vmdb_answer_NETWORKING" = "yes" ]; then
970 echo -n "Module $vnet "
971 /sbin/modprobe "$vnet" >/dev/null 2>&1 && echo installed || echo "not installed"
976 "$0" stop && "$0" start
980 echo "Usage: `basename "$0"` {start|stop|status|restart}"