Commit be748fa8 authored by Michael Tremer's avatar Michael Tremer

Add systemd unit files for location-downloader

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 5a9b4c77
......@@ -14,5 +14,7 @@ Makefile.in
/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
......@@ -36,11 +37,15 @@ LIBLOC_CURRENT=0
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' \
......@@ -220,6 +225,23 @@ EXTRA_DIST += \
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
# ------------------------------------------------------------------------------
......
......@@ -96,6 +96,42 @@ my_CFLAGS="\
"
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}])
......@@ -130,6 +166,7 @@ AC_MSG_RESULT([
ldflags: ${LDFLAGS}
debug: ${enable_debug}
systemd support: ${have_systemd}
Bindings:
perl: ${enable_perl}
......
[Unit]
Description=Automatic Location Database Updater
Requires=network.target
[Service]
Type=oneshot
ExecStart=@bindir@/location-downloader update
[Unit]
Description=Update location database once a day
[Timer]
OnCalendar=daily
RandomizedDelaySec=24h
[Install]
WantedBy=timers.target
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment