Explorar o código

init: Add openrc init script

Also changed the way the init system scripts are installed so it can
support 2 script called the same but for differents initsystem

Signed-off-by: statzitz <jeremymosas@gmail.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
statzitz hai 1 semana
pai
achega
ee28d8f46f

+ 5 - 0
configure.ac

@@ -399,6 +399,11 @@ AC_ARG_ENABLE([systemd],
 	[ enable_systemd="no" ])
 AM_CONDITIONAL(INSTALL_SYSTEMD, test x$enable_systemd = xyes)
 
+AC_ARG_ENABLE([openrc],
+	      [  --enable-openrc                 : Install openrc service files],,
+	[ enable_openrc="no" ])
+AM_CONDITIONAL(INSTALL_OPENRC, test x$enable_openrc = xyes)
+
 AC_ARG_WITH([initconfigdir],
 	[AS_HELP_STRING([--with-initconfigdir=DIR],
 		[configuration directory @<:@SYSCONFDIR/sysconfig@:>@])],

+ 17 - 7
init/Makefile.am

@@ -34,20 +34,30 @@
 
 MAINTAINERCLEANFILES	= Makefile.in
 
-EXTRA_DIST		= corosync.in corosync-notifyd.in corosync.service.in \
-                          corosync-notifyd.service.in \
-                          corosync.sysconfig.example
+EXTRA_DIST		= other/corosync.in other/corosync-notifyd.in \
+					systemd/corosync.service.in \
+					systemd/corosync-notifyd.service.in \
+					openrc/corosync.in openrc/corosync-notifyd.in \
+					corosync.sysconfig.example
 
 if INSTALL_SYSTEMD
-systemdconfdir	   = $(SYSTEMDDIR)
-systemdconf_DATA   = corosync.service corosync-notifyd.service
+systemdconfdir		= $(SYSTEMDDIR)
+scriptdirpath		= systemd
+systemdconf_DATA	= systemd/corosync.service systemd/corosync-notifyd.service
 else
-initscriptdir	   = $(INITDDIR)
-initscript_SCRIPTS  = corosync corosync-notifyd
+initscriptdir		= $(INITDDIR)
+if INSTALL_OPENRC
+scriptdirpath		= openrc
+initscript_SCRIPTS	= openrc/corosync openrc/corosync-notifyd
+else
+scriptdirpath		= other
+initscript_SCRIPTS	= other/corosync other/corosync-notifyd
+endif
 endif
 
 %: %.in Makefile
 	rm -f $@-t $@
+	$(MKDIR_P) $(scriptdirpath)
 	cat $< | $(SED) \
 		-e 's#@''SBINDIR@#$(sbindir)#g' \
 		-e 's#@''BINDIR@#$(bindir)#g' \

+ 8 - 0
init/openrc/corosync-notifyd.in

@@ -0,0 +1,8 @@
+#!/sbin/openrc-run
+
+pidfile="/run/$RC_SVCNAME.pid"
+command="/usr/sbin/corosync-notifyd"
+
+depend() {
+        need net
+}

+ 13 - 0
init/openrc/corosync.in

@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+
+: ${cfgfile:=${CONFIGFILE:="/etc/corosync/corosync.conf"}}
+
+pidfile="/run/$RC_SVCNAME.pid"
+command="/usr/sbin/corosync"
+command_args="-l $pidfile -c $cfgfile"
+
+required_files="$cfgfile"
+
+depend() {
+        need net
+}

+ 0 - 0
init/corosync-notifyd.in → init/other/corosync-notifyd.in


+ 0 - 0
init/corosync.in → init/other/corosync.in


+ 0 - 0
init/corosync-notifyd.service.in → init/systemd/corosync-notifyd.service.in


+ 0 - 0
init/corosync.service.in → init/systemd/corosync.service.in