-
Notifications
You must be signed in to change notification settings - Fork 0
/
font.sh
106 lines (75 loc) · 2.3 KB
/
font.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
#-------------------------------
# Created By Mizanur Rahman [3rR0r PriNc3]
#
# Get me by bcmrashed@gmail.com or 3rr0r.pr1nc3@gmail.com if you want to ...
#-------------------------------
echo "Welcome to https://github.com/3rR0r-Pr1Nc3!!!"
echo "------------------------------------"
echo "Now starting to download and install all bangla fonts..........."
echo "------------------------------------"
# Variables
downloadUrls=("http://www.fahadahammed.com/extras/fonts/archieve/lsaBanglaFonts.tar.gz" "https://raw.githubusercontent.com/fahadahammed/linux-bangla-fonts/master/archieve/lsaBanglaFonts.tar.gz")
finalurl="" # it will select lowest latency mirror
# Get arrays of latency and plain urls.
point=()
pointPlus=()
finalu=()
for i in ${downloadUrls[@]};do
a=$(echo $i | sed 's|http://||g' | sed 's|https://||g' | cut -d '/' -f -1)
aa=$(ping -c 5 "$a" | tail -1 | awk '{print $4}' | cut -d '/' -f 2)
aaa=${aa%.*}
point+=("$aaa")
pointPlus+=("$aaa,$a")
finalu+=("$aaa,$i")
done
# Calculate Minimum Latency
#---------------------------
max=${point[0]}
min=${point[0]}
echo $min
# Loop through all elements in the array
for i in "${finalu[@]}"
do
a=$(echo $i | cut -d ',' -f 1)
# Update max if applicable
if [[ "$a" -gt "$max" ]]; then
max="$i"
fi
# Update min if applicable
if [[ "$a" -lt "$min" ]]; then
min="$i"
fi
done
finalurl=$(echo $min | cut -d ',' -f 2)
if [ $USER = "root" ]; then
fontsDir="/root/.fonts/lsaBanglaFonts"
fi
if [ $USER != "root" ]; then
fontsDir="/home/$USER/.fonts/lsaBanglaFonts"
fi
echo -e "\n"
if [ ! -d "$fontsDir" ]; then
mkdir -p $fontsDir
else
echo -e "Upgrading bangla fonts provided by us....\n";
rm -r $fontsDir;
fi
echo -e "\n"
echo -e "Downloading the fonts compressed file....\n"
echo -e "\n"
echo $finalurl
wget -v -P $fontsDir"/" $finalurl
cd $fontsDir"/"
tar -zxvf lsaBanglaFonts.tar.gz
rm lsaBanglaFonts.tar.gz
cd
echo -e "\n"
echo -e "Initiating font refresh......\n"
fc-cache -f -v
echo -e "\n"
echo "------------------------------------"
echo "Bangla Font Installation Complete...... Welcome To Error Prince Bangla Font!!!"
echo -e "Script is Created by Mizanur Rahman [3rR0r Pr1Nc3]\n"
echo -e "github: https://github.com/3rR0r-Pr1Nc3\n"
echo -e "facebook: https://facebook.com/error.prince3\n"