diff --git a/libdnf b/libdnf index 67440807f4..ec3a78fb63 160000 --- a/libdnf +++ b/libdnf @@ -1 +1 @@ -Subproject commit 67440807f4cb7eb0887f3e08de6ea589a2e2c823 +Subproject commit ec3a78fb635c079134b0db5c5b00b50d2e6927a8 diff --git a/src/app/rpmostree-pkg-builtins.cxx b/src/app/rpmostree-pkg-builtins.cxx index c2c55247bd..7114037360 100644 --- a/src/app/rpmostree-pkg-builtins.cxx +++ b/src/app/rpmostree-pkg-builtins.cxx @@ -46,6 +46,7 @@ static gboolean opt_uninstall_all; static gboolean opt_unchanged_exit_77; static gboolean opt_lock_finalization; static gboolean opt_force_replacefiles; +static guint opt_network_wait; static GOptionEntry option_entries[] = { { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" }, @@ -83,6 +84,8 @@ static GOptionEntry install_option_entry[] "Apply changes to both pending deployment and running filesystem tree", NULL }, { "force-replacefiles", 0, 0, G_OPTION_ARG_NONE, &opt_force_replacefiles, "Allow package to replace files from other packages", NULL }, + { "network-wait", 'N', 0, G_OPTION_ARG_INT, &opt_network_wait, + "Wait to reach into remote repository till network setup", "seconds" }, { NULL } }; static gboolean @@ -125,6 +128,8 @@ pkg_change (RpmOstreeCommandInvocation *invocation, RPMOSTreeSysroot *sysroot_pr g_variant_dict_insert (&dict, "lock-finalization", "b", opt_lock_finalization); if (opt_apply_live) g_variant_dict_insert (&dict, "apply-live", "b", opt_apply_live); + if (opt_network_wait) + g_variant_dict_insert (&dict, "network-wait", "u", opt_network_wait); g_autoptr (GVariant) options = g_variant_ref_sink (g_variant_dict_end (&dict)); gboolean met_local_pkg = FALSE; diff --git a/src/daemon/rpmostree-sysroot-upgrader.cxx b/src/daemon/rpmostree-sysroot-upgrader.cxx index d84e4f7de5..b0f2eb03e7 100644 --- a/src/daemon/rpmostree-sysroot-upgrader.cxx +++ b/src/daemon/rpmostree-sysroot-upgrader.cxx @@ -90,6 +90,7 @@ struct RpmOstreeSysrootUpgrader char *command_line; char *agent; char *sd_unit; + guint network_wait_timeout_secs; OstreeDeployment *cfg_merge_deployment; OstreeDeployment *origin_merge_deployment; @@ -905,6 +906,12 @@ prepare_context_for_assembly (RpmOstreeSysrootUpgrader *self, const char *tmproo return TRUE; } +void +rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, guint network_wait_sec) +{ + self->network_wait_timeout_secs = network_wait_sec; +} + /* Initialize libdnf context from our configuration */ static gboolean prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, GError **error) @@ -942,6 +949,9 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, error)) return FALSE; + dnf_context_set_network_timeout_seconds (rpmostree_context_get_dnf (self->ctx), + self->network_wait_timeout_secs); + if (rpmostree_origin_has_any_packages (self->computed_origin)) { if (!rpmostree_context_prepare (self->ctx, cancellable, error)) diff --git a/src/daemon/rpmostree-sysroot-upgrader.h b/src/daemon/rpmostree-sysroot-upgrader.h index 7a90dfe32a..f07aabb4cd 100644 --- a/src/daemon/rpmostree-sysroot-upgrader.h +++ b/src/daemon/rpmostree-sysroot-upgrader.h @@ -121,4 +121,7 @@ gboolean rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, GError **error); void rpmostree_sysroot_upgrader_set_kargs (RpmOstreeSysrootUpgrader *self, char **kernel_args); + +void rpmostree_sysroot_upgrader_set_network_wait (RpmOstreeSysrootUpgrader *self, + guint network_wait_sec); G_END_DECLS diff --git a/src/daemon/rpmostreed-transaction-types.cxx b/src/daemon/rpmostreed-transaction-types.cxx index 66f603bc06..102f5ae388 100644 --- a/src/daemon/rpmostreed-transaction-types.cxx +++ b/src/daemon/rpmostreed-transaction-types.cxx @@ -1557,6 +1557,12 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca return TRUE; } + guint network_wait_sec; + if (g_variant_dict_lookup (self->options, "network-wait", "u", &network_wait_sec)) + { + rpmostree_sysroot_upgrader_set_network_wait (upgrader, network_wait_sec); + } + RpmOstreeSysrootUpgraderLayeringType layering_type; gboolean layering_changed = FALSE; if (!rpmostree_sysroot_upgrader_prep_layering (upgrader, &layering_type, &layering_changed,