packages: openais/openais.spec, openais/openais.init (NEW)=?UTF-8?Q?=20?=- PLD init scrip...

jajcus jajcus at pld-linux.org
Wed Jul 4 18:14:24 CEST 2012


Author: jajcus                       Date: Wed Jul  4 16:14:24 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- PLD init script added

---- Files affected:
packages/openais:
   openais.spec (1.22 -> 1.23) , openais.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/openais/openais.spec
diff -u packages/openais/openais.spec:1.22 packages/openais/openais.spec:1.23
--- packages/openais/openais.spec:1.22	Sun Jul  1 16:17:49 2012
+++ packages/openais/openais.spec	Wed Jul  4 18:14:18 2012
@@ -1,13 +1,19 @@
 # $Revision$, $Date$
+#
+# 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
@@ -92,6 +98,8 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
@@ -102,6 +110,8 @@
 # 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
 
@@ -110,20 +120,23 @@
 %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
@@ -192,6 +205,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.23  2012/07/04 16:14:18  jajcus
+- PLD init script added
+
 Revision 1.22  2012/07/01 14:17:49  jajcus
 - Release: 2
 

================================================================
Index: packages/openais/openais.init
diff -u /dev/null packages/openais/openais.init:1.1
--- /dev/null	Wed Jul  4 18:14:24 2012
+++ packages/openais/openais.init	Wed Jul  4 18:14:18 2012
@@ -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
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/packages/openais/openais.spec?r1=1.22&r2=1.23



More information about the pld-cvs-commit mailing list