[systemd-devel] Where to put the environment files?

Kay Sievers kay.sievers at vrfy.org
Sat Sep 24 04:36:12 PDT 2011


On Sat, Sep 24, 2011 at 10:57, Thomas Meyer <thomas at m3y3r.de> wrote:
> is there a recommendation where to best put the environment files? and
> what file extension should these files have?
>
> I did prepare this service unit for apache derby and did put the
> environment file into /usr/share/java/derby/
>
> [Unit]
> Description=Apache Derby Database Network Server
> After=network.target
>
> [Service]
> Type=simple
> EnvironmentFile=/usr/share/java/derby/derbyNetworkServer.env
> WorkingDirectory=/var/lib/derby
> StandardOutput=syslog
> User=derby
> ExecStart=/usr/bin/java org.apache.derby.drda.NetworkServerControl start
>
> [Install]
> WantedBy=multi-user.target

Ideally this server would read its own config file from
/usr/lib/java/foo.conf and /etc/java/foo.conf, with the usual
admin-overwrite logic. If the file in etc exists the file in lib is
ignored. That way packages ship the default settings, but admins can
overwrite them in etc.

If systemd's EnvironmentFile= needs to be used, and the env file is
supposed to be editable by the user, it needs to live in /etc. Things
in /usr should never be edited, it should be installed by packages
only and stay unmodified.

In general, we recommend to always use "application private
directories" like /usr/lib/java instead of /usr/share/java. Make sure
that never ends up in lib64, these directories are always lib, never
lib64.

The original definition of /usr/share, to be able to share across
hosts, makes not much sense these days. But stuff that is really
'shared' across multiple packages like icons, is something generic, or
provides meta directories like 'man', sounds like a good fit. Stuff
that is private to a specific package or domain is not so much.

Kay


More information about the systemd-devel mailing list