diff --git a/LICENSE.fonts b/LICENSE.fonts new file mode 100644 index 000000000..516837218 --- /dev/null +++ b/LICENSE.fonts @@ -0,0 +1,94 @@ +Copyright (C) 2020 Dimitar Toshkov Zhekov, +with Reserved Font Name "Terminus Font". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/docs/man/zfsbootmenu.7.rst b/docs/man/zfsbootmenu.7.rst index 8365d0959..6cb6c47e2 100644 --- a/docs/man/zfsbootmenu.7.rst +++ b/docs/man/zfsbootmenu.7.rst @@ -139,6 +139,10 @@ These options are set on the kernel command line when booting the initramfs or U **NOTE**: The *hooklist* argument **MUST NOT** contain spaces and **MUST NOT** be enclosed in quotes. +**zbm.autosize** + + Enable automatic font resizing of the kernel console to normalize the apparent resolution for both low resolution and high resolution displays. This option is enabled by default. + Deprecated Parameters --------------------- diff --git a/dracut/module-setup.sh b/dracut/module-setup.sh index bcc9b5f39..b986bdb9b 100644 --- a/dracut/module-setup.sh +++ b/dracut/module-setup.sh @@ -179,4 +179,8 @@ install() { create_zbm_conf create_zbm_profiles create_zbm_traceconf + + if command -v setfont >/dev/null 2>&1; then + install_zbm_fonts && dracut_install setfont + fi } diff --git a/etc/zfsbootmenu/release.conf.d/common.conf b/etc/zfsbootmenu/release.conf.d/common.conf index dadb44f1f..56f85fb9c 100644 --- a/etc/zfsbootmenu/release.conf.d/common.conf +++ b/etc/zfsbootmenu/release.conf.d/common.conf @@ -1,5 +1,3 @@ -zfsbootmenu_early_setup+=" /zbm/contrib/20-console-autosize.sh " - # zbm-kcl install_optional_items+=" /zbm/bin/zbm-kcl " diff --git a/initcpio/install/zfsbootmenu b/initcpio/install/zfsbootmenu index b0cb927bc..2a77b49d8 100644 --- a/initcpio/install/zfsbootmenu +++ b/initcpio/install/zfsbootmenu @@ -198,6 +198,10 @@ build() { create_zbm_traceconf create_zbm_entrypoint + if command -v setfont >/dev/null 2>&1; then + install_zbm_fonts && add_binary setfont + fi + add_runscript } diff --git a/releng/docker/image-build.sh b/releng/docker/image-build.sh index 6c20057aa..ff28ebe89 100755 --- a/releng/docker/image-build.sh +++ b/releng/docker/image-build.sh @@ -180,7 +180,7 @@ buildah run "${host_mounts[@]}" "${container}" \ buildah run "${host_mounts[@]}" "${container}" \ xbps-install -y "${kern_series[@]}" "${kern_headers[@]}" \ - zstd gummiboot-efistub curl yq-go bash kbd terminus-font \ + zstd gummiboot-efistub curl yq-go bash kbd \ dracut mkinitcpio dracut-network gptfdisk iproute2 iputils parted \ curl dosfstools e2fsprogs efibootmgr cryptsetup openssh util-linux kpartx diff --git a/testing/run.sh b/testing/run.sh index e592eae25..d269d1c78 100755 --- a/testing/run.sh +++ b/testing/run.sh @@ -238,13 +238,6 @@ fi if [ -n "${DISPLAY_TYPE}" ]; then # Use the indicated graphical display DISPLAY_ARGS=( "-display" "${DISPLAY_TYPE}" ) - - # Add release hooks, supported only under Dracut - if ((DRACUT)); then - cat <<-EOF >> "${TESTDIR}/dracut.conf.d/testing.conf" - zfsbootmenu_early_setup+=" $( realpath -e ../contrib )/20-console-autosize.sh " - EOF - fi else # Suppress graphical display (implies serial mode) DISPLAY_ARGS=( "-nographic" ) diff --git a/zfsbootmenu/fonts/ter-v12n.psf b/zfsbootmenu/fonts/ter-v12n.psf new file mode 100644 index 000000000..c22912b94 Binary files /dev/null and b/zfsbootmenu/fonts/ter-v12n.psf differ diff --git a/zfsbootmenu/fonts/ter-v14b.psf b/zfsbootmenu/fonts/ter-v14b.psf new file mode 100644 index 000000000..2eb15ec5b Binary files /dev/null and b/zfsbootmenu/fonts/ter-v14b.psf differ diff --git a/zfsbootmenu/fonts/ter-v20b.psf b/zfsbootmenu/fonts/ter-v20b.psf new file mode 100644 index 000000000..72d2b1d1e Binary files /dev/null and b/zfsbootmenu/fonts/ter-v20b.psf differ diff --git a/zfsbootmenu/fonts/ter-v24b.psf b/zfsbootmenu/fonts/ter-v24b.psf new file mode 100644 index 000000000..2b51bcd4f Binary files /dev/null and b/zfsbootmenu/fonts/ter-v24b.psf differ diff --git a/zfsbootmenu/fonts/ter-v28b.psf b/zfsbootmenu/fonts/ter-v28b.psf new file mode 100644 index 000000000..428f58dd0 Binary files /dev/null and b/zfsbootmenu/fonts/ter-v28b.psf differ diff --git a/zfsbootmenu/fonts/ter-v32b.psf b/zfsbootmenu/fonts/ter-v32b.psf new file mode 100644 index 000000000..455875b45 Binary files /dev/null and b/zfsbootmenu/fonts/ter-v32b.psf differ diff --git a/zfsbootmenu/hooks/early-setup.d/20-console-autosize.sh b/zfsbootmenu/hooks/early-setup.d/20-console-autosize.sh new file mode 100755 index 000000000..335c7753e --- /dev/null +++ b/zfsbootmenu/hooks/early-setup.d/20-console-autosize.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# vim: softtabstop=2 shiftwidth=2 expandtab + +## This early-setup hook attempts to get a physical (non-serial) console +## to at least 100 columns. + +#shellcheck disable=SC1091 +source /lib/zfsbootmenu-kcl.sh || exit 1 +source /lib/kmsg-log-lib.sh || exit 1 + +if [ -z "${control_term}" ] && [ -f /etc/zfsbootmenu.conf ]; then + #shellcheck disable=SC1091 + source /etc/zfsbootmenu.conf +fi + +# Control terminal MUST be defined to proceed +[ -c "${control_term}" ] || exit 1 + +# Ensure that control_term is not a serial console +tty_re='/dev/tty[0-9]' +[[ ${control_term} =~ ${tty_re} ]] || exit 1 + +# rd.vconsole.font is consumed by the Dracut i18n module, which is forced to run before this hook +# 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 + for font in /usr/share/zfsbootmenu/fonts/* ; do + [ -f "${font}" ] && setfont "${font}" >/dev/null 2>&1 + + # 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}" + break + fi + done +fi diff --git a/zfsbootmenu/install-helpers.sh b/zfsbootmenu/install-helpers.sh index c045dc785..c23534b68 100644 --- a/zfsbootmenu/install-helpers.sh +++ b/zfsbootmenu/install-helpers.sh @@ -245,6 +245,16 @@ install_zbm_docs() { return $ret } +install_zbm_fonts() { + + [ -d "${zfsbootmenu_module_root}/fonts" ] || return 1 + + # Install into a non-standard path so that the Dracut i18n module doesn't stomp over our custom fonts + + for font in "${zfsbootmenu_module_root}/fonts"/*.psf; do + [ -f "${font}" ] && zbm_install_file "${font}" "/usr/share/zfsbootmenu/fonts/${font##*/}" + done +} populate_hook_dir() { local hfile ret hlev