---
 configure.ac                            | 19 +++++++++++++++++++
 src/scripts/Makefile.am                 |  2 +-
 src/scripts/systemd/Makefile.am         | 16 ++++++++++++++++
 src/scripts/systemd/owfs.service        | 13 -------------
 src/scripts/systemd/owfs.service.in     | 13 +++++++++++++
 src/scripts/systemd/owftpd.service      | 13 -------------
 src/scripts/systemd/owftpd.service.in   | 13 +++++++++++++
 src/scripts/systemd/owhttpd.service     | 14 --------------
 src/scripts/systemd/owhttpd.service.in  | 14 ++++++++++++++
 src/scripts/systemd/owserver.service    | 12 ------------
 src/scripts/systemd/owserver.service.in | 12 ++++++++++++
 11 files changed, 88 insertions(+), 53 deletions(-)
 create mode 100644 src/scripts/systemd/Makefile.am
 delete mode 100644 src/scripts/systemd/owfs.service
 create mode 100644 src/scripts/systemd/owfs.service.in
 delete mode 100644 src/scripts/systemd/owftpd.service
 create mode 100644 src/scripts/systemd/owftpd.service.in
 delete mode 100644 src/scripts/systemd/owhttpd.service
 create mode 100644 src/scripts/systemd/owhttpd.service.in
 delete mode 100644 src/scripts/systemd/owserver.service
 create mode 100644 src/scripts/systemd/owserver.service.in

diff --git a/configure.ac b/configure.ac
index 088f5ed..be8c0eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1557,6 +1557,24 @@ AC_SEARCH_LIBS(nanosleep, rt posix4, 
AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you
 #AC_SEARCH_LIBS(clock_gettime, rt posix4, AC_DEFINE(HAVE_CLOCK_GETTIME, 1, 
[Define if you have clock_gettime]))
 
 
+# systemd support (see man 7 daemon)
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+       [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for 
systemd service files])],,
+       [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o 
"x$with_systemdsystemunitdir" = "xauto"], [
+       def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir 
systemd)
+
+AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+       [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+               [AC_MSG_ERROR([systemd support requested but pkg-config unable 
to query systemd package])])
+        with_systemdsystemunitdir=no],
+       [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+       [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+
+
 AC_CONFIG_FILES([
        Makefile
        module/Makefile
@@ -1636,6 +1654,7 @@ AC_CONFIG_FILES([
        src/scripts/usb/Makefile
        src/scripts/usb/cygwin/Makefile
        src/scripts/usb/windows/Makefile
+       src/scripts/systemd/Makefile
        src/include/owfs_config.h
 ])
 AC_OUTPUT
diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am
index bdb0574..c41b8b3 100644
--- a/src/scripts/Makefile.am
+++ b/src/scripts/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = usb windows
+SUBDIRS = usb windows systemd
 
 clean-generic:
 
diff --git a/src/scripts/systemd/Makefile.am b/src/scripts/systemd/Makefile.am
new file mode 100644
index 0000000..0b465a9
--- /dev/null
+++ b/src/scripts/systemd/Makefile.am
@@ -0,0 +1,16 @@
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+       owfs.service \
+       owftpd.service \
+       owhttpd.service \
+       owserver.service
+
+$(systemdsystemunit_DATA): Makefile
+       rm -f $@ $@.tmp
+       srcdir=''; \
+               test -f ./$@.in || srcdir=$(srcdir)/; \
+               sed -e 's|@bindir[@]|$(bindir)|g' $${srcdir}$@.in >$@.tmp
+       mv $@.tmp $@
+endif
+
diff --git a/src/scripts/systemd/owfs.service b/src/scripts/systemd/owfs.service
deleted file mode 100644
index c90f564..0000000
--- a/src/scripts/systemd/owfs.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=1-wire filesystem FUSE mount
-Documentation=man:owfs(1)
-Requires=owserver.service
-After=owserver.service
-
-[Service]
-Type=forking
-ExecStart=/usr/bin/owfs --server=127.0.0.1 --allow_other /run/owfs
-ExecStop=/usr/bin/umount /run/owfs
-
-[Install]
-WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owfs.service.in 
b/src/scripts/systemd/owfs.service.in
new file mode 100644
index 0000000..76af24b
--- /dev/null
+++ b/src/scripts/systemd/owfs.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=1-wire filesystem FUSE mount
+Documentation=man:owfs(1)
+Requires=owserver.service
+After=owserver.service
+
+[Service]
+Type=forking
+ExecStart=@bindir@/owfs --server=127.0.0.1 --allow_other /run/owfs
+ExecStop=/usr/bin/umount /run/owfs
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owftpd.service 
b/src/scripts/systemd/owftpd.service
deleted file mode 100644
index 5dea163..0000000
--- a/src/scripts/systemd/owftpd.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Anonymous FTP server for 1-wire access
-Documentation=man:owftpd(1)
-Requires=owserver.service
-After=owserver.service
-
-[Service]
-ExecStart=/usr/bin/owftpd --foreground --server=127.0.0.1
-User=ow
-Group=ow
-
-[Install]
-WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owftpd.service.in 
b/src/scripts/systemd/owftpd.service.in
new file mode 100644
index 0000000..fb9a774
--- /dev/null
+++ b/src/scripts/systemd/owftpd.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Anonymous FTP server for 1-wire access
+Documentation=man:owftpd(1)
+Requires=owserver.service
+After=owserver.service
+
+[Service]
+ExecStart=@bindir@/owftpd --foreground --server=127.0.0.1
+User=ow
+Group=ow
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owhttpd.service 
b/src/scripts/systemd/owhttpd.service
deleted file mode 100644
index ea76833..0000000
--- a/src/scripts/systemd/owhttpd.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Tiny webserver for 1-wire control
-Documentation=man:owhttpd(1)
-Requires=owserver.service
-After=owserver.service
-After=avahi-daemon.service
-
-[Service]
-ExecStart=/usr/bin/owhttpd --foreground --server=127.0.0.1
-User=ow
-Group=ow
-
-[Install]
-WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owhttpd.service.in 
b/src/scripts/systemd/owhttpd.service.in
new file mode 100644
index 0000000..9c407cf
--- /dev/null
+++ b/src/scripts/systemd/owhttpd.service.in
@@ -0,0 +1,14 @@
+[Unit]
+Description=Tiny webserver for 1-wire control
+Documentation=man:owhttpd(1)
+Requires=owserver.service
+After=owserver.service
+After=avahi-daemon.service
+
+[Service]
+ExecStart=@bindir@/owhttpd --foreground --server=127.0.0.1
+User=ow
+Group=ow
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owserver.service 
b/src/scripts/systemd/owserver.service
deleted file mode 100644
index c0ad03b..0000000
--- a/src/scripts/systemd/owserver.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Backend server for 1-wire control
-Documentation=man:owserver(1)
-
-[Service]
-#User=ow
-#Group=ow
-ExecStart=/usr/bin/owserver --foreground --w1
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
diff --git a/src/scripts/systemd/owserver.service.in 
b/src/scripts/systemd/owserver.service.in
new file mode 100644
index 0000000..435f675
--- /dev/null
+++ b/src/scripts/systemd/owserver.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Backend server for 1-wire control
+Documentation=man:owserver(1)
+
+[Service]
+ExecStart=@bindir@/owserver --foreground --w1
+Restart=on-failure
+#User=ow
+#Group=ow
+
+[Install]
+WantedBy=multi-user.target
-- 
1.9.3


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to