void-packages/srcpkgs/grub-terminus/files/grub-terminus.template

33 lines
807 B
Bash

#!/bin/sh
#
# Helper script to add or modify the /etc/default/grub
# line starting with GRUB_FONT to use one of the
# /boot/grub/fonts/terminus<size>.pf2 files.
#
if [ "$(id -r -u)" -ne 0 ]; then
echo "$0 needs to be run as root."
exit 1
fi
if [ $# -ne 1 ]; then
echo "Usage: grub-terminus <size>"
echo "Where size is one of: @sizes@"
exit 1
fi
if ! [ -e /etc/default/grub ]; then
echo "Did not find /etc/default/grub to modify."
exit 1
fi
font=/boot/grub/fonts/terminus${1}.pf2
if ! [ -e ${font} ]; then
echo "Font ${font} does not exist."
exit 1
fi
grep -v "^GRUB_FONT=" /etc/default/grub > /tmp/grub.$$
echo "GRUB_FONT=${font}" >> /tmp/grub.$$
cp -p /etc/default/grub /etc/default/grub.orig
mv /tmp/grub.$$ /etc/default/grub
echo "Changed font to ${font}."
echo "You may now run update-grub."