forked from dv-anomaly/ttf-wps-fonts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·60 lines (48 loc) · 1.17 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
if [[ $(id -u) -ne 0 ]] ; then
echo "This script requires sudo privileges"
exit 1
fi
HOME_FONT="$HOME/.fonts"
MOST_DISTROS="/usr/share/fonts"
RHL5="/usr/X11R6/lib/X11/fonts"
RHL6="/usr/X11R6/lib/X11/fonts"
if test -e $MOST_DISTROS ; then
FONT_PATH=$MOST_DISTROS
elif test -e $RHL5 ; then
FONT_PATH=$RHL5
elif test -e $RHL6 ; then
FONT_PATH=$RHL6
else
FONT_PATH=$HOME_FONT
fi
FONT_PATH=$FONT_PATH"/wps-fonts"
if [ -d "$FONT_PATH" ]; then
# flush stdin
while read -r -t 0; do read -r; done
read -p "Font Directory already exists, continue? [y/N] " -n 1 -r
if [[ $REPLY == "" ]]; then
exit 0
elif [[ $REPLY =~ ^[Nn]$ ]]; then
exit 0
fi
fi
echo -e "\nFonts will be installed in: "$FONT_PATH
read -p "Continue with installation? [Y/n] " -n 1 -r
if [[ $REPLY =~ ^[Nn]$ ]]; then
exit 0
fi
if [ ! -d "$FONT_PATH" ]; then
echo "Creating Font Directory..."
mkdir $FONT_PATH
fi
echo "Installing Fonts..."
cp *.ttf $FONT_PATH
cp *.TTF $FONT_PATH
echo "Fixing Permissions..."
chmod 644 $FONT_PATH/*
echo "Rebuilding Font Cache..."
fc-cache -vfs
echo "Installation Finished."
exit 0