From f7bacf8b1bf70da194065955a5d75bbcff1d9f2c Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 22 Feb 2023 19:53:36 +0100 Subject: [PATCH] Add 'set' keyword for environment variables set in /etc/finit.conf Signed-off-by: Joachim Wiberg --- doc/config.md | 8 +++++--- src/conf.c | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/config.md b/doc/config.md index a4abc3c0..dbce328e 100644 --- a/doc/config.md +++ b/doc/config.md @@ -207,10 +207,12 @@ and any `*.conf`, was added. It is worth noting that these are global and *shared with all* services -- the only way to have service-local environment is detailed in the next section. -The syntax for global environment variables is straight forward: +The syntax for global environment variables is straight forward. In +Finit v4.4 the `set` keyword was added for completeness, but the old +syntax (without the `set ` prefix) is still honored: - foo=bar - baz="qux" + set foo=bar + set baz="qux" On reload of .conf files, all tracked environment variables are cleared so if `foo=bar` is removed from `finit.conf`, or any `finit.d/*.conf` diff --git a/src/conf.c b/src/conf.c index 56eabdef..1ac5af20 100644 --- a/src/conf.c +++ b/src/conf.c @@ -708,6 +708,11 @@ static int parse_static(char *line, int is_rcsd) return 0; } + if (BOOTSTRAP && MATCH_CMD(line, "set ", x)) { + parse_env(x); + return 0; + } + if (MATCH_CMD(line, "include ", x)) { char *file = strip_line(x);