Set SHELL variable in run-welcome + run-screen
authorDarshaka Pathirana <dpat@syn-net.org>
Sat, 12 Nov 2022 16:18:35 +0000 (17:18 +0100)
committerDarshaka Pathirana <dpat@syn-net.org>
Sun, 13 Nov 2022 11:17:24 +0000 (12:17 +0100)
commit570d9599584feb8ff7ccc8a9abe346c356f62c45
tree0a356b62b342c8981472bac266da49495056e906
parentc1231da0db59f3cb545d9ef8e446a287b7618a3c
Set SHELL variable in run-welcome + run-screen

By default login(1) is called by agetty(8) and sets the SHELL variable
"according to the appropriate fields in the password entry".

Our tty1 calls run-welcome, tty2 - tty4 call run-screen and tty5 - tty7 call
agetty (with autologin grml). So, our tty1 - tty4 bypass agetty(8) + login(1)
and (should) end in a the zsh shell (via the welcome-screen or GNU/screen)
without the SHELL variable set.

run-welcome is designed to be started (only) on tty(1) and starts zsh anyway.
But as we bypass login(1) the SHELL variable is not set.
The same is true for run-screen, but instead of starting the zsh as
login-shell, `screen` is called and runs the shell defined by the SHELL
variable or /bin/sh if not defined.

So, we ended up using the systemd "Environment"-option to set the SHELL
variable (grml/grml-live@6871972 + grml/grml-live@7422d31).
Although this is a working solution, setting the SHELL variable in run-welcome
+ run-screen makes it more transparent, that the script is actually responsible
to set the SHELL variable.

While debugging this problem, also noticed that screen should start the shell
as login-shell (like all other ttys). To do so the given shell command needs to
be prefixed with the '-' character.

grml/grml-live@6871972 + grml/grml-live@7422d31 can/should be reverted
after this change has been applied.

Issues: grml/grml#135 + grml/grml#14
usr_share/run-screen
usr_share/run-welcome