[Sheepdog] [PATCH] Add LSB style init script to build system

Steven Dake sdake at redhat.com
Tue Aug 24 00:26:27 CEST 2010


This patch adds an LSB style init script to the build system.  It also
installs it within the created RPM file.

Signed-off-by: Steven Dake <sdake at redhat.com>
---
 configure.ac       |    1 +
 script/Makefile.am |   28 ++++++++++++++++++++++++++++
 sheepdog.spec.in   |    1 +
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index bf4d86e..b09b9e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -274,6 +274,7 @@ AC_SUBST([OS_DYFLAGS])
 
 AM_CONDITIONAL(BUILD_HTML_DOCS, test -n "${GROFF}")
 
+AC_SUBST([INITDDIR])
 AC_SUBST([LINT_FLAGS])
 
 AC_DEFINE_UNQUOTED([LOCALSTATEDIR], "$(eval echo ${localstatedir})", [localstate directory])
diff --git a/script/Makefile.am b/script/Makefile.am
index 3e6c380..22987ca 100644
--- a/script/Makefile.am
+++ b/script/Makefile.am
@@ -1,3 +1,31 @@
 MAINTAINERCLEANFILES    = Makefile.in
 
+EXTRA_DIST		= generic.in
+
 noinst_HEADERS		= bash_completion_collie checkarch.sh check-dog.pl start-sheepdog stop-sheepdog vditest
+
+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)/sheepdog
+
+uninstall-local:
+	cd $(DESTDIR)/$(INITDDIR) && \
+		rm -f sheepdog
diff --git a/sheepdog.spec.in b/sheepdog.spec.in
index 852fe51..ea9eb5e 100644
--- a/sheepdog.spec.in
+++ b/sheepdog.spec.in
@@ -45,6 +45,7 @@ This package contains the Sheepdog server, and command line tool.
 %doc COPYING README
 %{_sbindir}/sheep
 %{_sbindir}/collie
+%{_initddir}/sheepdog
 %dir %{_localstatedir}/lib/sheepdog
 
 %changelog
-- 
1.7.2.1




More information about the sheepdog mailing list