mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Allow Finit to inherit PATH and SHELL from env.
When started as a monitor in a container, or for the test suite run from distcheck, we must allow Finit to find its own tools like initctl. This should also be a more generic solution that cover more cases. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
47d8a83668
commit
2526431d8e
1 file changed
+13
-2
+13
-2
@@ -78,6 +78,9 @@ static uev_t etcw;
|
|||||||
|
|
||||||
static TAILQ_HEAD(, conf_change) conf_change_list = TAILQ_HEAD_INITIALIZER(conf_change_list);
|
static TAILQ_HEAD(, conf_change) conf_change_list = TAILQ_HEAD_INITIALIZER(conf_change_list);
|
||||||
|
|
||||||
|
static char *path;
|
||||||
|
static char *shell;
|
||||||
|
|
||||||
static int parse_conf(char *file, int is_rcsd);
|
static int parse_conf(char *file, int is_rcsd);
|
||||||
static void drop_changes(void);
|
static void drop_changes(void);
|
||||||
|
|
||||||
@@ -326,6 +329,8 @@ void conf_parse_cmdline(int argc, char *argv[])
|
|||||||
fstab = strdup(FINIT_FSTAB);
|
fstab = strdup(FINIT_FSTAB);
|
||||||
finit_conf = strdup(FINIT_CONF);
|
finit_conf = strdup(FINIT_CONF);
|
||||||
finit_rcsd = strdup(FINIT_RCSD);
|
finit_rcsd = strdup(FINIT_RCSD);
|
||||||
|
path = getenv("PATH");
|
||||||
|
shell = getenv("SHELL");
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
parse_arg(argv[i]);
|
parse_arg(argv[i]);
|
||||||
@@ -351,8 +356,14 @@ void conf_reset_env(void)
|
|||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
setenv("PATH", _PATH_STDPATH, 1);
|
if (path)
|
||||||
setenv("SHELL", _PATH_BSHELL, 1);
|
setenv("PATH", path, 1);
|
||||||
|
else
|
||||||
|
setenv("PATH", _PATH_STDPATH, 1);
|
||||||
|
if (shell)
|
||||||
|
setenv("SHELL", shell, 1);
|
||||||
|
else
|
||||||
|
setenv("SHELL", _PATH_BSHELL, 1);
|
||||||
setenv("LOGNAME", "root", 1);
|
setenv("LOGNAME", "root", 1);
|
||||||
setenv("USER", "root", 1);
|
setenv("USER", "root", 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user