condition: add ConditionEnvironment=

Prompted by the discussions in #15180.

This is a bit more complex than I hoped, since for PID 1 we need to pass
in the synethetic environment block in we generate on demand.
This commit is contained in:
Lennart Poettering
2020-05-15 16:05:33 +02:00
parent 7cd9e4f8a0
commit a0b191b705
9 changed files with 226 additions and 134 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
#include <unistd.h>
#include "alloc-util.h"
#include "bond.h"
@@ -693,7 +694,7 @@ int netdev_load_one(Manager *manager, const char *filename) {
return r;
/* skip out early if configuration does not match the environment */
if (!condition_test_list(netdev_raw->conditions, NULL, NULL, NULL)) {
if (!condition_test_list(netdev_raw->conditions, environ, NULL, NULL, NULL)) {
log_debug("%s: Conditions in the file do not match the system environment, skipping.", filename);
return 0;
}