#!/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 }