summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/customize-autologin.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/share/customize-autologin.sh b/share/customize-autologin.sh
index 7b7a130..da386b5 100755
--- a/share/customize-autologin.sh
+++ b/share/customize-autologin.sh
@@ -5,24 +5,26 @@
# This is a mmdebstrap customize hook that configures automatic root login on a
# serial console. It also parses the TERM kernel cmdline and passes it as
# TERM to agetty. Since serial consoles do not transmit SIGWINCH, it causes
-# the shell to run setterm -resize on interactive, serial logins.
+# the shell to run setterm --resize on interactive, serial logins.
set -eu
TARGET=$1
-cat >"$TARGET/etc/profile.d/resize_serial_term.sh" <<'EOF'
+if dpkg --compare-versions "$(dpkg-query --root "$TARGET" -f '${Version}' -W util-linux)" ge 2.33; then
+ cat >"$TARGET/etc/profile.d/resize_serial_term.sh" <<'EOF'
if test -n "${TERM-}" && test -n "${PS1-}"; then
case "$(tty)" in
/dev/tty[0-9]*)
;;
/dev/tty*)
# Assume that every other tty is serial and should be resized.
- setterm -resize
+ setterm --resize
;;
esac
fi
EOF
+fi
if test "$(dpkg-query --root "$TARGET" -f '${db:Status-Status}' -W systemd-sysv 2>/dev/null)" = installed; then
UNIT=serial-getty@.service