distribution/packages/wayland/weston/patches/002-console.patch

78 lines
2.6 KiB
Diff

diff -rupN weston-10.0.1.orig/clients/terminal.c weston-10.0.1/clients/terminal.c
--- weston-10.0.1.orig/clients/terminal.c 2022-09-14 09:35:54.928561932 -0400
+++ weston-10.0.1/clients/terminal.c 2022-09-14 09:43:23.195349394 -0400
@@ -56,6 +56,8 @@ static char *option_font;
static int option_font_size;
static char *option_term;
static char *option_shell;
+static char *option_cwd;
+static char *option_command;
static struct wl_list terminal_list;
@@ -3089,6 +3091,14 @@ terminal_run(struct terminal *terminal,
close(pipes[0]);
setenv("TERM", option_term, 1);
setenv("COLORTERM", option_term, 1);
+
+ if (option_command) {
+ if (execl(path, path, "-c", option_command, NULL)) {
+ fprintf(stderr, "command '%s' couldn't executed: %m",
+ option_command);
+ }
+ }
+
if (execl(path, path, "-l")) {
printf("exec failed: %s\n", strerror(errno));
exit(EXIT_FAILURE);
@@ -3123,6 +3133,8 @@ static const struct weston_option termin
{ WESTON_OPTION_STRING, "font", 0, &option_font },
{ WESTON_OPTION_INTEGER, "font-size", 0, &option_font_size },
{ WESTON_OPTION_STRING, "shell", 0, &option_shell },
+ { WESTON_OPTION_STRING, "cwd", 0, &option_cwd },
+ { WESTON_OPTION_STRING, "command", 0, &option_command },
};
int main(int argc, char *argv[])
@@ -3140,7 +3152,7 @@ int main(int argc, char *argv[])
option_shell = getenv("SHELL");
if (!option_shell)
- option_shell = "/bin/bash";
+ option_shell = "/bin/sh";
config_file = weston_config_get_name_from_env();
config = weston_config_parse(config_file);
@@ -3148,6 +3160,7 @@ int main(int argc, char *argv[])
weston_config_section_get_string(s, "font", &option_font, "monospace");
weston_config_section_get_int(s, "font-size", &option_font_size, 14);
weston_config_section_get_string(s, "term", &option_term, "xterm");
+ weston_config_section_get_string(s, "command", &option_command, NULL);
weston_config_destroy(config);
if (parse_options(terminal_options,
@@ -3157,7 +3170,9 @@ int main(int argc, char *argv[])
" --maximized or -m\n"
" --font=NAME\n"
" --font-size=SIZE\n"
- " --shell=NAME\n", argv[0]);
+ " --shell=NAME\n"
+ " --cwd=PATH\n"
+ " --command=CMDLINE\n", argv[0]);
return 1;
}
@@ -3178,6 +3193,13 @@ int main(int argc, char *argv[])
wl_list_init(&terminal_list);
terminal = terminal_create(d);
+
+ if (option_cwd) {
+ if(chdir(option_cwd) == -1)
+ fprintf(stderr, "failed to changing directory as %s: %m\n",
+ option_cwd);
+ }
+
if (terminal_run(terminal, option_shell))
exit(EXIT_FAILURE);