-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add systemd service file #633
Merged
DimitriPapadopoulos
merged 1 commit into
adrienverge:master
from
DimitriPapadopoulos:systemd.service
Apr 16, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ openfortivpn | |
doc/*.1 | ||
config.sub | ||
config.guess | ||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,33 +18,76 @@ openfortivpn_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \ | |
openfortivpn_CPPFLAGS += $(OPENSSL_CFLAGS) $(LIBSYSTEMD_CFLAGS) | ||
openfortivpn_LDADD = $(OPENSSL_LIBS) $(LIBSYSTEMD_LIBS) | ||
|
||
DISTCHECK_CONFIGURE_FLAGS = CFLAGS=-Werror | ||
PATHFILES = | ||
CLEAN_LOCALS = | ||
EXTRA_DIST = \ | ||
autogen.sh \ | ||
CHANGELOG.md \ | ||
LICENSE \ | ||
LICENSE.OpenSSL \ | ||
README.md | ||
|
||
confdir=$(sysconfdir)/@PACKAGE@ | ||
DISTCHECK_CONFIGURE_FLAGS = \ | ||
CFLAGS=-Werror \ | ||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) | ||
|
||
# configuration file template | ||
datadir=$(prefix)/share/@PACKAGE@ | ||
data_DATA=etc/openfortivpn/config.template | ||
|
||
EXTRA_DIST += $(data_DATA) | ||
|
||
# initial configuration file | ||
confdir=$(sysconfdir)/@PACKAGE@ | ||
|
||
etc/openfortivpn/config: $(srcdir)/etc/openfortivpn/config.template | ||
@$(MKDIR_P) etc/openfortivpn | ||
$(AM_V_GEN)$(SED) -e '/^#/n;/^\s*$$/n;s/^/# /' $(srcdir)/etc/openfortivpn/config.template >$@ | ||
|
||
install-data-hook: etc/openfortivpn/config | ||
install-data-hook: etc/openfortivpn/config lib/systemd/system/[email protected] | ||
if ! test -f $(DESTDIR)$(confdir)/config ; then \ | ||
$(MKDIR_P) $(DESTDIR)$(confdir) ; \ | ||
$(INSTALL) -m 600 etc/openfortivpn/config \ | ||
$(DESTDIR)$(confdir)/config ; \ | ||
fi | ||
|
||
clean-local-config: | ||
-rm -f $(top_builddir)/etc/openfortivpn/config | ||
|
||
CLEAN_LOCALS += clean-local-config | ||
|
||
# systemd service file | ||
PATHFILES += lib/systemd/system/[email protected] | ||
|
||
if HAVE_SYSTEMD | ||
lib/systemd/system/[email protected]: $(srcdir)/lib/systemd/system/[email protected] | ||
@$(MKDIR_P) lib/systemd/system | ||
$(AM_V_GEN)$(SED) -e 's|[@]BINDIR[@]|$(bindir)|g;s|[@]SYSCONFDIR[@]|$(sysconfdir)|g' $(srcdir)/lib/systemd/system/[email protected] >$@ | ||
|
||
systemdsystemunit_DATA = lib/systemd/system/[email protected] | ||
|
||
clean-local-systemd: | ||
-rm -f $(top_builddir)/lib/systemd/system/[email protected] | ||
|
||
CLEAN_LOCALS += clean-local-systemd | ||
endif | ||
|
||
# man page | ||
PATHFILES += doc/openfortivpn.1 | ||
dist_man_MANS = doc/openfortivpn.1 | ||
|
||
doc/openfortivpn.1: $(srcdir)/doc/openfortivpn.1.in | ||
@$(MKDIR_P) doc | ||
$(AM_V_GEN)$(SED) -e 's|[@]SYSCONFDIR[@]|$(sysconfdir)|g;s|[@]DATADIR[@]|$(datadir)|g' $(srcdir)/doc/openfortivpn.1.in >$@ | ||
|
||
all-local: etc/openfortivpn/config | ||
clean-local-man: | ||
-rm -f $(top_builddir)/doc/openfortivpn.1 | ||
|
||
clean-local: | ||
-rm -f etc/openfortivpn/config | ||
-rm -f doc/openfortivpn.1 | ||
CLEAN_LOCALS += clean-local-man | ||
|
||
|
||
EXTRA_DIST += $(PATHFILES:=.in) | ||
|
||
all-local: etc/openfortivpn/config | ||
|
||
EXTRA_DIST = autogen.sh CHANGELOG.md LICENSE LICENSE.OpenSSL README.md doc/openfortivpn.1.in $(data_DATA) | ||
clean-local: $(CLEAN_LOCALS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=OpenFortiVPN for %I | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=simple | ||
PrivateTmp=true | ||
ExecStart=@BINDIR@/openfortivpn -c @SYSCONFDIR@/openfortivpn/%I.conf | ||
OOMScoreAdjust=-100 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware that such an if construct works in the .am file, but if it works, why not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've seen it used in other Makefiles, not certain how standard this is. If you have alternatives I'm interested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have used
AC_SUBST
in configure.ac and compare it as a string withtest
insideMakefile.am
- but I'm fine with theif HAVE_SYSTEMD
. It's more elegant, I just didn't know about this possibility.