From 795e066d2247bf298272105287c608cf6ae430d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 16 Dec 2025 17:18:40 +0100 Subject: [PATCH] sysusers,tmpfiles: make standalone versions full-featured This effectively reverts 3537577c37d2c23a518540d36884a127aab944f8. Originally, the #ifdefs were added because we didn't want to pull in the whole tree of libmount and other dependencies in standalone versions. But dependencies are now loaded through dlopen(), so this is not needed anymore. (And doesn't even make much of a difference.) --- src/sysusers/sysusers.c | 11 ----------- src/tmpfiles/tmpfiles.c | 12 +----------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 9d46fbc5e53..3350826780f 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -2151,15 +2151,10 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_IMAGE: -#ifdef STANDALONE - return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), - "This systemd-sysusers version is compiled without support for --image=."); -#else r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_image); if (r < 0) return r; break; -#endif case ARG_IMAGE_POLICY: r = parse_image_policy_argument(optarg, &arg_image_policy); @@ -2283,10 +2278,8 @@ static int read_credential_lines(Context *c) { } static int run(int argc, char *argv[]) { -#ifndef STANDALONE _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; _cleanup_(umount_and_freep) char *mounted_dir = NULL; -#endif _cleanup_close_ int lock = -EBADF; _cleanup_(context_done) Context c = { .audit_fd = -EBADF, @@ -2314,7 +2307,6 @@ static int run(int argc, char *argv[]) { if (r < 0) return r; -#ifndef STANDALONE if (arg_image) { assert(!arg_root); @@ -2338,9 +2330,6 @@ static int run(int argc, char *argv[]) { if (!arg_root) return log_oom(); } -#else - assert(!arg_image); -#endif /* Prepare to emit audit events, but only if we're operating on the host system. */ if (!arg_root) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index a458f3ad901..90fe4b3d75c 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -4316,14 +4316,10 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_IMAGE: -#ifdef STANDALONE - return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), - "This systemd-tmpfiles version is compiled without support for --image=."); -#else r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_image); if (r < 0) return r; -#endif + /* Imply -E here since it makes little sense to create files persistently in the /run mountpoint of a disk image */ _fallthrough_; @@ -4560,10 +4556,8 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(item_array_hash_ops, char, string_ ItemArray, item_array_free); static int run(int argc, char *argv[]) { -#ifndef STANDALONE _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; _cleanup_(umount_and_freep) char *mounted_dir = NULL; -#endif _cleanup_strv_free_ char **config_dirs = NULL; _cleanup_(context_done) Context c = {}; bool invalid_config = false; @@ -4642,7 +4636,6 @@ static int run(int argc, char *argv[]) { if (r < 0) return r; -#ifndef STANDALONE if (arg_image) { assert(!arg_root); @@ -4666,9 +4659,6 @@ static int run(int argc, char *argv[]) { if (!arg_root) return log_oom(); } -#else - assert(!arg_image); -#endif c.items = ordered_hashmap_new(&item_array_hash_ops); c.globs = ordered_hashmap_new(&item_array_hash_ops); -- 2.47.3