summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/customize-autologin.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/share/customize-autologin.sh b/share/customize-autologin.sh
index c0b4d28..9effa29 100755
--- a/share/customize-autologin.sh
+++ b/share/customize-autologin.sh
@@ -35,5 +35,20 @@ if test "$(dpkg-query --root "$TARGET" -f '${db:Status-Status}' -W sysvinit-core
exit 0
fi
+if test "$(dpkg-query --root "$TARGET" -f '${db:Status-Status}' -W runit-init 2>/dev/null)" = installed; then
+ if ! test -f "$TARGET/etc/sv/getty-ttyS0/run"; then
+ echo "failed to guess serial console name for runit" 1>&2
+ exit 1
+ fi
+
+ # shellcheck disable=SC2016 # intentional non-expansion
+ sed -i \
+ -e 's,exec.*/sbin/getty ,&-a root ,' \
+ -e '/exec 1>&2/i: "${TERM:=$(sed -n -e '"'"'s/^\\(.* \\)\\?TERM=\\([^ ]*\\).*/\\2/p'"'"' /proc/cmdline)}"' \
+ -e '/exec.*getty /s, \(vt100\)$, "${TERM:-\1}",' \
+ "$TARGET/etc/sv/getty-ttyS0/run"
+ exit 0
+fi
+
echo "failed: init system not recognized by autologin customization" 1>&2
exit 1