Set $SHELL to a sane default value, used by BusyBox

When finit calls out to external tools, like `ifup $IFACE`, that tool in
turn may use other external tools.  On systems with BusyBox our calling
`ifup $IFACE` will result in BusyBox casting a magic spell: if $SHELL is
unset it goes looking in the file /etc/passwd for the shell of $USER
which may not be set to a Bourne compatible UNIX shell, so commands like
`ip link ...` or `run-parts ...` will fail hard.

This patch adds SHELL=/bin/sh as a sane early default.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2018-02-26 22:07:31 +01:00
1 parent 396c1b491f
commit a50bfc016e
1 file changed
+2 -1
+2 -1
View File
@@ -282,9 +282,10 @@ int main(int argc, char* argv[])
ctx = &loop;
/*
* Set the PATH early to something sane
* Set PATH and SHELL early to something sane
*/
setenv("PATH", _PATH_STDPATH, 1);
setenv("SHELL", _PATH_BSHELL, 1);
/*
* Mount base file system, kernel is assumed to run devtmpfs for /dev