• Thomas Haller's avatar
    dispatcher: add NM_DISPATCHER_ACTION environment variable · 2800232b
    Thomas Haller authored
    Previously, the action was only passed as the first command line
    argument to the dispatcher scripts. Now, also set it via the
    "$NM_DISPATCHER_ACTION" environment variable.
    
    The main purpose is to have a particular, nm-dispatcher specific
    variable that is always set inside the dispatcher scripts.
    For example, imagine you have a script that can be either called by
    dispatcher or some other means (manually, or spawned via
    /etc/NetworkManager/dispatcher.d/11-dhclient).  Then it might make
    sense to differenciate from inside the script whether you are called
    by nm-dispatcher. But previously, there was no specific environment
    variable that was always set inside the dispatcher event. For example,
    with the "hostname" action there are no other environment variables.
    
    Now (with version 1.12), you can check for `test -n "$NM_DISPATCHER_ACTION"`.
    
    (cherry picked from commit ce961904)
    2800232b
NetworkManager.xml 23.7 KB