mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 22:48:01 +02:00
dispatcher: add NM_DISPATCHER_ACTION environment variable
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"`.
This commit is contained in:
parent
4822bff7aa
commit
ce9619047c
3 changed files with 10 additions and 0 deletions
1
NEWS
1
NEWS
|
|
@ -47,6 +47,7 @@ Notable changes include:
|
|||
The following features were backported to 1.10.x releases from 1.10.0 to
|
||||
1.10.10 are also present in NetworkManager-1.12:
|
||||
|
||||
* Set NM_DISPATCHER_ACTION environment variable in dispatcher scripts.
|
||||
* Fix crash during reapply of connection settings
|
||||
* Fix connectivity timeout handling (bgo #794464),
|
||||
* Retry activating devices when the parent becomes managed (rh #1553595),
|
||||
|
|
|
|||
|
|
@ -575,6 +575,8 @@ done:
|
|||
|
||||
_items_add_key0 (items, NULL, "PATH", g_getenv ("PATH"));
|
||||
|
||||
_items_add_key (items, NULL, "NM_DISPATCHER_ACTION", action);
|
||||
|
||||
*out_error_message = NULL;
|
||||
g_ptr_array_add (items, NULL);
|
||||
return (char **) g_ptr_array_free (g_steal_pointer (&items), FALSE);
|
||||
|
|
|
|||
|
|
@ -181,6 +181,13 @@
|
|||
The environment contains more information about the interface and the connection.
|
||||
The following variables are available for the use in the dispatcher scripts:
|
||||
<variablelist class="dispatcher-environment">
|
||||
<varlistentry>
|
||||
<term><varname>NM_DISPATCHER_ACTION</varname></term>
|
||||
<listitem><para>
|
||||
The dispatcher action like "up" or "dhcp4-change", identical to the first
|
||||
command line argument. Since NetworkManager 1.12.0.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>CONNECTION_UUID</varname></term>
|
||||
<listitem><para>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue