summaryrefslogtreecommitdiffstats
path: root/ui/twin
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-27 19:59:09 -0700
committerGeoff Levand <geoff@infradead.org>2012-03-27 19:59:09 -0700
commit59e81c46a962da51e51474e9b36258ff0e04ae42 (patch)
tree036563070462f2c8d936037e4545965e89a6516a /ui/twin
parentb5958d7864822ec3151edda616952d1d401b139a (diff)
downloadtalos-petitboot-59e81c46a962da51e51474e9b36258ff0e04ae42.tar.gz
talos-petitboot-59e81c46a962da51e51474e9b36258ff0e04ae42.zip
Add UI option --dry-run
Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'ui/twin')
-rw-r--r--ui/twin/main-generic.c6
-rw-r--r--ui/twin/pbt-client.c7
-rw-r--r--ui/twin/pbt-client.h3
-rw-r--r--ui/twin/pbt-main.c15
-rw-r--r--ui/twin/pbt-main.h3
5 files changed, 21 insertions, 13 deletions
diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c
index 7cf510a..1e665b3 100644
--- a/ui/twin/main-generic.c
+++ b/ui/twin/main-generic.c
@@ -199,7 +199,7 @@ fail_menu:
return NULL;
}
-static int kexec_cb(__attribute__((unused)) struct pbt_client *client, struct pb_opt_data *opt_data)
+static int kexec_cb(struct pbt_client *client, struct pb_opt_data *opt_data)
{
int result;
@@ -207,7 +207,7 @@ static int kexec_cb(__attribute__((unused)) struct pbt_client *client, struct pb
pb_log("%s: %s\n", __func__, opt_data->name);
- result = pb_run_kexec(opt_data->kd);
+ result = pb_run_kexec(opt_data->kd, client->dry_run);
return result;
}
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
}
client = pbt_client_init(opts.backend, 900, 300, kexec_cb,
- opts.start_daemon);
+ opts.start_daemon, opts.dry_run);
if (!client) {
ui_result = EXIT_FAILURE;
diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c
index 711248a..1170b34 100644
--- a/ui/twin/pbt-client.c
+++ b/ui/twin/pbt-client.c
@@ -262,10 +262,10 @@ static void pbt_client_destructor(struct pbt_client *client)
memset(client, 0, sizeof(*client));
}
-struct pbt_client *pbt_client_init(enum pbt_twin_backend backend, unsigned int width,
- unsigned int height,
+struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
+ unsigned int width, unsigned int height,
int (*kexec_cb)(struct pbt_client *, struct pb_opt_data *),
- int start_deamon)
+ int start_deamon, int dry_run)
{
struct pbt_client *pbt_client;
unsigned int i;
@@ -282,6 +282,7 @@ struct pbt_client *pbt_client_init(enum pbt_twin_backend backend, unsigned int w
pbt_client->sig = "pbt_client";
pbt_client->kexec_cb = kexec_cb;
+ pbt_client->dry_run = dry_run;
pbt_client->frame.scr = pbt_scr_init(pbt_client, backend, width, height,
NULL, NULL);
diff --git a/ui/twin/pbt-client.h b/ui/twin/pbt-client.h
index 119bc94..014d5b2 100644
--- a/ui/twin/pbt-client.h
+++ b/ui/twin/pbt-client.h
@@ -42,6 +42,7 @@ void pbt_frame_status_printf(struct pbt_frame *frame, const char *format, ...);
struct pbt_client {
const char *sig;
+ int dry_run;
struct pb_signal_data signal_data;
void *client_data;
int (*kexec_cb)(struct pbt_client *pbt_client, struct pb_opt_data *pod);
@@ -53,7 +54,7 @@ struct pbt_client {
struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
unsigned int width, unsigned int height,
int (*kexec_cb)(struct pbt_client *, struct pb_opt_data *),
- int start_deamon);
+ int start_deamon, int dry_run);
void pbt_client_destroy(struct pbt_client *client);
void pbt_client_resize(struct pbt_client *client);
diff --git a/ui/twin/pbt-main.c b/ui/twin/pbt-main.c
index a8c1ea5..84e824e 100644
--- a/ui/twin/pbt-main.c
+++ b/ui/twin/pbt-main.c
@@ -34,8 +34,9 @@ void pbt_print_usage(void)
{
pbt_print_version();
printf(
-"Usage: petitboot-twin [-d, --start-daemon] [-h, --help] [-l, --log log-file]\n"
-" [-r, --reset-defaults][-t, --timeout] [-V, --version]\n"
+"Usage: petitboot-twin [-d, --dry-run] [-h, --help] [-l, --log log-file]\n"
+" [-r, --reset-defaults] [-s, --start-daemon]\n"
+" [-t, --timeout] [-V, --version]\n"
" [[-f --fbdev] | [-x --x11]]\n");
}
@@ -46,17 +47,18 @@ void pbt_print_usage(void)
int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[])
{
static const struct option long_options[] = {
- {"start-daemon", no_argument, NULL, 'd'},
+ {"dry-run", no_argument, NULL, 'd'},
{"fbdev", no_argument, NULL, 'f'},
{"help", no_argument, NULL, 'h'},
{"log", required_argument, NULL, 'l'},
{"reset-defaults", no_argument, NULL, 'r'},
+ {"start-daemon", no_argument, NULL, 's'},
{"timeout", no_argument, NULL, 't'},
{"version", no_argument, NULL, 'V'},
{"x11", no_argument, NULL, 'x'},
{ NULL, 0, NULL, 0},
};
- static const char short_options[] = "dfhl:trVx";
+ static const char short_options[] = "dfhl:strVx";
static const struct pbt_opts default_values = {
.backend = pbt_twin_x11,
.log_file = "/var/log/petitboot/petitboot-twin.log",
@@ -73,7 +75,7 @@ int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[])
switch (c) {
case 'd':
- opts->start_daemon = pbt_opt_yes;
+ opts->dry_run = pbt_opt_yes;
break;
case 'f':
opts->backend = pbt_twin_fbdev;
@@ -84,6 +86,9 @@ int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[])
case 'l':
opts->log_file = optarg;
break;
+ case 's':
+ opts->start_daemon = pbt_opt_yes;
+ break;
case 't':
opts->use_timeout = pbt_opt_yes;
break;
diff --git a/ui/twin/pbt-main.h b/ui/twin/pbt-main.h
index 47985a1..e5af71a 100644
--- a/ui/twin/pbt-main.h
+++ b/ui/twin/pbt-main.h
@@ -31,11 +31,12 @@ enum pbt_opt_value {pbt_opt_undef = 0, pbt_opt_yes, pbt_opt_no};
*/
struct pbt_opts {
- enum pbt_opt_value start_daemon;
enum pbt_twin_backend backend;
+ enum pbt_opt_value dry_run;
enum pbt_opt_value show_help;
const char *log_file;
enum pbt_opt_value reset_defaults;
+ enum pbt_opt_value start_daemon;
enum pbt_opt_value use_timeout;
enum pbt_opt_value show_version;
};
OpenPOWER on IntegriCloud