summaryrefslogtreecommitdiff
path: root/share/customize-autologin.sh
diff options
context:
space:
mode:
Diffstat (limited to 'share/customize-autologin.sh')
-rwxr-xr-xshare/customize-autologin.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/share/customize-autologin.sh b/share/customize-autologin.sh
new file mode 100755
index 0000000..5592a03
--- /dev/null
+++ b/share/customize-autologin.sh
@@ -0,0 +1,20 @@
+#!/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.
+
+set -eu
+
+TARGET=$1
+
+UNIT=serial-getty@.service
+
+mkdir "$TARGET/etc/systemd/system/$UNIT.d"
+
+(
+ echo '[Service]'
+ echo 'ExecStart='
+ sed -n 's,^ExecStart=-/sbin/agetty ,&-a root ,p' "$TARGET/lib/systemd/system/$UNIT"
+) > "$TARGET/etc/systemd/system/$UNIT.d/autologin.conf"