This is helpful for other compositors which utilize libweston without systemd-login support.
Signed-off-by: Ilia Bozhinov <amme...@gmail.com> --- libweston/weston-launch.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c index 1adcf21a..b8bceea2 100644 --- a/libweston/weston-launch.c +++ b/libweston/weston-launch.c @@ -116,6 +116,7 @@ struct weston_launch { pid_t child; int verbose; char *new_user; + char *compositor_cmd; }; union cmsg_data { unsigned char b[4]; int fd; }; @@ -624,7 +625,7 @@ setup_session(struct weston_launch *wl, char **child_argv) child_argv[0] = "/bin/sh"; child_argv[1] = "-l"; child_argv[2] = "-c"; - child_argv[3] = BINDIR "/weston \"$@\""; + child_argv[3] = strcat(wl->compositor_cmd ?: BINDIR "/weston", "\"$@\""); child_argv[4] = "weston"; return 5; } @@ -652,7 +653,7 @@ launch_compositor(struct weston_launch *wl, int argc, char *argv[]) if (wl->new_user) { o = setup_session(wl, child_argv); } else { - child_argv[0] = BINDIR "/weston"; + child_argv[0] = wl->compositor_cmd ?: BINDIR "/weston"; o = 1; } for (i = 0; i < argc; ++i) @@ -683,12 +684,14 @@ static void help(const char *name) { fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name); - fprintf(stderr, " -u, --user Start session as specified username,\n" - " e.g. -u joe, requires root.\n"); - fprintf(stderr, " -t, --tty Start session on alternative tty,\n" - " e.g. -t /dev/tty4, requires -u option.\n"); - fprintf(stderr, " -v, --verbose Be verbose\n"); - fprintf(stderr, " -h, --help Display this help message\n"); + fprintf(stderr, " -u, --user Start session as specified username,\n" + " e.g. -u joe, requires root.\n"); + fprintf(stderr, " -t, --tty Start session on alternative tty,\n" + " e.g. -t /dev/tty4, requires -u option.\n"); + fprintf(stderr, " -c, --compositor Start a compositor other than weston,\n" + " e.g. -c /usr/bin/weston.\n"); + fprintf(stderr, " -v, --verbose Be verbose\n"); + fprintf(stderr, " -h, --help Display this help message\n"); } int @@ -698,16 +701,17 @@ main(int argc, char *argv[]) int i, c; char *tty = NULL; struct option opts[] = { - { "user", required_argument, NULL, 'u' }, - { "tty", required_argument, NULL, 't' }, - { "verbose", no_argument, NULL, 'v' }, - { "help", no_argument, NULL, 'h' }, - { 0, 0, NULL, 0 } + { "user", required_argument, NULL, 'u' }, + { "tty", required_argument, NULL, 't' }, + { "verbose", no_argument, NULL, 'v' }, + { "compositor", required_argument, NULL, 'c' }, + { "help", no_argument, NULL, 'h' }, + { 0, 0, NULL, 0 } }; memset(&wl, 0, sizeof wl); - while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) { + while ((c = getopt_long(argc, argv, "u:t:c:vh", opts, &i)) != -1) { switch (c) { case 'u': wl.new_user = optarg; @@ -720,6 +724,9 @@ main(int argc, char *argv[]) case 'v': wl.verbose = 1; break; + case 'c': + wl.compositor_cmd = optarg; + break; case 'h': help("weston-launch"); exit(EXIT_FAILURE); -- 2.14.3 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel