From: Daan De Meyer Date: Fri, 14 Nov 2025 08:10:18 +0000 (+0100) Subject: run0: Make --same-root-dir available for run0 X-Git-Tag: v259-rc1~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=475729b80532dfbbce98705dade6570ce5cc29f0;p=thirdparty%2Fsystemd.git run0: Make --same-root-dir available for run0 This enables running something like "mkosi box -- run0 --empower --same-root-dir -E PATH" to get an empowered session as the current user within the "mkosi box" environment. --- diff --git a/man/run0.xml b/man/run0.xml index d44743620e2..01e6b4b9f72 100644 --- a/man/run0.xml +++ b/man/run0.xml @@ -302,6 +302,15 @@ + + + + Execute the run0 session in the same root directory that the + run0 command is executed in. + + + + diff --git a/src/run/run.c b/src/run/run.c index 1286ae176ef..d1202632ac7 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -899,6 +899,7 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) { ARG_AREA, ARG_VIA_SHELL, ARG_EMPOWER, + ARG_SAME_ROOT_DIR, }; /* If invoked as "run0" binary, let's expose a more sudo-like interface. We add various extensions @@ -929,6 +930,7 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) { { "lightweight", required_argument, NULL, ARG_LIGHTWEIGHT }, { "area", required_argument, NULL, ARG_AREA }, { "empower", no_argument, NULL, ARG_EMPOWER }, + { "same-root-dir", no_argument, NULL, ARG_SAME_ROOT_DIR }, {}, }; @@ -1072,6 +1074,13 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) { arg_empower = true; break; + case ARG_SAME_ROOT_DIR: + r = free_and_strdup_warn(&arg_root_directory, "/"); + if (r < 0) + return r; + + break; + case '?': return -EINVAL;