Skip to content

Instantly share code, notes, and snippets.

@nihilismus
Created November 1, 2016 12:01
Show Gist options
  • Save nihilismus/50b26f78b3caf3c828c6de81e6b7dfa2 to your computer and use it in GitHub Desktop.
Save nihilismus/50b26f78b3caf3c828c6de81e6b7dfa2 to your computer and use it in GitHub Desktop.
infinality-fonts-local-install.sh: install the latest versions available of Infinality fonts in $HOME/.local/share/fonts
#!/bin/bash
# infinality-fonts-local-install.sh: download the latest versions available of
# Infinality fonts: http://bohoomil.com/repo/fonts/
# and install them into $HOME/.local/share/fonts
# Copyright © 2016 Antonio Hernández Blas <[email protected]>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
set -e
set -x
me=infinality-fonts-local-install
get_urls() {
wget \
http://bohoomil.com/repo/fonts/ -O - 2>/dev/null | \
sed 's/ href=/\n/g' |
grep -v '\-meta-' | \
grep -E 'pkg.tar.xz"' | \
sed 's/"//' | \
sed 's/pkg.tar.xz".*/pkg.tar.xz/' | \
grep -E '^otf-|^ttf-' | \
sed 's_^_http://bohoomil.com/repo/fonts/_' | \
sort
}
get_urls_no_cjk_jp_kr_tw_cn() {
get_urls | \
grep -v '\-cjk-' | \
grep -v '\-jp-' | \
grep -v '\-kr-' | \
grep -v '\-tw-' | \
grep -v '\-cn-'
}
# main
mkdir -p /tmp/$(whoami)-${me}
cd /tmp/$(whoami)-${me}
get_urls_no_cjk_jp_kr_tw_cn > urls.txt
wget -c -i urls.txt
ls -1 *tar.xz | \
while read file_name; do
tar xf $file_name
done
if [ -d ${XDG_CONFIG_HOME}/fontconfig/conf.d ]; then
fontconfig=${XDG_CONFIG_HOME}/fontconfig/conf.d
else
fontconfig=${HOME}/.fonts.conf.d
fi
if [ ! -d ${fontconfig} ]; then
mkdir -p ${fontconfig}
fi
mv etc/fonts/conf.avail/* ${fontconfig}/
mkdir -p $HOME/.local/share/fonts
mv usr/share/fonts/* $HOME/.local/share/fonts/
fc-cache -fv
#EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment