summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>2012-02-24 11:18:06 +0100
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>2012-02-24 11:18:06 +0100
commit274416e82f458ec25033c0547c47b9505c5402ae (patch)
treebb4a9ad10d64151e0960443a278070a539e34ae6 /util
parentb3e086225572280d12422b60a841d0a729d940b4 (diff)
* grub-core/font/font.c (grub_font_load): Add support for default
path for fonts ($prefix/fonts). * grub-core/kern/corecmd.c (grub_core_cmd_insmod): Unify condition for checking if string is a path. * grub-core/normal/main.c (features): Add feature_default_font_path. * util/grub-mkconfig.in: Skip mangling of GRUB_FONT into GRUB_FONT_PATH. * util/grub.d/00_header.in: Use default directory if possible. * util/grub-install.in: Install unicode.pf2.
Diffstat (limited to 'util')
-rw-r--r--util/grub-install.in5
-rw-r--r--util/grub-mkconfig.in37
-rw-r--r--util/grub.d/00_header.in42
3 files changed, 45 insertions, 39 deletions
diff --git a/util/grub-install.in b/util/grub-install.in
index c76a029bd..cbb37ead2 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -451,6 +451,11 @@ if test -d "${pkgdatadir}"/themes/starfield; then
cp "${pkgdatadir}"/themes/starfield/* "${grubdir}"/themes/starfield
fi
+if test -f "${pkgdatadir}"/unicode.pf2; then
+ mkdir -p "${grubdir}"/fonts
+ cp "${pkgdatadir}"/unicode.pf2 "${grubdir}"/fonts
+fi
+
is_path_readable_by_grub "${grubdir}/${target_cpu}-$platform" || (echo "${grubdir}" not readable 1>&2 ; exit 1)
# Write device to a variable so we don't have to traverse /dev every time.
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 9c405053f..198bd37a9 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -157,41 +157,6 @@ if [ "x${GRUB_TERMINAL_OUTPUT}" = "x" ]; then
fi
for x in ${GRUB_TERMINAL_OUTPUT}; do
- if [ "x${x}" = "xgfxterm" ]; then
- if [ -n "$GRUB_FONT" ] ; then
- if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
- GRUB_FONT_PATH=${GRUB_FONT}
- else
- echo "No such font or not readable by grub: ${GRUB_FONT}" >&2
- exit 1
- fi
- else
- for dir in ${pkgdatadir} ${GRUB_PREFIX} /usr/share/grub ; do
- for basename in unicode unifont ascii; do
- path="${dir}/${basename}.pf2"
- if is_path_readable_by_grub ${path} > /dev/null ; then
- GRUB_FONT_PATH=${path}
- else
- continue
- fi
- if [ "${basename}" = "ascii" ] ; then
- # make sure all our children behave in conformance with ascii..
- export LANG=C
- fi
- break 2
- done
- done
- fi
- if [ -z "${GRUB_FONT_PATH}" ] ; then
- if [ "x$termoutdefault" != "x1" ]; then
- gettext "No font for video terminal found." >&2; echo >&2 ; exit 1
- fi
- GRUB_TERMINAL_OUTPUT=
- fi
- fi
-done
-
-for x in ${GRUB_TERMINAL_OUTPUT}; do
case "x${x}" in
xgfxterm) ;;
xconsole | xserial | xofconsole)
@@ -208,7 +173,7 @@ export GRUB_DEVICE \
GRUB_DEVICE_BOOT \
GRUB_DEVICE_BOOT_UUID \
GRUB_FS \
- GRUB_FONT_PATH \
+ GRUB_FONT \
GRUB_PRELOAD_MODULES \
GRUB_PREFIX
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 781d7d47e..e47d5ba17 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -124,11 +124,47 @@ if [ "x$serial" = x1 ]; then
fi
if [ "x$gfxterm" = x1 ]; then
- # Make the font accessible
- prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT_PATH}"`
+ if [ -n "$GRUB_FONT" ] ; then
+ # Make the font accessible
+ prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
+ cat << EOF
+if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
+EOF
+ else
+ for dir in ${pkgdatadir} ${GRUB_PREFIX} /usr/share/grub ; do
+ for basename in unicode unifont ascii; do
+ path="${dir}/${basename}.pf2"
+ if is_path_readable_by_grub ${path} > /dev/null ; then
+ font_path=${path}
+ else
+ continue
+ fi
+ break 2
+ done
+ done
+ if [ -n "${font_path}" ] ; then
+ cat << EOF
+if [ x\$feature_default_font_path = xy ] ; then
+ font=unicode
+else
+EOF
+
+ # Make the font accessible
+ prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
+ cat << EOF
+ font="`make_system_path_relative_to_its_root "${font_path}"`"
+fi
+
+if loadfont \$font ; then
+EOF
+ else
+ cat << EOF
+if loadfont unicode ; then
+EOF
+ fi
+ fi
cat << EOF
-if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}
load_video
insmod gfxterm