Skip to content

Commit

Permalink
20-console-autosize.sh: use full path to font file
Browse files Browse the repository at this point in the history
setfont 2.6.3 removed '.' from the font search path. Fonts were loaded
by name and not file name, breaking the hook on distributions with
a recent kbd package.

Loading fonts by filename at an absolute path was tested on:

* Void (setfont 2.6.3)
* Arch (setfont 2.6.3)
* Debian (setfont 2.5.1)
* Ubuntu (setfont 2.3.0)
* Alpine (busybox setfont)
* Chimera (setfont 2.6.3)

Fixes: #552
Closes: #553
  • Loading branch information
zdykstra committed Dec 7, 2023
1 parent f0088ce commit 42d4529
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions testing/TPSReport.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ of the kernel list. That BE should be selected when entering the list.
- [ ] Pressing the left/right arrow keys moves to the next/previous screen shown
in the header. Screens will not wrap around.

- [ ] When booting a test VM with GTK output and efifb, the font will be resized
to change the apparent resolution of the console. Successful font changes are
logged via `zinfo()`.

## General Testing

- [ ] If every encryption root specifies an `org.zfsbootmenu:keysource`
Expand Down
10 changes: 5 additions & 5 deletions zfsbootmenu/hooks/early-setup.d/20-console-autosize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# vim: softtabstop=2 shiftwidth=2 expandtab

## This early-setup hook attempts to get a physical (non-serial) console
## to at least 100 columns.
## to at least 110 columns.

#shellcheck disable=SC1091
source /lib/zfsbootmenu-kcl.sh || exit 1
Expand All @@ -24,13 +24,13 @@ tty_re='/dev/tty[0-9]'
# If the user has specified a specific font/size, do not attempt to override it

if get_zbm_bool 1 zbm.autosize && ! font=$( get_zbm_arg rd.vconsole.font ) ; then
cd /usr/share/zfsbootmenu/fonts/ || exit 0
for font in ter-v32b ter-v28b ter-v24b ter-v20b ter-v14b ter-v12n; do
[ -f "${font}.psf" ] && setfont "${font}" >/dev/null 2>&1
for font in /usr/share/zfsbootmenu/fonts/ter-v{{32,28,24,20,14}b,12n}.psf ; do
[ -f "${font}" ] || continue
setfont "${font}" >/dev/null 2>&1 || continue

# 110 columns is the current minimum to show both the sort key and a note on the snapshot screen
if [ "${COLUMNS}" -ge 110 ]; then
zdebug "set font to ${font}, screen is ${COLUMNS}x${LINES}"
zinfo "font set to ${font}, ${control_term} is ${COLUMNS}x${LINES}"
break
fi
done
Expand Down

0 comments on commit 42d4529

Please sign in to comment.