Permalink
Browse files

add systemd unit files for installation

These are automatically installed iff systemd support is compiled into
fcgiwrap.
  • Loading branch information...
1 parent 7f583a0 commit a9784d8967975160d56fc191d85ced94143e89de @falconindy falconindy committed Aug 21, 2012
Showing with 32 additions and 0 deletions.
  1. +5 −0 Makefile.in
  2. +8 −0 configure.ac
  3. +11 −0 systemd/fcgiwrap.service
  4. +8 −0 systemd/fcgiwrap.socket
View
@@ -9,6 +9,11 @@ install: all
install -m 755 fcgiwrap $(targetdir)
install -d -m 755 $(man8dir)
install -m 644 fcgiwrap.8 $(man8dir)
+ifneq ("@systemdsystemunitdir@", "")
+ install -d -m 755 $(DESTDIR)@systemdsystemunitdir@
+ install -m 644 systemd/fcgiwrap.socket $(DESTDIR)@systemdsystemunitdir@
+ install -m 644 systemd/fcgiwrap.service $(DESTDIR)@systemdsystemunitdir@
+endif
fcgiwrap: fcgiwrap.c
@CC@ @AM_CFLAGS@ fcgiwrap.c -o fcgiwrap -lfcgi @systemd_LIBS@ @LDFLAGS@
View
@@ -38,6 +38,14 @@ if test "x$with_systemd" != "xno"; then
fi
AM_CONDITIONAL(HAVE_LIBSSL, [test "x$have_systemd" = "xyes"])
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno -a "x$have_systemd" != xno; then
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h],, [AC_MSG_ERROR([fcntl.h header missing])])
AC_CHECK_HEADERS([limits.h stdlib.h string.h unistd.h],, [AC_MSG_ERROR([at least one important system header file is missing])])
View
@@ -0,0 +1,11 @@
+[Unit]
+Description=Simple CGI Server
+After=nss-user-lookup.target
+
+[Service]
+ExecStart=/usr/sbin/fcgiwrap
+User=http
+Group=http
+
+[Install]
+Also=fcgiwrap.socket
View
@@ -0,0 +1,8 @@
+[Unit]
+Description=fcgiwrap Socket
+
+[Socket]
+ListenStream=/run/fcgiwrap.sock
+
+[Install]
+WantedBy=sockets.target

0 comments on commit a9784d8

Please sign in to comment.