From: VMware, Inc <> Date: Tue, 13 Mar 2012 20:06:05 +0000 (-0700) Subject: Using service name from find_networking_script for Sysv 'service' command. X-Git-Tag: 2012.03.13-651368~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7404879edbe39b9af9148206ea3b346e1d03bdc2;p=thirdparty%2Fopen-vm-tools.git Using service name from find_networking_script for Sysv 'service' command. Directly runing init script to start network service fails on distros like OpenSuse 12.1. so we need to first try Sysv's 'service'. The currently approach of finding network service name with 'service status xxx' will fail when network service is down (return 3), as a result, suspend vm will fail. This patch fixes the issue by using the network service name returned from find_networking_script, thus avoided 'service status xxx' command. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/scripts/linux/network b/open-vm-tools/scripts/linux/network index bbdfbcba6..1d8100bbc 100644 --- a/open-vm-tools/scripts/linux/network +++ b/open-vm-tools/scripts/linux/network @@ -87,29 +87,17 @@ find_networking_script() { # run_network_script() { - # Do we have SysV "service"? If we do, check whether the network service - # is called "network" or "networking". - service=`which service 2>/dev/null` - serviceName= - if [ $? = 0 -a -n "$service" ]; then - if $service network status 1>/dev/null 2>/dev/null; then - serviceName=network - elif $service networking status 1>/dev/null 2>/dev/null; then - serviceName=networking - fi - fi - - if [ -n "$serviceName" ]; then - $service $serviceName $1 - return $? - fi - - # If we failed to detect things using the "service" way, fall back to - # brute force. script=`find_networking_script` [ "$script" != "error" ] || Panic "Cannot find system networking script." - "$script" $1 + # Using SysV "service" if it exists, otherwise fall back to run the script directly + service=`which service 2>/dev/null` + if [ $? = 0 -a -n "$service" ]; then + serviceName=`basename "$script"` + "$service" "$serviceName" "$1" + else + "$script" "$1" + fi }