return 0;
}
-static int context_read_definitions(Context *c, const char* node) {
+static int context_read_definitions(Context *c, const char* node, bool requires_enabled_transfers) {
_cleanup_strv_free_ char **dirs = NULL, **files = NULL;
int r;
log_warning("As of v257, transfer definitions should have the '.transfer' extension.");
}
- if (c->n_transfers == 0) {
+ if (c->n_transfers + (requires_enabled_transfers ? 0 : c->n_disabled_transfers) == 0) {
if (arg_component)
return log_error_errno(SYNTHETIC_ERRNO(ENOENT),
"No transfer definitions for component '%s' found.",
return 0;
}
-static int context_make_offline(Context **ret, const char *node) {
+static int context_make_offline(Context **ret, const char *node, bool requires_enabled_transfers) {
_cleanup_(context_freep) Context* context = NULL;
int r;
if (!context)
return log_oom();
- r = context_read_definitions(context, node);
+ r = context_read_definitions(context, node, requires_enabled_transfers);
if (r < 0)
return r;
/* Like context_make_offline(), but also communicates with the update source looking for new
* versions (as long as --offline is not specified on the command line). */
- r = context_make_offline(&context, node);
+ r = context_make_offline(&context, node, /* requires_enabled_transfers= */ true);
if (r < 0)
return r;
if (r < 0)
return r;
- r = context_make_offline(&context, loop_device ? loop_device->node : NULL);
+ r = context_make_offline(&context, loop_device ? loop_device->node : NULL, /* requires_enabled_transfers= */ false);
if (r < 0)
return r;
if (r < 0)
return r;
- r = context_make_offline(&context, loop_device ? loop_device->node : NULL);
+ r = context_make_offline(&context, loop_device ? loop_device->node : NULL, /* requires_enabled_transfers= */ false);
if (r < 0)
return r;
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"The --root=/--image= switches may not be combined with the '%s' operation.", argv[0]);
- r = context_make_offline(&context, NULL);
+ r = context_make_offline(&context, /* node= */ NULL, /* requires_enabled_transfers= */ true);
if (r < 0)
return r;