sysupdate: Change feature/component enablement and disablement (#43191)
- sysupdate: In the auto-enable service, don't enable all features
The auto-enable service should activate suggested components and
features but enabled all features which includes the default components
unsuggested features and any unsuggested features of the suggested
components. This is unexpected behavior and we rather want this service
to be limited to suggested features.
Switch the service flag to suggested and make the wording more explicit
in the man page. Also fix the wrong statement that it operates on
enabled components, it operates on all components, also explicitly
disabled ones.
- sysupdate: Change disabling with
--component-suggested/--feature-suggested
The disabling of features or components with the flag
--component-suggested/--feature-suggested didn't disable the suggested
ones but instead disabled all other ones. This is rather unintuitive due
to how the flags are named and also not really needed because the
intended reconciliation outcome can instead be done by first disabling
everything and then enabling the suggested ones again which is easier to
reason about. For components the tricky part is that they default to
enabled and thus it's better to have the disable/enable commands with
--component-suggested operate only on suggested ones instead of touching
others like "legacy" components that don't explicity say whether they
are enabled and suggested or not.
Make running disablement of components/features with
--component-suggested/--feature-suggested undo a previous enablement
with the same flags. Document how one can align the system to only use
suggested components/features and not anything else by doing it in two
steps, first disabling everything and then enabling suggested ones. This
also makes it clearer now that all components that are not explicitly
enabled nor suggested will be disabled then.
This commit is contained in:
@@ -2244,9 +2244,9 @@ static int context_enable_feature(
|
||||
HASHMAP_FOREACH(f, c->features) {
|
||||
r = feature_is_suggested(f);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine if feature '%s' of component '%s' shall be enabled: %m", f->id, context_component_display(c));
|
||||
if (!!r != !!enable) {
|
||||
log_debug("Skipping feature '%s' of component '%s'.", f->id, context_component_display(c));
|
||||
return log_error_errno(r, "Failed to determine if feature '%s' of component '%s' is suggested: %m", f->id, context_component_display(c));
|
||||
if (r == 0) {
|
||||
log_debug("Feature '%s' of component '%s' is not suggested, skipping.", f->id, context_component_display(c));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3245,15 +3245,11 @@ static int verb_enable_component(int argc, char *argv[], uintptr_t _data, void *
|
||||
|
||||
r = context_component_is_suggested(&cc);
|
||||
if (r < 0) {
|
||||
log_warning_errno(r, "Failed to determine whether '%s' shall be enabled, skipping: %m", *name);
|
||||
log_warning_errno(r, "Failed to determine whether '%s' is suggested, skipping: %m", *name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* This reconciles the system with the suggestions: on 'enable-component' we act on
|
||||
* the components that are suggested, on 'disable-component' we act on the ones that
|
||||
* are not. Hence pick the components whose suggestion state matches the operation. */
|
||||
if (!!r != !!enable) {
|
||||
log_debug("Skipping '%s'.", *name);
|
||||
if (r == 0) {
|
||||
log_debug("Component '%s' is not suggested, skipping.", *name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user