Skip to content

Commit 726894f

Browse files
committed
Default stty cols/rows values for serial consoles
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
1 parent 87cd20b commit 726894f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

90zfsbootmenu/zfsbootmenu-preinit.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
# Disable all kernel messages to the console
55
echo 0 > /proc/sys/kernel/printk
66

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

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

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

0 commit comments

Comments
 (0)