File openais-init.diff of Package openais

Implement SBD support in the init script.

Fix some init script dependencies.

Index: openais/init/generic
===================================================================
--- openais.orig/init/generic
+++ openais/init/generic
@@ -10,22 +10,47 @@
 # description:  OpenAIS daemon
 #
 ### BEGIN INIT INFO
-# Description: openais....
+# Description: Manages the openAIS cluster services.
 #
 # Short-Description: openais cluster services.
 # Provides: openais
 # Required-Start: $network
-# Should-Start: $syslog
+# Should-Start: $syslog sshd drbd $named $remote_fs logd
 # Required-Stop: $network
 # Default-Start: 3 5
 # Default-Stop: 0 6
-# Should-Stop: $null
+# Should-Stop: logd drbd $syslog $named
 ### END INIT INFO
 
 do_force=0
 prog="aisexec"
 lockfile="/var/lock/subsys/$prog"
 
+SBD_CONFIG=/etc/sysconfig/sbd
+if [ -f $SBD_CONFIG ]; then
+        . $SBD_CONFIG
+fi
+
+StartSBD() {
+        if [ -n "$SBD_DEVICE" ]; then
+		echo -n "Starting SBD - "
+                if ! sbd -d $SBD_DEVICE -D $SBD_OPTS watch ; then
+			echo "SBD failed to start; aborting."
+			exit 1
+                fi
+        fi
+}
+
+StopSBD() {
+        if [ -n "$SBD_DEVICE" ]; then
+		echo -n "Stopping SBD - "
+                if ! sbd -d $SBD_DEVICE -D $SBD_OPTS message LOCAL exit ; then
+			echo "SBD failed to stop; aborting."
+			exit 1
+                fi
+        fi
+}
+
 internal_status() {
     killall -0 aisexec > /dev/null 2>&1
     return $?
@@ -48,6 +73,7 @@ start() {
     if 
 	! internal_status
     then
+	StartSBD
 	echo -n "starting... "
 	$prog 2>&1 > /dev/null 2>&1
 	echo -n "rc=$?: "
@@ -83,6 +109,7 @@ stop() {
 		echo -n "."
 	    else
 		rm -f "$lockfile"
+		StopSBD
 		echo "OK"
 		return 0
 	    fi
@@ -112,6 +139,8 @@ stop() {
 	sleep 1
 	echo -n "."
     done
+
+    StopSBD
     
     rm -f "$lockfile"
     echo "OK"
openSUSE Build Service is sponsored by