From 14361f6dd9ee37bd96170f3d21d65f8758e6b5aa Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Tue, 29 Aug 2023 13:42:16 +0200 Subject: [PATCH 1/2] sysext: fix `--root=` support when provided `--root=` was failing for `status`: ``` $ systemd-sysext --root=/mnt status Failed to open '/usr/.systemd-sysext/extensions': No such file or directory ``` path was not relative to the given `--root` - same goes for the `need_reload` as it was inspired from the `verb_status` section. Signed-off-by: Mathieu Tortuyaux --- src/sysext/sysext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index fbb6bcdc83..e7e2478d1e 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -180,7 +180,7 @@ static int need_reload(void) { if (!r) continue; - f = path_join(*p, image_class_info[arg_image_class].dot_directory_name, image_class_info[arg_image_class].short_identifier_plural); + f = path_join(resolved, image_class_info[arg_image_class].dot_directory_name, image_class_info[arg_image_class].short_identifier_plural); if (!f) return log_oom(); @@ -348,7 +348,7 @@ static int verb_status(int argc, char **argv, void *userdata) { continue; } - f = path_join(*p, image_class_info[arg_image_class].dot_directory_name, image_class_info[arg_image_class].short_identifier_plural); + f = path_join(resolved, image_class_info[arg_image_class].dot_directory_name, image_class_info[arg_image_class].short_identifier_plural); if (!f) return log_oom(); From 6a69b0d6d83cceb06212d40f360bbd578c11f609 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Tue, 29 Aug 2023 10:52:38 +0200 Subject: [PATCH 2/2] sysext: skip the reload if `--root=` is provided Signed-off-by: Mathieu Tortuyaux --- src/sysext/sysext.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index e7e2478d1e..893d4ce66e 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -1138,6 +1138,8 @@ static int parse_argv(int argc, char *argv[]) { r = parse_path_argument(optarg, false, &arg_root); if (r < 0) return r; + /* If --root= is provided, do not reload the service manager */ + arg_no_reload = true; break; case ARG_JSON: