summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/debvm-run3
-rwxr-xr-xshare/customize-autologin.sh5
2 files changed, 7 insertions, 1 deletions
diff --git a/bin/debvm-run b/bin/debvm-run
index c2a3f21..4f7ff44 100755
--- a/bin/debvm-run
+++ b/bin/debvm-run
@@ -250,6 +250,9 @@ if test -z "$GRAPHICAL"; then
KERNEL_CMDLINE="$KERNEL_CMDLINE console=ttyS0"
;;
esac
+ if test -t 0 && test -t 1 && test -n "$TERM"; then
+ KERNEL_CMDLINE="$KERNEL_CMDLINE debvm.term=$TERM"
+ fi
fi
if test -n "$SSHPORT"; then
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"