Skip to content

Instantly share code, notes, and snippets.

@victorono
Created March 12, 2017 02:28
Show Gist options
  • Save victorono/8fb2b87f041c5fc4dc647ebd6309aef1 to your computer and use it in GitHub Desktop.
Save victorono/8fb2b87f041c5fc4dc647ebd6309aef1 to your computer and use it in GitHub Desktop.
Install all Google Web Fonts onto your local machine
#!/bin/bash
# OS detect
osdetect=$(uname)
file_path="unknown"
if [[ "$osdetect" == 'Linux' ]]; then
file_path="sudo mv fonts/* /usr/local/share/fonts/"
elif [[ "$osdetect" == 'Darwin' ]]; then
file_path="mv fonts/* /Library/Fonts/"
elif [[ "$osdetect" == 'Arch Linux' ]]; then
file_path="sudo mv fonts/* /usr/share/fonts/"
fi
clear
echo "Installing all Google Web Fonts onto your System"
echo "Downloading the fonts..."
cd ~
curl -L https://github.com/google/fonts/tarball/master -o master.tar.gz
echo "Extracting the fonts..."
mkdir -p goog-fonts/fonts
tar -zxf master.tar.gz -C goog-fonts/fonts
cd goog-fonts
cd fonts
find . -mindepth 2 -type f -print -exec mv {} . \;
rm -R -- */
rm *.txt
rm *.json
rm *.csv
rm *.md
rm *.html
rm *.py
rm AUTHORS
rm CONTRIBUTORS
cd ..
$file_path
echo "Fonts installed; Cleaning up files..."
cd ~
rm -f master.tar.gz
rm -rf goog-fonts
echo "All done! All Google Fonts installed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment