From: Zbigniew Jędrzejewski-Szmek Date: Tue, 16 Dec 2025 16:18:40 +0000 (+0100) Subject: sysusers,tmpfiles: make standalone versions full-featured X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=795e066d2247bf298272105287c608cf6ae430d9;p=thirdparty%2Fsystemd.git 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.) --- 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);