-
Notifications
You must be signed in to change notification settings - Fork 321
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
Add systemd service file #633
Conversation
021e0ef
to
9e7663c
Compare
9e7663c
to
41cd81f
Compare
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.
Hello Dimitri,
I would tend to not package the systemd service file here:
- Although I'm a big supporter of systemd, not all GNU/Linux distributions use it. If we add it to solve Systemd service file #623, I hope users won't ask files for sysvinit, OpenRC, supervisord, etc.
- I won't have time to maintain it if users experience problems on fancy distros.
But since you've already done it why not!
-
With this change openfortivpn installs its systemd service file outside $(prefix)
It's fine to me.
By curiosity, have you compared with other C programs that create systemd service files? For example here is what they do for
sshd
systemd service:
https://src.fedoraproject.org/rpms/openssh/blob/4e7cdec/f/openssh-7.4p1-systemd.patch -
About
Makefile.am
, it looks OK to me, but please note that I'm not skilled withautomake
.
41cd81f
to
7a5270e
Compare
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 have found a hard coded path in lib/systemd/system/[email protected]
. I would recommend to fix this.
Apart from that I'm not sure if the @
in the file name could cause problems with git, with the file system, with packaging tools, with web tools that show the source code, automake that processes it (or the path of the input file)... Perhaps I'm too skeptic in this regard...
Anyhow, I'm not very familiar with systemd. I see on my Ubuntu that only a few services follow this convention, whereas most of them have file names consisting of alphanumeric characters. Does it have a special meaning?
Perhaps the source can be named lib/systemd/system/openfortivpn.service.in
and we install to the final destination.
Also are we sure that we want to install into the systemd directory opposed to the strategy of providing a sample file like the ppp scripts that we have included but don't install and the config file template that we install to the share directory?
if ! test -f $(DESTDIR)$(confdir)/config ; then \ | ||
$(MKDIR_P) $(DESTDIR)$(confdir) ; \ | ||
$(INSTALL) -m 600 etc/openfortivpn/config \ | ||
$(DESTDIR)$(confdir)/config ; \ | ||
fi | ||
if HAVE_SYSTEMD |
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 with test
inside Makefile.am
- but I'm fine with the if HAVE_SYSTEMD
. It's more elegant, I just didn't know about this possibility.
7a5270e
to
76001e5
Compare
That's a good idea. I had looked into this rapidly. Perhaps I can have a look again. However my concern is that there are multiple ways to "support systemd":
The main concern is that I am using
Perhaps as a first step we can skip these subtleties. If using a single conditional for both goals later appears to be a problem later on, I will fix that. |
It doesn't appear to be an issue. Matlab also has files with
Yes, the
and use them in distinct services Here is short and well-written introduction to systemd service files
If it works as is with the
I don't know. It will mean more work for packagers to patch the Makefile to add the service file in packages. What if I investigate what other software do? Let me see how they handle this. |
76001e5
to
9b6d54c
Compare
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.
ok, @BINDIR@
is the correct solution
a2d466f
to
dab3bd1
Compare
The case of util-linux is interesting:
I will try to improve the Makefile based on this. |
Allows openfortivpn to act as system service. The configuration is expected under $(sysconfdir)/openfortivpn/<NAME>.conf. https://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20systemd%20Service%20Files
dab3bd1
to
d4758cd
Compare
Fixes #623.
The
configure.ac
changes are documented in the systemd man page:https://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20systemd%20Service%20Files
Allows openfortivpn to act as system service.
There are a couple issues that bother me:
${prefix}
, including the default configuration file under$(sysconfdir)/openfortivpn
→$(prefix)/etc/openfortivpn
. With this change openfortivpn installs its systemd service file outside$(prefix)
, under$(systemdsystemunitdir)
→/lib/systemd/system/
. That's by design of course but I thought I'd mention it.Makefile.am
right, on the contrary. My concern is conditionals in the Makefile - with/without systemd service files. The Makefile should function properly whatever the conditions. It seems to be working but I'm not convinced. Some help appreciated here.