Hi Systemd List! I have been trying today to pass some information into a container I set up with systemd-nspawn, using --setenv=SOMEVAR=foo. That works, I see SOMEVAR in /proc/1/environ of the container.
So far so good. Now I want to use that information to configure a service, so I add a script that does the necessary configuration as a ExecStartPre-step to a service file. This script takes the environment variables and puts them into a configuration file for the service. Unfortunately systemd does sanitize the environment before that script is started. That is actually a good thing that saved my hide before, but how can I make systemd export the necessary variable to that one unit that needs it this one time? The documentation on Environment in the service unit states that there is no variable expansion going on. And just as documented Environment=SOMEVAR does not work. Neither does Environment="SOMEVAR=$SOMEVAR" At least there is no surprise there. DefaultEnvironment in system.conf does export this variable to everybody. Do I need to do that? The documentation on DefaultEnvironment also makes no mention of passing variables already set in PID1 on to other processes. It seems to be about adding new variables, just as Environment and EnvironmentFile in the service units. Any idea how I can run trigger a script that see SOMEVAR as seen by PID1? Thanks, Tobias _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
