summaryrefslogtreecommitdiffstats
path: root/ui/twin/pbt-main.c
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-08 20:48:21 -0800
committerGeoff Levand <geoff@infradead.org>2012-03-08 20:51:37 -0800
commit604a1ccf072f9f33326fb6dc919c1b6233d40866 (patch)
tree88297738af995f9ea8df78e134d0a2dac111d157 /ui/twin/pbt-main.c
parentae0ba68f475ae5b057aad6538765bc8702134b9a (diff)
downloadtalos-petitboot-604a1ccf072f9f33326fb6dc919c1b6233d40866.tar.gz
talos-petitboot-604a1ccf072f9f33326fb6dc919c1b6233d40866.zip
Add --start-daemon option to ui programs
Add the option --start-daemon to automatically start pb-discover if it is not already started. For use when running as a stand-alone app. Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'ui/twin/pbt-main.c')
-rw-r--r--ui/twin/pbt-main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/twin/pbt-main.c b/ui/twin/pbt-main.c
index 51ff5f2..a8c1ea5 100644
--- a/ui/twin/pbt-main.c
+++ b/ui/twin/pbt-main.c
@@ -34,8 +34,8 @@ void pbt_print_usage(void)
{
pbt_print_version();
printf(
-"Usage: petitboot-twin [-h, --help] [-l, --log log-file]\n"
-" [-r, --reset-defaults][-t, --timeout] [-V, --version]"
+"Usage: petitboot-twin [-d, --start-daemon] [-h, --help] [-l, --log log-file]\n"
+" [-r, --reset-defaults][-t, --timeout] [-V, --version]\n"
" [[-f --fbdev] | [-x --x11]]\n");
}
@@ -46,6 +46,7 @@ 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'},
{"fbdev", no_argument, NULL, 'f'},
{"help", no_argument, NULL, 'h'},
{"log", required_argument, NULL, 'l'},
@@ -55,7 +56,7 @@ int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[])
{"x11", no_argument, NULL, 'x'},
{ NULL, 0, NULL, 0},
};
- static const char short_options[] = "fhl:trVx";
+ static const char short_options[] = "dfhl:trVx";
static const struct pbt_opts default_values = {
.backend = pbt_twin_x11,
.log_file = "/var/log/petitboot/petitboot-twin.log",
@@ -71,6 +72,9 @@ int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[])
break;
switch (c) {
+ case 'd':
+ opts->start_daemon = pbt_opt_yes;
+ break;
case 'f':
opts->backend = pbt_twin_fbdev;
break;
OpenPOWER on IntegriCloud