sysupdate: include default component for feature-all

--component-all is documented to include the default component-less
installation. Do not drop it merely because the context operates on a
root/image, or because all its transfers are currently disabled by
features.

This lets --component-all --feature-all enable-feature write the
default component feature drop-ins instead of succeeding with no
components selected.

TEST-72-SYSUPDATE covers both all transfers disabled by features and
the same default component feature operation under --root=.

Repro: create a default feata.feature plus a transfer gated by feata,
then run:
build/systemd-sysupdate --root="$root" --component-all --feature-all enable-feature

Before: no drop-in was written.

Follow-up for: 4481661a75
This commit is contained in:
dongshengyuan
2026-07-26 15:26:06 +08:00
parent b03503a116
commit bbe99a925b
2 changed files with 47 additions and 5 deletions
+3 -5
View File
@@ -2949,15 +2949,13 @@ static int context_list_components(Context *context, char ***ret_component_names
if (ret_component_names)
*ret_component_names = TAKE_PTR(z);
/* Does the system have at least one transfer file in /etc/sysupdate.d, which can be considered a
* TARGET_HOST? See target_get_argument() in sysupdated.c */
/* Does the system have at least one transfer file in sysupdate.d, which can be considered the
* default component-less installation? */
if (ret_has_default_component)
*ret_has_default_component =
!context->definitions &&
!context->component &&
!context->root &&
!context->image &&
context->n_transfers > 0;
context->n_transfers + context->n_disabled_transfers > 0;
return 0;
}