diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-02-23 20:09:58 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-02-23 20:09:58 +0100 |
commit | 398fce482e8d8809bcec769155d7adbe913bf1af (patch) | |
tree | e596ab927a7e74adbd9b5052f0563f2dbcdaf38e /share/customize-autologin.sh | |
parent | 6c0f131ce725ddf9a250dbeb607fa38cb3e633bc (diff) | |
download | debvm-398fce482e8d8809bcec769155d7adbe913bf1af.tar.gz |
debvm-create: also support --initsystem=runit
Diffstat (limited to 'share/customize-autologin.sh')
-rwxr-xr-x | share/customize-autologin.sh | 15 |
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 |