aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-08-09 16:25:42 +0200
committerWojtek Kosior <koszko@koszko.org>2021-08-10 14:15:02 +0200
commitf1894d8aba1f8ae4a52dafc50b0a138978607bc4 (patch)
tree6e055db7ed76375c3fffb84b655f29faecffe7de
parent834df7ce46e7e8c79840c99baa505d90b4c732c4 (diff)
downloadhydrilla-f1894d8aba1f8ae4a52dafc50b0a138978607bc4.tar.gz
hydrilla-f1894d8aba1f8ae4a52dafc50b0a138978607bc4.zip
add sysv init script
-rw-r--r--Makefile.am35
-rw-r--r--Makefile.in141
-rwxr-xr-xconfigure1
-rw-r--r--configure.ac1
-rw-r--r--daemon/sysv.in78
5 files changed, 221 insertions, 35 deletions
diff --git a/Makefile.am b/Makefile.am
index 05d8c5b..5834e07 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,37 @@
SUBDIRS = src
dist_doc_DATA = README.txt
+
+transform_name = @program_transform_name@
+hydrilla_new_name = `echo hydrilla | sed '$(transform_name)'`
+subst_perform = sed -e 's|[@]hydrilla[@]|'$(hydrilla_new_name)'|g' \
+ -e 's|[@]bindir[@]|$(bindir)|g' \
+ -e 's|[@]runstatedir[@]|$(runstatedir)|g' \
+ -e 's|[@]logdir[@]|$(localstatedir)/log|g'
+
+
+bin_SCRIPTS =
+CLEANFILES =
+EXTRA_DIST =
+
+# SysV init script
+CLEANFILES += daemon/sysv
+EXTRA_DIST += daemon/sysv.in
+
+$(srcdir)/daemon/sysv: $(srcdir)/daemon/sysv.in $(srcdir)/Makefile
+ $(subst_perform) < $< > $@
+
+sysv_script_dest_loc = $(DESTDIR)/etc/init.d
+sysv_script_dest_path = $(sysv_script_dest_loc)/$(hydrilla_new_name)
+
+install-sysv-script: $(srcdir)/daemon/sysv
+ $(MKDIR_P) $(sysv_script_dest_loc)
+ $(INSTALL_SCRIPT) $< $(sysv_script_dest_path)
+
+uninstall-sysv-script:
+ rm -f $(DESTDIR)/$(sysv_script_dest_path)
+
+# Inform Automake about our special (un)install rules
+install-exec-local: install-sysv-script
+uninstall-local: uninstall-sysv-script
+
+.PHONY: install-sysv-script uninstall-sysv-script
diff --git a/Makefile.in b/Makefile.in
index 030b810..cfadfe4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -14,6 +14,7 @@
@SET_MAKE@
+
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -99,33 +100,6 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-am__v_GEN_1 =
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
- ctags-recursive dvi-recursive html-recursive info-recursive \
- install-data-recursive install-dvi-recursive \
- install-exec-recursive install-html-recursive \
- install-info-recursive install-pdf-recursive \
- install-ps-recursive install-recursive installcheck-recursive \
- installdirs-recursive pdf-recursive ps-recursive \
- tags-recursive uninstall-recursive
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -153,7 +127,35 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(docdir)"
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"
+SCRIPTS = $(bin_SCRIPTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
DATA = $(dist_doc_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
@@ -316,6 +318,20 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src
dist_doc_DATA = README.txt
+transform_name = @program_transform_name@
+hydrilla_new_name = `echo hydrilla | sed '$(transform_name)'`
+subst_perform = sed -e 's|[@]hydrilla[@]|'$(hydrilla_new_name)'|g' \
+ -e 's|[@]bindir[@]|$(bindir)|g' \
+ -e 's|[@]runstatedir[@]|$(runstatedir)|g' \
+ -e 's|[@]logdir[@]|$(localstatedir)/log|g'
+
+bin_SCRIPTS =
+
+# SysV init script
+CLEANFILES = daemon/sysv
+EXTRA_DIST = daemon/sysv.in
+sysv_script_dest_loc = $(DESTDIR)/etc/init.d
+sysv_script_dest_path = $(sysv_script_dest_loc)/$(hydrilla_new_name)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -368,6 +384,41 @@ $(srcdir)/config.h.in: $(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
install-dist_docDATA: $(dist_doc_DATA)
@$(NORMAL_INSTALL)
@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
@@ -689,10 +740,10 @@ distcleancheck: distclean
exit 1; } >&2
check-am: all-am
check: check-recursive
-all-am: Makefile $(DATA) config.h
+all-am: Makefile $(SCRIPTS) $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(docdir)"; do \
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -717,6 +768,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -752,7 +804,7 @@ install-dvi: install-dvi-recursive
install-dvi-am:
-install-exec-am:
+install-exec-am: install-binSCRIPTS install-exec-local
install-html: install-html-recursive
@@ -792,7 +844,8 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-dist_docDATA
+uninstall-am: uninstall-binSCRIPTS uninstall-dist_docDATA \
+ uninstall-local
.MAKE: $(am__recursive_targets) all install-am install-strip
@@ -803,18 +856,36 @@ uninstall-am: uninstall-dist_docDATA
distcheck distclean distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dist_docDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
+ install-binSCRIPTS install-data install-data-am \
+ install-dist_docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-exec-local install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
- tags-am uninstall uninstall-am uninstall-dist_docDATA
+ tags-am uninstall uninstall-am uninstall-binSCRIPTS \
+ uninstall-dist_docDATA uninstall-local
.PRECIOUS: Makefile
+$(srcdir)/daemon/sysv: $(srcdir)/daemon/sysv.in $(srcdir)/Makefile
+ $(subst_perform) < $< > $@
+
+install-sysv-script: $(srcdir)/daemon/sysv
+ $(MKDIR_P) $(sysv_script_dest_loc)
+ $(INSTALL_SCRIPT) $< $(sysv_script_dest_path)
+
+uninstall-sysv-script:
+ rm -f $(DESTDIR)/$(sysv_script_dest_path)
+
+# Inform Automake about our special (un)install rules
+install-exec-local: install-sysv-script
+uninstall-local: uninstall-sysv-script
+
+.PHONY: install-sysv-script uninstall-sysv-script
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/configure b/configure
index d5e4571..85c8a49 100755
--- a/configure
+++ b/configure
@@ -3442,6 +3442,7 @@ else
fi
+
ac_config_headers="$ac_config_headers config.h"
ac_config_files="$ac_config_files Makefile src/Makefile"
diff --git a/configure.ac b/configure.ac
index 9f96cc8..36e590e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,7 @@
AC_INIT([hydrilla], [0.1], [koszko@koszko.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
+AC_PROG_MKDIR_P
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
diff --git a/daemon/sysv.in b/daemon/sysv.in
new file mode 100644
index 0000000..cec25f5
--- /dev/null
+++ b/daemon/sysv.in
@@ -0,0 +1,78 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: @hydrilla@
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Hydrilla repository server
+# Description: Provides HTTP service to serve packages for Hachette
+### END INIT INFO
+
+set -e
+if [ ! -f "@bindir@/@hydrilla@" ]
+then
+ exit 5
+fi
+
+mkdir -p "@runstatedir@"
+mkdir -p "@logdir@"
+
+case "$1" in
+start)
+ if [ -f "@runstatedir@/@hydrilla@.pid" ]
+ then
+ if pgrep -F "@runstatedir@/@hydrilla@.pid" @hydrilla@
+ then
+ exit 0
+ else
+ echo "@hydrilla@ has a stale pid file" >&2
+ exit 1
+ fi
+ else
+ daemonize \
+ -a \
+ -e "@logdir@/@hydrilla@-stderr.log" \
+ -o "@logdir@/@hydrilla@-stdout.log" \
+ -p "@runstatedir@/@hydrilla@.pid" \
+ -E "HYDRILLA_WAIT_SIGTERM=yes" \
+ @bindir@/@hydrilla@
+ fi
+ ;;
+stop)
+ if [ -f "@runstatedir@/@hydrilla@.pid" ]
+ then
+ pkill -F "@runstatedir@/@hydrilla@.pid" @hydrilla@ || {
+ exit 1
+ }
+ rm -f "@runstatedir@/@hydrilla@.pid"
+ exit 0
+ else
+ exit 0
+ fi
+ ;;
+status)
+ if [ -f "@runstatedir@/@hydrilla@.pid" ]
+ then
+ if pgrep -F "@runstatedir@/@hydrilla@.pid" @hydrilla@
+ then
+ echo "@hydrilla@ is running"
+ exit 0
+ else
+ echo "@hydrilla@ has a stale pid file"
+ exit 1
+ fi
+ else
+ echo "@hydrilla@ is not running"
+ exit 3
+ fi
+ ;;
+restart|force-reload)
+ "$0" stop
+ "$0" start
+ ;;
+*)
+ echo "Usage: $0 (start|stop|status|restart|force-reload)"
+ exit 3
+ ;;
+esac