/stamp-h1
/src/python/location-downloader
/src/python/location-query
+/src/systemd/location-downloader.service
+/src/systemd/location-downloader.timer
/test.db
/testdata.db
EXTRA_DIST =
CLEANFILES =
+INSTALL_DIRS =
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_MAKEFLAGS = --no-print-directory
LIBLOC_REVISION=0
LIBLOC_AGE=0
+DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
SED_PROCESS = \
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
-e 's,@VERSION\@,$(VERSION),g' \
-e 's,@prefix\@,$(prefix),g' \
-e 's,@exec_prefix\@,$(exec_prefix),g' \
+ -e 's,@bindir\@,$(bindir),g' \
-e 's,@libdir\@,$(libdir),g' \
-e 's,@includedir\@,$(includedir),g' \
-e 's,@databasedir\@,$(databasedir),g' \
CLEANFILES += \
src/python/location-downloader \
src/python/location-query
+# ------------------------------------------------------------------------------
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ src/systemd/location-downloader.service \
+ src/systemd/location-downloader.timer
+
+CLEANFILES += \
+ $(systemdsystemunit_DATA)
+
+INSTALL_DIRS += \
+ $(systemdsystemunitdir)
+endif
+
+EXTRA_DIST += \
+ src/systemd/location-downloader.service.in \
+ src/systemd/location-downloader.timer.in
# ------------------------------------------------------------------------------
"
AC_SUBST([my_CFLAGS])
+# ------------------------------------------------------------------------------
+
+AC_ARG_WITH([systemd],
+ AS_HELP_STRING([--with-systemd], [Enable systemd support.])
+)
+
+AS_IF([test "x$with_systemd" != "xno"],
+ [PKG_CHECK_MODULES(systemd, [libsystemd],
+ [have_systemd=yes], [have_systemd=no])],
+ [have_systemd=no]
+)
+
+AS_IF([test "x$have_systemd" = "xyes"],
+ [AC_MSG_CHECKING([for systemd system unit directory])
+ AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]
+ )
+
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+
+ if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then
+ AC_MSG_RESULT([$systemdsystemunitdir])
+ else
+ AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)])
+ fi
+ ],
+ [AS_IF([test "x$with_systemd" = "xyes"],
+ [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.])
+ ])
+])
+
+AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"])
+
+# ------------------------------------------------------------------------------
+
# Python
AM_PATH_PYTHON([3.4])
PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
ldflags: ${LDFLAGS}
debug: ${enable_debug}
+ systemd support: ${have_systemd}
Bindings:
perl: ${enable_perl}
--- /dev/null
+[Unit]
+Description=Automatic Location Database Updater
+Requires=network.target
+
+[Service]
+Type=oneshot
+ExecStart=@bindir@/location-downloader update
--- /dev/null
+[Unit]
+Description=Update location database once a day
+
+[Timer]
+OnCalendar=daily
+RandomizedDelaySec=24h
+
+[Install]
+WantedBy=timers.target