[packages/openais] - PLD init script added
draenog
draenog at pld-linux.org
Thu Jul 5 02:41:12 CEST 2012
commit c169071f042ba04279681ef0eeb83a63472e5871
Author: Jacek Konieczny <jajcus at pld-linux.org>
Date: Wed Jul 4 16:14:18 2012 +0000
- PLD init script added
Changed files:
openais.init -> 1.1
openais.spec -> 1.23
openais.init | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
openais.spec | 23 ++++++++++---
2 files changed, 121 insertions(+), 5 deletions(-)
---
diff --git a/openais.init b/openais.init
new file mode 100644
index 0000000..f2c506f
--- /dev/null
+++ b/openais.init
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# openais OpenAIS Cluster Framework
+#
+# chkconfig: 2345 20 80
+# description: OpenAIS Cluster Framework
+# processname: corosync
+#
+### BEGIN INIT INFO
+# Provides: corosync
+# Required-Start: $network $syslog
+# Required-Stop: $network $syslog
+# Default-Start:
+# Default-Stop:
+# Short-Description: Starts and stops OpenAIS Cluster Framework
+# Description: Starts and stops OpenAIS Cluster Framework
+### END INIT INFO
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+[ -f /etc/sysconfig/openais ] && . /etc/sysconfig/openais
+
+start() {
+ # Check if the service is already running?
+ if [ -f /var/lock/subsys/corosync ]; then
+ msg_already_running "Corosync Cluster Engine"
+ echo "You should stop bare Corosync before starting OpenAIS" >&2
+ RETVAL=1
+ return
+ fi
+ if [ -f /var/lock/subsys/openais ]; then
+ msg_already_running "OpenAIS Cluster Framework"
+ return
+ fi
+ if grep -q nocluster /proc/cmdline ; then
+ show "Disabled on boot"
+ RETVAL=1
+ return
+ fi
+
+ msg_starting "OpenAIS Cluster Framework"
+ daemon /usr/sbin/aisexec
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/openais
+}
+
+stop() {
+ if [ ! -f /var/lock/subsys/openais ]; then
+ msg_not_running "OpenAIS Cluster Framework"
+ return
+ fi
+
+ # Stop daemons.
+ msg_stopping "OpenAIS Cluster Framework"
+ killproc /usr/sbin/corosync
+ rm -f /var/lock/subsys/openais
+}
+
+condrestart() {
+ if [ ! -f /var/lock/subsys/openais ]; then
+ msg_not_running "OpenAIS Cluster Framework"
+ RETVAL=$1
+ return
+ fi
+
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ sleep 5
+ start
+ ;;
+ try-restart)
+ condrestart 0
+ ;;
+ force-reload)
+ condrestart 7
+ ;;
+ status)
+ if [ -f /var/lock/subsys/corosync ] ; then
+ # not report bare corosync as openais
+ status openais
+ else
+ status openais corosync
+ fi
+ RETVAL=$?
+ ;;
+*)
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+ exit 3
+ ;;
+esac
+exit $RETVAL
diff --git a/openais.spec b/openais.spec
index 33c57b9..e3fecb4 100644
--- a/openais.spec
+++ b/openais.spec
@@ -1,12 +1,18 @@
+#
+# Note: not mainained upstream any more but still needed for
+# 3rd generation 'cluster' package and clvmd under corosync
+# holds upgrade to corosync 2.x, though
+#
Summary: The openais Standards-Based Cluster Framework executive and APIs
Summary(pl.UTF-8): Ĺrodowisko klastra opartego na standardach openais
Name: openais
Version: 1.1.4
-Release: 2
+Release: 2.1
License: BSD
Group: Base
Source0: ftp://ftp:download@ftp.openais.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz
# Source0-md5: e500ad3c49fdc45d8653f864e80ed82c
+Source1: %{name}.init
URL: http://www.openais.org/
BuildRequires: autoconf >= 2.61
BuildRequires: automake
@@ -91,6 +97,8 @@ sed -i -e 's/OPT_CFLAGS=.*/OPT_CFLAGS=/' configure.ac
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
@@ -101,6 +109,8 @@ sed -i -e 's/^/#/' $RPM_BUILD_ROOT/etc/corosync/amf.conf
# Cleanup the buildroot
%{__rm} -r $RPM_BUILD_ROOT/usr/share/doc/openais
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -109,20 +119,23 @@ rm -rf $RPM_BUILD_ROOT
%useradd -u 187 -d /usr/share/empty -s /bin/false -g ais -c "openais Standards Based Cluster Framework" -r ais
%post
-/sbin/chkconfig --add openais
-%service openais restart
+/sbin/chkconfig --add %{name}
+%service %{name} restart
+%systemd_post %{name}.service
%preun
if [ "$1" -eq "0" ]; then
- %service -q openais stop
- /sbin/chkconfig --del openais
+ %service -q %{name} stop
+ /sbin/chkconfig --del %{name}
fi
+%systemd_preun %{name}.service
%postun
if [ "$1" = "0" ]; then
%userremove ais
%groupremove ais
fi
+%systemd_reload
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
More information about the test
mailing list