#include <sys/ioctl.h>
#include "log/log.h"
+#include "pb-protocol/pb-protocol.h"
#include "talloc/talloc.h"
#include "waiter/waiter.h"
#include "ui/common/discover-client.h"
struct cui_opt_data *cod = cod_from_item(item);
assert(cui->current == &cui->main->scr);
- assert(cui->on_boot);
pb_log("%s: %s\n", __func__, cod->name);
nc_scr_status_printf(cui->current, "Booting %s...", cod->name);
def_prog_mode();
- result = cui->on_boot(cui, cod);
+ result = discover_client_boot(cui->client, cod->dev, cod->opt, cod->bd);
reset_prog_mode();
redrawwin(cui->current->main_ncw);
clear();
mvaddstr(1, 0, "system is going down now...");
refresh();
- sleep(cui->dry_run ? 1 : 60);
+ } else {
+ nc_scr_status_printf(cui->current,
+ "Failed: boot %s", cod->bd->image);
}
- pb_log("%s: failed: %s\n", __func__, cod->bd->image);
- nc_scr_status_printf(cui->current, "Failed: kexec %s", cod->bd->image);
-
return 0;
}
*/
struct cui *cui_init(void* platform_info,
- int (*on_boot)(struct cui *, struct cui_opt_data *),
- int (*js_map)(const struct js_event *e), int start_deamon, int dry_run)
+ int (*js_map)(const struct js_event *e), int start_deamon)
{
struct cui *cui;
- struct discover_client *client;
unsigned int i;
cui = talloc_zero(NULL, struct cui);
cui->c_sig = pb_cui_sig;
cui->platform_info = platform_info;
- cui->on_boot = on_boot;
cui->timer.handle_timeout = cui_handle_timeout;
- cui->dry_run = dry_run;
cui->waitset = waitset_create(cui);
/* Loop here for scripts that just started the server. */
retry_start:
for (i = start_deamon ? 2 : 10; i; i--) {
- client = discover_client_init(cui->waitset,
+ cui->client = discover_client_init(cui->waitset,
&cui_client_ops, cui);
- if (client || !i)
+ if (cui->client || !i)
break;
pb_log("%s: waiting for server %d\n", __func__, i);
sleep(1);
}
- if (!client && start_deamon) {
+ if (!cui->client && start_deamon) {
int result;
start_deamon = 0;
goto fail_client_init;
}
- if (!client) {
+ if (!cui->client) {
pb_log("%s: discover_client_init failed.\n", __func__);
fprintf(stderr, "%s: error: discover_client_init failed.\n",
__func__);