[systemd-devel] How to set environment variable that is available for later services/shell
Sam Ravnborg
sam at ravnborg.org
Sat Mar 11 17:14:17 UTC 2017
Hi all.
How can we set environment variables so they are available for everyone?
Background:
On an embedded target we use QT applications.
To start our QT application we need to set environment variables:
QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:mmsize=154x86:size=800x480
...
For now we use:
[Service]
EnvironmentFile=/etc/foo.conf
This has two drawbacks:
1) We cannot start the QT application from the
command-line (unless we source the .conf file)
2) We need to use different .conf files (thus different
.service files) depending on the HW configuration (display type/size)
So we are looking for a way to set the environment variables early
such that they are available in the services launced later,
and they are available in the shell.
The actual system configuration will determine the values and
it may differ from boot to boot.
Thanks in advance,
Sam
More information about the systemd-devel
mailing list