diff --git a/configure.ac b/configure.ac index 0d2220b3..232c9c64 100644 --- a/configure.ac +++ b/configure.ac @@ -650,6 +650,8 @@ AC_CONFIG_FILES([ doc/asio_http2_client.h.rst doc/contribute.rst contrib/Makefile + contrib/nghttpx-init.template + contrib/nghttpx.service.template ]) AC_OUTPUT diff --git a/contrib/.gitignore b/contrib/.gitignore index a08baf90..a9fa9f81 100644 --- a/contrib/.gitignore +++ b/contrib/.gitignore @@ -1 +1,5 @@ nghttpx-init +nghttpx-init.template +nghttpx.service +nghttpx.service.template + diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 8f12126f..748f1cbb 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -21,19 +21,18 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -EXTRA_DIST = nghttpx-init.in nghttpx.service nghttpx-logrotate +EXTRA_DIST = nghttpx-init.template.in nghttpx.service.template.in \ + nghttpx-logrotate -edit = sed -e 's|@bindir[@]|$(bindir)|g' +edit = sed -e 's|$$(bindir)|$(bindir)|g' -nghttpx-init: Makefile +nghttpx-init nghttpx.service: %: $(srcdir)/%.template rm -f $@ $@.tmp - $(edit) $(srcdir)/$@.in > $@.tmp + $(edit) $< > $@.tmp chmod +x $@.tmp mv $@.tmp $@ -nghttpx-init: $(srcdir)/nghttpx-init.in - -all-local: nghttpx-init +all-local: nghttpx-init nghttpx.service clean-local: - -rm -f nghttpx-init nghttpx-init.tmp + -rm -f nghttpx-init nghttpx-init.tmp nghttpx.service nghttpx.service.tmp diff --git a/contrib/nghttpx-init.in b/contrib/nghttpx-init.template.in similarity index 97% rename from contrib/nghttpx-init.in rename to contrib/nghttpx-init.template.in index a1620a97..8367d810 100644 --- a/contrib/nghttpx-init.in +++ b/contrib/nghttpx-init.template.in @@ -17,8 +17,8 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin DESC="HTTP/2 reverse proxy" NAME=nghttpx -# Depending on the configuration, binary may be located under @sbindir@ -DAEMON=@bindir@/$NAME +# Depending on the configuration, binary may be located under $(bindir) +DAEMON=$(bindir)/$NAME PIDFILE=/var/run/$NAME.pid DAEMON_ARGS="--conf /etc/nghttpx/nghttpx.conf --pid-file=$PIDFILE" SCRIPTNAME=/etc/init.d/$NAME diff --git a/contrib/nghttpx.service b/contrib/nghttpx.service.template.in similarity index 73% rename from contrib/nghttpx.service rename to contrib/nghttpx.service.template.in index 71367be4..f6e0eed4 100644 --- a/contrib/nghttpx.service +++ b/contrib/nghttpx.service.template.in @@ -4,7 +4,7 @@ After=network.target [Service] Type=simple -ExecStart=/usr/bin/nghttpx --errorlog-syslog +ExecStart=$(bindir)/nghttpx --errorlog-syslog [Install] WantedBy=multi-user.target