systemd environment file: lookup for both /etc/default (debian like) and /etc/sysconfig (centos)#350
systemd environment file: lookup for both /etc/default (debian like) and /etc/sysconfig (centos)#350Adphi wants to merge 1 commit intokardianos:masterfrom
Conversation
…and /etc/sysconfig (centos) Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
|
This would be a breaking change for some users. On my OpenSUSE Micro Leap box, I have both an /etc/default directory and a /etc/sysconfig directory. The change looks in both, but returns the first of /etc/default and /etc/sysconfig, in that order. On my example system, it would shift from looking in sysconfig to default as they are both present. I don't know the correct answer here. I don't think this PR is it. |
|
Yes, but only if the environment file did not exist. For existing installation, unless I'm missing something, this should not change anything. |
|
The EnvironmentFile= parameter can be specified more than once in the systemd unit: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#EnvironmentFile=
I would suggest putting both into the template. If an existing installation has conflicting files in the two "standard" locations, things will get confusing anyway (service_systemd_linux.go around line 124) Anecdotally, the gitlab-runner project uses your library to install itself as a service. I needed to set an environment variable for it on my Ubuntu server, so I created /etc/default/gitlab-runner and updated the .service file to look to that. An upgrade broke things by overwriting my service change but wasn't obvious why, since /etc/default/gitlab-runner had all the settings appropriately. I ended up creating /etc/sysconfig/ and a symlink from |
As mentioned in the original Pull Request #80 (comment)