mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
Fix #91: Add support for tty nologin, to start /bin/sh immediately
This patch adds a `nologin` flag to the `tty` configuration directive,
making it possible to set up really simple embedded systems with no
login.
Example, put the following line in `/etc/finit.d/getty.conf` to get
a "Please press Enter to ..." prompt before being presented with a
root shell prompt.
tty [12345] @console noclear nologin
Needless to say, this is not very secure, but can be really useful
for developer setups, during board bringup, or similar.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
d6ea1c0cab
commit
72bc3b1a91
5 files changed
+68
-1
No files matched your search
@@ -137,7 +137,7 @@ void tty_sweep(void)
|
||||
int tty_register(char *line, struct rlimit rlimit[], char *file)
|
||||
{
|
||||
tty_node_t *entry;
|
||||
int insert = 0, noclear = 0, nowait = 0;
|
||||
int insert = 0, noclear = 0, nowait = 0, nologin = 0;
|
||||
size_t i, num = 0;
|
||||
char *tok, *cmd = NULL, *args[TTY_MAX_ARGS];
|
||||
char *dev = NULL, *baud = NULL;
|
||||
@@ -159,6 +159,8 @@ int tty_register(char *line, struct rlimit rlimit[], char *file)
|
||||
noclear = 1;
|
||||
else if (!strcmp(tok, "nowait"))
|
||||
nowait = 1;
|
||||
else if (!strcmp(tok, "nologin"))
|
||||
nologin = 1;
|
||||
else
|
||||
args[num++] = tok;
|
||||
|
||||
@@ -241,6 +243,7 @@ int tty_register(char *line, struct rlimit rlimit[], char *file)
|
||||
entry->data.term = term ? strdup(term) : NULL;
|
||||
entry->data.noclear = noclear;
|
||||
entry->data.nowait = nowait;
|
||||
entry->data.nologin = nologin;
|
||||
entry->data.runlevels = conf_parse_runlevels(runlevels);
|
||||
|
||||
/* External getty */
|
||||
@@ -392,6 +395,11 @@ void tty_start(finit_tty_t *tty)
|
||||
return;
|
||||
}
|
||||
|
||||
if (tty->nologin) {
|
||||
tty->pid = run_sh(dev, tty->noclear, tty->nowait, tty->rlimit);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tty->cmd)
|
||||
tty->pid = run_getty(dev, tty->baud, tty->term, tty->noclear, tty->nowait, tty->rlimit);
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user