Move boot to discover server
[petitboot] / ui / twin / pbt-client.c
index dfbe9552c32bca48a8c4f33700249896dd755c5e..c664740d04e726025fa56d5319c0d99a7d8cdb22 100644 (file)
@@ -62,18 +62,15 @@ static int pbt_client_boot(struct pbt_item *item)
        pbt_frame_status_printf(&item->pbt_client->frame, "Booting %s...",
                pbt_item_name(item));
 
-       assert(item->pbt_client->boot_cb);
-       result = item->pbt_client->boot_cb(item->pbt_client, opt_data);
+       result = discover_client_boot(item->pbt_client->discover_client,
+                       opt_data->dev, opt_data->opt, opt_data->bd);
 
-       if (!result) {
-               sleep(item->pbt_client->dry_run ? 1 : 60);
+       if (result) {
+               pb_log("%s: failed: %s\n", __func__, opt_data->bd->image);
+               pbt_frame_status_printf(&item->pbt_client->frame,
+                               "Failed: kexec %s", opt_data->bd->image);
        }
 
-       pb_log("%s: failed: %s\n", __func__, opt_data->bd->image);
-
-       pbt_frame_status_printf(&item->pbt_client->frame, "Failed: kexec %s",
-               opt_data->bd->image);
-
        return 0;
 }
 
@@ -265,7 +262,6 @@ static void pbt_client_destructor(struct pbt_client *client)
 
 struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
        unsigned int width, unsigned int height,
-       int (*boot_cb)(struct pbt_client *, struct pb_opt_data *),
        int start_deamon, int dry_run)
 {
        struct pbt_client *pbt_client;
@@ -284,7 +280,6 @@ struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
        pbt_client->waitset = waitset_create(pbt_client);
 
        pbt_client->sig = "pbt_client";
-       pbt_client->boot_cb = boot_cb;
        pbt_client->dry_run = dry_run;
        pbt_client->frame.scr = pbt_scr_init(pbt_client, pbt_client->waitset,
                        backend, width, height, NULL, NULL);