Skip to content
Snippets Groups Projects
Commit 63cbd313 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

add systemd unit file

parent afd53aef
No related branches found
No related tags found
No related merge requests found
SUBDIRS = bin conf lib public templates
SUBDIRS = bin conf lib public templates systemd
AM_TESTS_ENVIRONMENT = PERL5LIB='$(srcdir)/lib'; export PERL5LIB;
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
......
......@@ -6,7 +6,30 @@ AC_PROG_LN_S
confdir=$sysconfdir/access-check
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemd-unitdir],
[AS_HELP_STRING([--with-systemd-unitdir=DIR], [Directory for systemd service file @<:@default=automatic@:>@])],
[systemdunitdir=$with_systemd_unitdir],
[systemdunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]
)
AC_ARG_WITH([systemd-user],
[AS_HELP_STRING([--with-systemd-user=USER], [User for systemd service @<:@default=root@:>@])],
[systemduser=$with_systemd_user],
[systemduser="root"]
)
AC_ARG_WITH([systemd-group],
[AS_HELP_STRING([--with-systemd-group=GROUP], [Group for systemd service @<:@default=root@:>@])],
[systemdgroup=$with_systemd_group],
[systemdgroup="root"]
)
systemdconfdir=$sysconfdir/sysconfig
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$systemdunitdir" != "x"])
AC_SUBST(confdir)
AC_SUBST(systemdunitdir)
AC_SUBST(systemdconfdir)
AC_SUBST(systemduser)
AC_SUBST(systemdgroup)
AC_CONFIG_FILES(
Makefile
......@@ -15,6 +38,7 @@ AC_CONFIG_FILES(
lib/Makefile
templates/Makefile
public/Makefile
systemd/Makefile
)
AC_OUTPUT
......@@ -16,7 +16,7 @@ use constant {
sub startup {
my $self = shift;
$self->plugin('INIConfig', { file => $ENV{MOJO_CONFIG} || 'conf/manager.conf' });
$self->plugin('INIConfig', { file => $ENV{ACCESS_CHECK_CONFIG} || 'conf/manager.conf' });
$self->plugin(
'TemplateToolkit',
......
EXTRA_DIST = access-check.sysconfig.in \
access-check.service.in
if HAVE_SYSTEMD
appbindir = $(pkgdatadir)/bin
noinst_DATA = access-check.sysconfig
systemdunit_DATA = access-check.service
CLEANFILES = $(systemdunit_DATA) $(noinst_DATA)
access-check.service: Makefile access-check.service.in
sed \
-e 's|[@]systemdconfdir[@]|$(systemdconfdir)|' \
-e 's|[@]appbindir[@]|$(appbindir)|' \
-e 's|[@]systemduser[@]|$(systemduser)|' \
-e 's|[@]systemdgroup[@]|$(systemdgroup)|' \
< $(srcdir)/$@.in > $@
access-check.sysconfig: Makefile access-check.sysconfig.in
sed \
-e 's|[@]confdir[@]|$(confdir)|' \
< $(srcdir)/$@.in > $@
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(systemdconfdir)
if [ -f $(DESTDIR)$(systemdconfdir)/access-check ]; then \
$(INSTALL_DATA) access-check.sysconfig $(DESTDIR)$(systemdconfdir)/access-check.new; \
else \
$(INSTALL_DATA) access-check.sysconfig $(DESTDIR)$(systemdconfdir)/access-check; \
fi
uninstall-local:
rm -f $(DESTDIR)$(systemdconfdir)/access-check
endif
[Unit]
Description=access-check account manager
[Service]
Type=simple
EnvironmentFile=-@systemdconfdir@/access-check
User=@systemduser@
Group=@systemdgroup@
ExecStart=@appbindir@/app $ACCESS_CHECK_SERVER -m $ACCESS_CHECK_MODE -l $ACCESS_CHECK_URL $ACCESS_CHECK_OPTIONS
KillMode=process
[Install]
WantedBy=multi-user.target
ACCESS_CHECK_MODE=development
ACCESS_CHECK_SERVER=daemon
ACCESS_CHECK_URL=http://127.0.0.1:3000
ACCESS_CHECK_OPTIONS=
ACCESS_CHECK_CONFIG=@confdir@/manager.conf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment