cluster: STABLE31 - cman init: fix NetworkManager and distro detection

Fabio M. Di Nitto fabbione at fedoraproject.org
Tue Nov 16 09:05:18 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=27c8333b40ede1e29155774bf9cb7822c9e71f8e
Commit:        27c8333b40ede1e29155774bf9cb7822c9e71f8e
Parent:        368725a9d88c4cb8eb0feee585c6ece51fe09fc8
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Tue Nov 16 10:03:42 2010 +0100
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Tue Nov 16 10:03:42 2010 +0100

cman init: fix NetworkManager and distro detection

This change should finally allow Debian to use our init script almost pristine
and get the script to work on rpm based distro again.

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 cman/init.d/cman.in |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 8314673..33f5428 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -19,7 +19,7 @@
 # set secure PATH
 PATH="/bin:/usr/bin:/sbin:/usr/sbin:@SBINDIR@"
 
-local_chkconfig()
+chkconfig2()
 {
 	case "$1" in
 	--levels)
@@ -61,14 +61,15 @@ if [ -d /etc/sysconfig ]; then
 	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
 	[ -f /etc/sysconfig/cman ] && . /etc/sysconfig/cman
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/cman"
+	netmanager=NetworkManager
 fi
 
 # deb based distros
-if [ -d /etc/default ]; then
+if [ ! -d /etc/sysconfig ]; then
 	[ -f /etc/default/cluster ] && . /etc/default/cluster
 	[ -f /etc/default/cman ] && . /etc/default/cman
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/cman"
-	type chkconfig > /dev/null 2>&1 || alias chkconfig=local_chkconfig
+	netmanager=network-manager
 fi
 
 # CMAN_CLUSTER_TIMEOUT -- amount of time to wait for joinging a cluster
@@ -299,7 +300,7 @@ sshd_enabled()
 network_manager_enabled()
 {
 	if status NetworkManager > /dev/null 2>&1 || \
-	   chkconfig NetworkManager; then
+	   chkconfig2 $netmanager; then
 		errmsg="\nNetwork Manager is either running or configured to run. Please disable it in the cluster."
 		return 1
 	fi
@@ -368,7 +369,7 @@ xend_bridged_net_enabled() {
 	[ -z "$current_runlevel" ] && return 1
 
 	# xend doesn't start at this runlevel.
-	! chkconfig --levels "$current_runlevel" xend 2>/dev/null && return 1
+	! chkconfig2 --levels "$current_runlevel" xend 2>/dev/null && return 1
 
 	# xend isn't configured to use bridged networking.
 	[ ! -f /etc/xen/xend-config.sxp ] && return 1


More information about the cluster-commits mailing list