Hi!

find the diff attached.

Best regards
Frederik Schüler

-- 
ENOSIG
diff -ruN lvm2-2.02.39.old/debian/changelog lvm2-2.02.39/debian/changelog
--- lvm2-2.02.39.old/debian/changelog	2008-07-27 23:08:39.000000000 +0200
+++ lvm2-2.02.39/debian/changelog	2008-07-27 23:07:29.000000000 +0200
@@ -1,3 +1,9 @@
+lvm2 (2.02.39-3) UNRELEASED; urgency=low
+
+  * Add clvm initscript. (closes: #336258)
+
+ -- Frederik Schüler <[EMAIL PROTECTED]>  Sun, 27 Jul 2008 23:07:15 +0200
+
 lvm2 (2.02.39-2) unstable; urgency=low
 
   * Disable readline support in udeb. (closes: #491203)
diff -ruN lvm2-2.02.39.old/debian/clvm.defaults lvm2-2.02.39/debian/clvm.defaults
--- lvm2-2.02.39.old/debian/clvm.defaults	1970-01-01 01:00:00.000000000 +0100
+++ lvm2-2.02.39/debian/clvm.defaults	2008-07-27 23:06:33.000000000 +0200
@@ -0,0 +1,9 @@
+# Bourne shell compatible script, sourced by /etc/init.d/clvm to set
+# additional arguments for clvmd.
+
+# Startup timeout: 
+#CLVMDTIMEOUT=20
+
+# Volume groups to activate on startup:
+# LVM_VGS="cluster_vg1 cluster_vg2"
+
diff -ruN lvm2-2.02.39.old/debian/clvm.init lvm2-2.02.39/debian/clvm.init
--- lvm2-2.02.39.old/debian/clvm.init	1970-01-01 01:00:00.000000000 +0100
+++ lvm2-2.02.39/debian/clvm.init	2008-07-27 23:22:44.000000000 +0200
@@ -0,0 +1,154 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          lvm cluster locking daemon
+# Required-Start:    lvm2 cman
+# Required-Stop:     lvm2 cman
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: start and stop the lvm cluster locking daemon
+### END INIT INFO
+#
+# Author: Frederik Schüler <[EMAIL PROTECTED]>
+# based on the old clvm init script from etch
+# and the clvmd init script from RHEL5
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Cluster LVM Daemon"
+NAME=clvm
+DAEMON=/sbin/clvmd
+SCRIPTNAME=/etc/init.d/clvm
+
+[ -x $DAEMON ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+# some defaults, if not set
+[ -n "$CLVMDTIMEOUT" ] || CLVMDTIMEOUT=20
+DAEMON_OPTS="-T$CLVMDTIMEOUT"
+
+if [ ! -f /etc/cluster/cluster.conf ]; then
+	log_failure_msg "clvmd: cluster not configured. Aborting."
+	log_end_msg 1
+	exit 0
+fi
+
+if ! cman_tool status >/dev/null; then
+	log_failure_msg "clvmd: cluster is not running. Aborting."
+	log_end_msg 1
+	exit 0
+fi
+
+do_start()
+{
+	start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS || status="$?"
+	# flush cache
+	vgscan > /dev/null 2>&1 
+	return $status
+}
+
+do_activate()
+{
+	# activate volume groups
+	if [ -n "$LVM_VGS" ] ; then
+		for vg in $LVM_VGS ; do
+			log_action_msg  "Activating VG $vg"
+			vgchange -ayl $vg || return $?
+		done
+	else
+		log_action_msg  "Activating all VGs"
+		vgchange -ayl || return $?
+	fi
+}
+
+do_deactivate()
+{
+	if [ -n "$LVM_VGS" ] ; then
+		for vg in $LVM_VGS ; do
+			vgchange -anl $vg || return $?
+		done
+	else
+		# Hack to only deactivate clustered volumes
+		clustervgs=`vgdisplay 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'`
+		if [ -z $clustervgs ] ; then 
+			for vg in $clustervgs; do
+				vgchange -anl $vg || return $?
+			done
+		fi
+	fi
+}
+
+do_stop()
+{
+	start-stop-daemon --stop --quiet --name clvmd
+	status=$?
+	return $status
+}
+
+case "$1" in
+  	start)
+		# start the daemon...
+		log_daemon_msg "Starting $DESC" "$NAME"
+		do_start
+		status=$?
+		case "$status" in
+			0) log_end_msg 0 ;;
+			1) log_action_msg " already running" ; log_end_msg 0 ;;
+			*) log_end_msg 1 ;;
+		esac
+		# and activate clustered volume groups
+		do_activate
+		status=$?
+		exit $status
+	;;
+	stop)
+		# deactivate volumes...
+		log_daemon_msg "Deactivating VG $vg:"
+		do_deactivate
+		status=$?
+		case "$status" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 0 ;;
+			*) log_end_msg 1 ;;
+		esac
+		# and stop the daemon
+		log_daemon_msg "Stopping $DESC" "$NAME"
+		do_stop
+		status=$?
+		case "$status" in
+			0) log_end_msg 0 ; exit 0 ;;
+			1) log_end_msg 0 ; exit 0 ;;
+			*) log_end_msg 1 ; exit $status ;;
+		esac
+	;;
+	reload|restart|force-reload)
+		$0 stop
+		sleep 1
+		$0 start
+	;;
+	status)
+		pid=$( pidof $DAEMON )
+		if [ -n "$pid" ] ; then
+			log_action_msg "$DESC is running" 
+		else
+			log_action_msg "$DESC is not running"
+		fi
+		vols=$( $LVDISPLAY -C --nohead 2> /dev/null | awk '($3 ~ /....a./) {print $1}' )
+		echo active volumes: ${vols:-"(none)"}
+		exit 0
+	;;
+	*)
+		echo "Usage: $SCRIPTNAME {start|stop|reload|restart|force-reload|status}" >&2
+		exit 1
+	;;
+esac
+
+exit 0
diff -ruN lvm2-2.02.39.old/debian/control lvm2-2.02.39/debian/control
--- lvm2-2.02.39.old/debian/control	2008-07-27 23:08:39.000000000 +0200
+++ lvm2-2.02.39/debian/control	2008-07-27 23:31:50.000000000 +0200
@@ -37,8 +37,7 @@
 Section: admin
 Priority: extra
 Architecture: any
-Depends: ${shlibs:Depends}, lvm2 (= ${binary:Version})
-Suggests: cman
+Depends: ${shlibs:Depends}, lvm2 (= ${binary:Version}), lsb-base (>= 3.0-6), cman 
 Description: Cluster LVM Daemon for lvm2
  This package provides the clustering interface for lvm2, when used with 
  Red Hat's "cman" cluster infrastructure. It allows logical volumes to
diff -ruN lvm2-2.02.39.old/debian/rules lvm2-2.02.39/debian/rules
--- lvm2-2.02.39.old/debian/rules	2008-07-27 23:08:39.000000000 +0200
+++ lvm2-2.02.39/debian/rules	2008-07-24 16:42:51.000000000 +0200
@@ -131,6 +131,7 @@
 	$(MAKE) -C $(DIR) install DESTDIR=$(CURDIR)/$(INSTALL_DIR)
 	dh_install --sourcedir=$(INSTALL_DIR)
 	dh_installexamples
+	dh_installinit --no-start --no-restart-on-upgrade -- start 27 S . start 51 0 6 .
 	$(MAKE) -f debian/rules install-base
 
 install-lvm2: export DH_OPTIONS = -plvm2

Attachment: signature.asc
Description: Digital signature

Reply via email to