[systemd-bugs] [Bug 90100] New: systemctl needs a --setenv option for per-unit environment modification

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Apr 19 09:47:17 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=90100

            Bug ID: 90100
           Summary: systemctl needs a --setenv option for per-unit
                    environment modification
           Product: systemd
           Version: unspecified
          Hardware: Other
                OS: Linux (All)
            Status: NEW
          Severity: enhancement
          Priority: medium
         Component: general
          Assignee: systemd-bugs at lists.freedesktop.org
          Reporter: w.rouesnel at gmail.com
        QA Contact: systemd-bugs at lists.freedesktop.org

systemd-nspawn in 218 has added the --setenv option to pass environment
variables from the command line to the spawned init daemon.

A missing complement to this is allowing custom environment variables to be
passed from systemctl to the unit file being run.

Proposed syntax:
systemctl --setenv KEY=VALUE --setenv KEY2=VALUE2 start SomeUnitFile

This is important since when scripting unit file launches, which in turn may
launch containers (or simply other programs) it is desirable to set unknown
environment parameters at runtime - i.e. pass a set of environment from
systemctl to the unit file environment, to systemd-nspawn, to the container
environment.

The current way around this is to write to a (hopefully) available file
location, and have the unit file source that environment. Or have the unit file
be dynamically generated under /run/systemd. Both of these needlessly increase
script complexity.

systemctl already provides a separate set-environment option, but this acts
globally on the session, which is undesirable when using local scripts.

A use case for this is when interacting with daemons which run shell scripts
externally on certain actions and pass parameters by environment variables - or
using units which may contain special debugging option calls.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20150419/bec08f09/attachment-0001.html>


More information about the systemd-bugs mailing list