-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-fonts.sh
More file actions
35 lines (28 loc) · 794 Bytes
/
install-fonts.sh
File metadata and controls
35 lines (28 loc) · 794 Bytes
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
33
34
35
#!/bin/bash
the_fonts_dir=$(pwd)/fonts
echo "the fonts dir: $the_fonts_dir"
find_command="find \"$the_fonts_dir\" \( -name '*.[o,t]tf' -or -name '*.pcf.gz' \) -type f -print0"
kernel=$(uname)
case "$kernel" in
'Darwin') # macOS
font_dir="$HOME/Library/Fonts"
;;
'Linux')
font_dir="$HOME/.local/share/fonts"
mkdir -p $font_dir
;;
*)
echo "Unknown OS: $kernel"
;;
esac
# Copy all fonts to user fonts directory
echo "Copying fonts..."
# printing
eval $find_command | xargs -0 -I %
eval $find_command | xargs -0 -I % cp "%" "$font_dir/"
# Reset font cache on Linux
if command -v fc-cache @>/dev/null ; then
echo -e "\nResetting font cache, this may take a moment..."
fc-cache -f $font_dir
fi
echo -e "\nAll fonts have been installed to $font_dir"