diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-01-13 07:04:28 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-01-13 07:04:28 +0100 |
commit | 52202bfc705e433a170e78529558556b0976ae71 (patch) | |
tree | c1089461d626b3de7bbcf775ff03ef85005edfe3 /share/customize-autologin.sh | |
parent | 3fde9f313c991aa19fbcedc38a4531de9e838f8d (diff) | |
download | debvm-52202bfc705e433a170e78529558556b0976ae71.tar.gz |
automatically set up agetty TERM when possible
* debvm-create will now parse a new kernel cmdline debvm.term and if
present will pass its value to agetty as TERM.
* debvm-run will now detect whether it is running in a terminal in
non-graphic mode and pass its environment TERM variable as debvm.term
to the kernel cmdline thus closing the loop.
Diffstat (limited to 'share/customize-autologin.sh')
-rwxr-xr-x | share/customize-autologin.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/share/customize-autologin.sh b/share/customize-autologin.sh index 5592a03..d7df555 100755 --- a/share/customize-autologin.sh +++ b/share/customize-autologin.sh @@ -3,7 +3,8 @@ # SPDX-License-Identifier: MIT # # This is a mmdebstrap customize hook that configures automatic root login on a -# serial console. +# serial console. It also parses the debvm.term kernel cmdline and passes it as +# TERM to agetty. set -eu @@ -15,6 +16,8 @@ mkdir "$TARGET/etc/systemd/system/$UNIT.d" ( echo '[Service]' + printf '%s\n' 'ExecStartPre=/bin/sed -n -e "s/.*\\(^\\| \\)debvm\\.term=\\([^ ]*\\).*/TERM=\\2/w/run/debvmterm" /proc/cmdline' + echo 'EnvironmentFile=-/run/debvmterm' echo 'ExecStart=' sed -n 's,^ExecStart=-/sbin/agetty ,&-a root ,p' "$TARGET/lib/systemd/system/$UNIT" ) > "$TARGET/etc/systemd/system/$UNIT.d/autologin.conf" |