blob: ea261abd3d7f4374796b790743aecfead8a03960 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/hint/bash -euE
# Copyright (C) 2018 Luke Shumaker
# SPDX-License-Identifier: AGPL-3.0-or-later
post_install+=(10:autologin-ttyS0:post_install)
autologin-ttyS0:post_install() {
local arg_mountpoint=$1
mkdir "${arg_mountpoint}/etc/systemd/system/serial-getty@ttyS0.service.d"
cat <<-EOT > "${arg_mountpoint}/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf"
[Service]
ExecStart=
$(sed -n '/^ExecStart=/s/ / --autologin root /p' < "${arg_mountpoint}/usr/lib/systemd/system/serial-getty@.service")
EOT
cat <<-'EOT' >> "$arg_mountpoint/etc/default/grub"
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0 console=tty0"
GRUB_TERMINAL_OUTPUT="serial console"
EOT
}
|