Skip to content

Instantly share code, notes, and snippets.

@Boldewyn
Created March 15, 2016 12:53
Show Gist options
  • Save Boldewyn/3bd7ae2ff681a5e06194 to your computer and use it in GitHub Desktop.
Save Boldewyn/3bd7ae2ff681a5e06194 to your computer and use it in GitHub Desktop.
Small script to install a font under Linux by means of symlinking to it
#!/bin/bash
ERROR=0
mkdir -p "$HOME/.fonts"
for name in "$@"; do
if [[ ! -f $name ]]; then
echo "Can't find $name" >&2
ERROR=1
continue
elif [[ -f $HOME/.fonts/$(basename "$name") ]]; then
echo "A font named $(basename "$name") already exists" >&2
ERROR=2
continue
fi
FONT="$(readlink -fn "$name")"
ln -s "$FONT" "$HOME/.fonts/$(basename "$name")"
done
mkfontscale "$HOME/.fonts"
mkfontdir "$HOME/.fonts"
fc-cache -f "$HOME/.fonts"
exit $ERROR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment