Skip to content

Commit

Permalink
Default stty cols/rows values for serial consoles
Browse files Browse the repository at this point in the history
If the controlling terminal isn't one of /dev/tty0 through /dev/tty9,
run stty rows / stty cols with either user-provided values or defaults
of 25 and 80 respectively.

Closes #213
  • Loading branch information
zdykstra committed Oct 9, 2021
1 parent 87cd20b commit 726894f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions 90zfsbootmenu/zfsbootmenu-preinit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
# Disable all kernel messages to the console
echo 0 > /proc/sys/kernel/printk

# set the console size, if indicated
#shellcheck disable=SC2154
if [ -n "$zbm_lines" ]; then
stty rows "$zbm_lines"
fi
# fzf needs stty cols/rows explicitly set, otherwise it can't
# determine the serial terminal size. Defaults should only be
# called when the controlling terminal is NOT /dev/tty[0-9]

tty_re='/dev/tty[0-9]'

#shellcheck disable=SC2154
if [ -n "$zbm_columns" ]; then
stty cols "$zbm_columns"
if ! [[ ${control_term} =~ ${tty_re} ]]; then
stty rows "${zbm_lines:-25}"
stty cols "${zbm_columns:-80}"
fi

# This is a load bearing echo, do not remove!
Expand Down

0 comments on commit 726894f

Please sign in to comment.