diff options
author | Helmut Grohne <helmutg@debian.org> | 2023-01-15 08:54:06 +0000 |
---|---|---|
committer | Helmut Grohne <helmutg@debian.org> | 2023-01-15 08:54:06 +0000 |
commit | b6aee3905cc52fa206cfbef3fe01d2c6388435a1 (patch) | |
tree | 86ab25a9c7434d62019359da0f996d2097aa8247 /share/customize-autologin.sh | |
parent | 59c77e0c3422287651c6e270917bcfa04a6c17a6 (diff) | |
parent | ca2cbf6d84dcc96845fcc6521aebe3b5076cdb32 (diff) | |
download | debvm-b6aee3905cc52fa206cfbef3fe01d2c6388435a1.tar.gz |
Merge branch 'helmut' into 'main'
reduce usage of DEBVER
See merge request helmutg/debvm!22
Diffstat (limited to 'share/customize-autologin.sh')
-rwxr-xr-x | share/customize-autologin.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/share/customize-autologin.sh b/share/customize-autologin.sh new file mode 100755 index 0000000..b9a4a8b --- /dev/null +++ b/share/customize-autologin.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Copyright 2022 Helmut Grohne <helmut@subdivi.de> +# SPDX-License-Identifier: MIT +# +# This is a mmdebstrap customize hook that configures automatic root login on a +# serial console. It also parses the debvm.term kernel cmdline and passes it as +# TERM to agetty. + +set -eu + +TARGET=$1 + +UNIT=serial-getty@.service + +mkdir "$TARGET/etc/systemd/system/$UNIT.d" + +( + echo '[Service]' + printf '%s\n' 'ExecStartPre=/bin/sed -n -e "s/^\\(.* \\)\\?\\(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" |