sysusers,tmpfiles: make standalone versions full-featured

This effectively reverts 3537577c37. 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.)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-12-19 13:15:49 +01:00
parent 54492552a1
commit 795e066d22
2 changed files with 1 additions and 22 deletions
-11
View File
@@ -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)
+1 -11
View File
@@ -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);