Add support for a fallback shell if no tty is setup

Try to do better by the user, by default, if no tty is specified in the
finit.conf.  This way the user will at least have a way to interact with
the system and repair it.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2014-04-19 22:58:20 +02:00
1 parent 62287f8fcc
commit f6f2895524
5 files changed
+76 -49

No files matched your search

+18 -3
View File
@@ -102,6 +102,17 @@ tty_node_t *tty_find(char *dev)
return NULL;
}
size_t tty_num(void)
{
size_t num = 0;
tty_node_t *entry;
LIST_FOREACH(entry, &tty_list, link)
num++;
return num;
}
tty_node_t *tty_find_by_pid(pid_t pid)
{
tty_node_t *entry;
@@ -127,13 +138,17 @@ void tty_start(finit_tty_t *tty)
if (console && !strcmp(tty->name, console))
is_console = 1;
if (!strcmp(tty->name, _PATH_DEV)) {
#if defined(GETTY_AGETTY)
snprintf(line, sizeof(line), "%s %s %d %s", GETTY, tty->name, tty->baud, tty->term ?: "");
snprintf(line, sizeof(line), "%s %s %d %s", GETTY, tty->name, tty->baud, tty->term ?: "");
#elif defined(GETTY_BUSYBOX)
snprintf(line, sizeof(line), "%s %d %s %s", GETTY, tty->baud, tty->name, tty->term ?: "");
snprintf(line, sizeof(line), "%s %d %s %s", GETTY, tty->baud, tty->name, tty->term ?: "");
#else
#error No GETTY defined!
strlcpy(line, FALLBACK_CONSOLE, sizeof(line));
#endif
} else {
strlcpy(line, tty->name, sizeof(line));
}
cmd = strtok(line, " ");
args[i++] = basename(cmd);
while ((arg = strtok(NULL, " ")))