[ enable_rdma="no" ])
AM_CONDITIONAL(BUILD_RDMA, test x$enable_rdma = xyes)
+AC_ARG_WITH([initddir],
+ [ --with-initddir=DIR : path to init script directory. ],
+ [ INITDDIR="$withval" ],
+ [ INITDDIR="$sysconfdir/init.d" ])
+
AC_ARG_WITH([lcrso-dir],
[ --with-lcrso-dir=DIR : corosync lcrso files. ],
[ LCRSODIR="$withval" ],
LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
# substitute what we need:
+AC_SUBST([INITDDIR])
AC_SUBST([LCRSODIR])
AC_SUBST([SOCKETDIR])
AC_MSG_RESULT([ Arch-independent files = ${datadir}])
AC_MSG_RESULT([ State information = ${localstatedir}])
AC_MSG_RESULT([ System configuration = ${sysconfdir}])
+AC_MSG_RESULT([ System init.d directory = ${INITDDIR}])
AC_MSG_RESULT([ corosync config dir = ${COROSYSCONFDIR}])
AC_MSG_RESULT([ LCRSO = ${LCRSODIR}])
AC_MSG_RESULT([ SOCKETDIR = ${SOCKETDIR}])
export rdmacm_LIBS=-lrdmacm \
%{configure} \
--enable-nss \
- --enable-rdma
+ --enable-rdma \
+ --with-initddir=%{_initddir}
%build
make %{_smp_mflags}
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
-install -d %{buildroot}%{_initddir}
-install -m 755 init/redhat %{buildroot}%{_initddir}/corosync
## tree fixup
# drop static libs
MAINTAINERCLEANFILES = Makefile.in
-EXTRA_DIST = generic mvlcge README redhat
+EXTRA_DIST = generic.in
+
+target_INIT = generic
+
+%: %.in Makefile
+ rm -f $@-t $@
+ sed \
+ -e 's#@''SBINDIR@#$(sbindir)#g' \
+ -e 's#@''SYSCONFDIR@#$(sysconfdir)#g' \
+ -e 's#@''INITDDIR@#$(INITDDIR)#g' \
+ -e 's#@''LOCALSTATEDIR@#$(localstatedir)#g' \
+ $< > $@-t
+ chmod 0755 $@-t
+ mv $@-t $@
+
+all-local: $(target_INIT)
+
+clean-local:
+ rm -rf $(target_INIT)
+
+install-exec-local:
+ $(INSTALL) -d $(DESTDIR)/$(INITDDIR)
+ $(INSTALL) -m 755 generic $(DESTDIR)/$(INITDDIR)/corosync
+
+uninstall-local:
+ cd $(DESTDIR)/$(INITDDIR) && \
+ rm -f corosync
+++ /dev/null
-This directory contains init scripts used to start and stop the Corosync Cluster
-Engine.
-
-redhat contains an init script for Red Hat systems.
-mvlcge contains an init script for MontaVista Linux systems.
-generic contains an init script for Generic Systems.
+++ /dev/null
-#!/bin/sh
-#
-# corosync Start the Corosync Cluster Engine
-#
-# Author: Andrew Beekhof <abeekhof@suse.de>
-# License: Revised BSD
-#
-# chkconfig: - 20 20
-# processname: corosync
-# description: Corosync Cluster Engine
-#
-### BEGIN INIT INFO
-# Description: corosync....
-#
-# Short-Description: Corosync Cluster Engine.
-# Provides: corosync
-# Required-Start: $network
-# Should-Start: $syslog
-# Required-Stop: $network
-# Default-Start: 3 5
-# Default-Stop: 0 6
-### END INIT INFO
-
-do_force=0
-prog="corosync"
-lockfile="/var/lock/subsys/$prog"
-
-internal_status() {
- killall -0 corosync > /dev/null 2>&1
- return $?
-}
-
-status() {
- if
- ! internal_status
- then
- echo "Stopped"
- return 7
- fi
-
- echo "Running"
- return 0
-}
-
-start() {
- echo -n $"Starting Corosync Cluster Engine ($prog): "
- if
- ! internal_status
- then
- echo -n "starting... "
- $prog 2>&1 > /dev/null 2>&1
- echo -n "rc=$?: "
- fi
-
- sleep 2 # give it time to fail... $? isn't definitive
-
- if
- internal_status
- then
- echo "OK"
- return 0
- fi
-
- echo "Failed"
- return 1
-}
-
-do_force=0
-do_forever=1
-
-stop() {
- echo -n $"Stopping Corosync Cluster Engine ($prog): "
-
- killall -QUIT corosync
-
- if [ $do_forever = 0 ]; then
- for i in 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20; do
- if
- internal_status
- then
- sleep 2
- echo -n "."
- else
- rm -f "$lockfile"
- echo "OK"
- return 0
- fi
- done
-
- if [ $do_force = 1 ]; then
- echo -n "Escalating... "
- killall -KILL corosync
- sleep 5
-
- if
- ! internal_status
- then
- rm -f "$lockfile"
- echo "OK"
- return 0
- fi
- fi
-
- echo "Failed"
- return 1
- fi
-
- while
- internal_status
- do
- sleep 1
- echo -n "."
- done
-
- rm -f "$lockfile"
- echo "OK"
- return 0
-}
-
-restart() {
- stop
- start
-}
-
-case "$1" in
- start|stop|restart)
- $1
- ;;
- force-stop)
- do_force=1
- stop
- ;;
- reload|force-reload)
- restart
- ;;
- condrestart|try-restart)
- [ ! -f "$lockfile" ] || restart
- ;;
- status)
- status $prog
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|force-stop|status}"
- exit 2
-esac
--- /dev/null
+#!/bin/bash
+
+# Authors:
+# Andrew Beekhof <abeekhof@redhat.com>
+# Fabio M. Di Nitto <fdinitto@redhat.com>
+#
+# License: Revised BSD
+
+# chkconfig: - 20 20
+# description: Corosync Cluster Engine
+# processname: corosync
+#
+### BEGIN INIT INFO
+# Provides: corosync
+# Required-Start: $network
+# Should-Start: $syslog
+# Required-Stop: $network
+# Default-Start:
+# Default-Stop:
+# Short-Description: Starts and stops Corosync Cluster Engine.
+# Description: Starts and stops Corosync Cluster Engine.
+### END INIT INFO
+
+desc="Corosync Cluster Engine"
+prog="corosync"
+
+# set secure PATH
+PATH="/sbin:/bin:/usr/sbin:/usr/bin:@SBINDIR@"
+
+success()
+{
+ echo -ne "[ OK ]\r"
+}
+
+failure()
+{
+ echo -ne "[FAILED]\r"
+}
+
+status()
+{
+ pid=$(pidof $1 2>/dev/null)
+ rtrn=$?
+ if [ $rtrn -ne 0 ]; then
+ echo "$1 is stopped"
+ else
+ echo "$1 (pid $pid) is running..."
+ fi
+ return $rtrn
+}
+
+# rpm based distros
+if [ -d @SYSCONFDIR@/sysconfig ]; then
+ [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
+ [ -f @SYSCONFDIR@/sysconfig/$prog ] && . @SYSCONFDIR@/sysconfig/$prog
+ [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog"
+fi
+
+# deb based distros
+if [ -d @SYSCONFDIR@/default ]; then
+ [ -f @SYSCONFDIR@/default/$prog ] && . @SYSCONFDIR@/default/$prog
+ [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
+fi
+
+start()
+{
+ echo -n "Starting $desc ($prog): "
+
+ # most recent distributions use tmpfs for @LOCALSTATEDIR@/run
+ # to avoid to clean it up on every boot.
+ # they also assume that init scripts will create
+ # required subdirectories for proper operations
+ mkdir -p @LOCALSTATEDIR@/run
+
+ if status $prog > /dev/null 2>&1; then
+ success
+ else
+ $prog > /dev/null 2>&1
+
+ # give it time to fail
+ sleep 2
+ if status $prog > /dev/null 2>&1; then
+ touch $LOCK_FILE
+ pidof $prog > @LOCALSTATEDIR@/run/$prog.pid
+ success
+ else
+ failure
+ rtrn=1
+ fi
+ fi
+ echo
+}
+
+stop()
+{
+ echo -n "Signaling $desc ($prog) to terminate: "
+ killall -TERM $prog > /dev/null 2>&1
+ success
+ echo
+
+ echo -n "Waiting for $prog services to unload:"
+ while status $prog > /dev/null 2>&1; do
+ sleep 1
+ echo -n "."
+ done
+
+ rm -f $LOCK_FILE
+ rm -f @LOCALSTATEDIR@/run/$prog.pid
+ success
+ echo
+}
+
+restart()
+{
+ stop
+ start
+}
+
+rtrn=0
+
+case "$1" in
+start)
+ start
+;;
+restart|reload|force-reload)
+ restart
+;;
+condrestart|try-restart)
+ if status $prog > /dev/null 2>&1; then
+ restart
+ fi
+;;
+status)
+ status $prog
+ rtrn=$?
+;;
+stop)
+ stop
+;;
+*)
+ echo "usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+ rtrn=2
+;;
+esac
+
+exit $rtrn
+++ /dev/null
-#! /bin/sh
-#
-# Application Interface Specification Startup
-# chkconfig: 2345 20 20
-
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-
-test -f /usr/sbin/corosync | exit 0
-
-case "$1" in
- start)
- echo -n "Starting Corosync Cluster Engine: "
- start-stop-daemon --start --quiet --exec /usr/sbin/corosync
- echo "."
-
- ;;
- stop)
- echo -n "Stopping Corosync Cluster Engine: "
- start-stop-daemon --stop --quiet --exec /usr/sbin/corosync
- echo "."
- ;;
- *)
- echo "Usage: /etc/init.d/corosync {start|stop}" >&2
- exit 1
- ;;
-esac
+++ /dev/null
-#!/bin/sh
-#
-# Corosync daemon init script for Red Hat Linux and compatibles.
-#
-# chkconfig: - 20 20
-# processname: corosync
-# pidfile: /var/run/corosync.pid
-# description: Corosync Cluster Engine
-
-# Source function library
-. /etc/rc.d/init.d/functions
-
-prog="corosync"
-exec="/usr/sbin/corosync"
-lockfile="/var/lock/subsys/corosync"
-DAEMON_COREFILE_LIMIT=unlimited
-
-[ -x "$exec" ] || exit 0
-
-start() {
- echo -n $"Starting Corosync Cluster Engine ($prog): "
- daemon $exec
- retval=$?
- [ "$retval" -eq 0 ] && touch "$lockfile"
- echo
- return $retval
-}
-
-stop() {
- echo -n $"Stopping Corosync Cluster Engine ($prog): "
- # If no signal is specified, -TERM is used but _also_ -KILL 3s later
- # This is far too aggressive for a cluster resource manager running on top of Corosync
- killproc $prog -TERM
- echo
-
- echo -n $"Waiting for services to unload:"
- while
- pidofproc $prog > /dev/null 2>&1
- do
- sleep 2
- done
-
- success $"$base shutdown"
- echo
-
- rm -f "$lockfile"
- return 0
-}
-
-restart() {
- stop
- start
-}
-
-case "$1" in
- start|stop|restart)
- $1
- ;;
- reload|force-reload)
- restart
- ;;
- condrestart|try-restart)
- [ ! -f "$lockfile" ] || restart
- ;;
- status)
- status $prog
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|status}"
- exit 2
-esac