forked from fehawen/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfonts.sh
executable file
·42 lines (32 loc) · 916 Bytes
/
fonts.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
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
copy_fonts() {
src="$1"
dest="$2"
work_dir="$PWD/$src"
if [[ ! -d "$dest" ]]; then
printf 'Directory "%s" does not exist.\n' "$dest"
printf 'Creating directory "%s"...\n' "$dest"
sudo mkdir -p "$dest"
fi
pushd "$work_dir" > /dev/null || {
printf 'Cannot push to dir "%s"\n' "$work_dir"
exit 1
}
for font_dir in *; do
if [[ -d $font_dir ]]; then
printf 'Copying "%s" from "%s" to "%s"...\n' "$font_dir" "$work_dir" "$dest"
sudo cp -r "$font_dir" "$dest/"
fi
done
cd "$(dirs -l -0)" && dirs -c
}
setup_fonts() {
printf "Setting up fonts...\n"
base_dir="fonts"
global_dest="/usr/share/fonts"
local_dest="$HOME/.local/share/fonts"
copy_fonts "$base_dir" "$global_dest"
copy_fonts "$base_dir" "$local_dest"
printf '%s\n' "Done."
}
setup_fonts