forked from w0ng/googlefontdirectory
-
Notifications
You must be signed in to change notification settings - Fork 90
/
install.sh
executable file
·32 lines (29 loc) · 1.13 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# OS detection
osdetect=$(uname)
file_path="unknown"
if [[ "$osdetect" == 'Darwin' ]]; then
file_path="/Library/Fonts/"
elif [[ "$osdetect" == 'Linux' ]]; then
if [[ -d /usr/local/share/fonts/ ]]; then # Debian/Ubuntu and others.
file_path="/usr/local/share/fonts/"
elif [[ -d /usr/share/fonts/ ]]; then # OpenSUSE, Arch and other distros using this directory structure
sudo mkdir -p /usr/share/fonts/google/
file_path="/usr/share/fonts/google/"
else # Fallback to installing fonts locally to the user, this is a safe bet, as several distros use this location.
mkdir -p ~/.fonts
file_path="~/.fonts/"
fi
fi
clear
echo "Installing all Google Web Fonts onto your System"
echo "Downloading the fonts..."
curl -L https://github.com/google/fonts/archive/main.tar.gz -o /tmp/master.tar.gz
echo "Extracting the fonts..."
mkdir -p /tmp/goog-fonts/fonts
tar -zxf /tmp/master.tar.gz -C /tmp/goog-fonts/fonts
sudo find /tmp/goog-fonts/fonts/ -type f -name "*.ttf" -exec cp {} $file_path \;
echo "Fonts installed; Cleaning up files..."
rm -f /tmp/master.tar.gz
rm -rf /tmp/goog-fonts
echo "All done! All Google Fonts installed."