2022-04-15 01:41:22 +00:00
|
|
|
From 85f0ad0cb7b4f0cfd482c9611f9cbc2dacbba33a Mon Sep 17 00:00:00 2001
|
2020-04-24 23:36:52 +00:00
|
|
|
From: Andreas Rammhold <andreas@rammhold.de>
|
|
|
|
Date: Fri, 2 Nov 2018 21:15:42 +0100
|
2022-01-13 20:06:32 +00:00
|
|
|
Subject: [PATCH 12/19] inherit systemd environment when calling generators.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
Systemd generators need access to the environment configured in
|
|
|
|
stage-2-init.sh since it schedules fsck and mkfs executions based on
|
|
|
|
being able to find an appropriate binary for the target filesystem.
|
|
|
|
|
|
|
|
With this commit I am altering the systemd behaviour since upstream
|
|
|
|
tries to gather environments with that they call
|
|
|
|
"environment-generators" and then seems to pass that on to all the other
|
|
|
|
executables that are being called from managers.
|
|
|
|
---
|
2021-09-26 12:46:18 +00:00
|
|
|
src/core/manager.c | 13 +++++++++----
|
|
|
|
1 file changed, 9 insertions(+), 4 deletions(-)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
diff --git a/src/core/manager.c b/src/core/manager.c
|
2022-04-15 01:41:22 +00:00
|
|
|
index 5b0bdb1bc7..1538a5200a 100644
|
2020-04-24 23:36:52 +00:00
|
|
|
--- a/src/core/manager.c
|
|
|
|
+++ b/src/core/manager.c
|
2022-04-15 01:41:22 +00:00
|
|
|
@@ -3653,10 +3653,15 @@ static int manager_run_generators(Manager *m) {
|
2020-04-24 23:36:52 +00:00
|
|
|
argv[4] = NULL;
|
|
|
|
|
|
|
|
RUN_WITH_UMASK(0022)
|
|
|
|
- (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, NULL, NULL,
|
2021-09-26 12:46:18 +00:00
|
|
|
- (char**) argv, m->transient_environment,
|
|
|
|
- EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS | EXEC_DIR_SET_SYSTEMD_EXEC_PID);
|
2020-04-24 23:36:52 +00:00
|
|
|
-
|
|
|
|
+ (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC,
|
|
|
|
+ // On NixOS we must propagate PATH to generators so they are
|
|
|
|
+ // able to find binaries such as `fsck.${fstype}` and
|
|
|
|
+ // `mkfs.${fstype}`. That is why the last argument of the
|
|
|
|
+ // function (envp) is set to NULL. This propagates systemd's
|
|
|
|
+ // environment (e.g. PATH) that was setup
|
|
|
|
+ // before calling systemd from stage-2-init.sh.
|
2021-09-26 12:46:18 +00:00
|
|
|
+ NULL, NULL, (char**) argv, /* NixOS: use inherited env */ NULL,
|
|
|
|
+ EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS | EXEC_DIR_SET_SYSTEMD_EXEC_PID);
|
2020-04-24 23:36:52 +00:00
|
|
|
r = 0;
|
|
|
|
|
|
|
|
finish:
|
|
|
|
--
|
2022-04-15 01:41:22 +00:00
|
|
|
2.34.0
|
2020-04-24 23:36:52 +00:00
|
|
|
|