-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure
executable file
·281 lines (245 loc) · 7.97 KB
/
configure
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#!/bin/bash
# Copyright (c) 2014, Redmaner
up=$PWD
# Define bash colors for Mac OSX / Linux
case `uname -s` in
Darwin)
txtrst='\033[0m' # Color off
txtred='\033[0;31m' # Red
txtgrn='\033[0;32m' # Green
txtblu='\033[0;34m' # Blue
;;
*)
txtrst='\e[0m' # Color off
txtred='\e[1;31m' # Red
txtgrn='\e[1;32m' # Green
txtblu='\e[1;36m' # Blue
;;
esac
InputPathOrig () {
echo -e "\nPlease enter the path to the exsisting repository, up to the main folder (root of the applications)
For example: /home/redmaner/MIUI6-XML-NL/Dutch/main"
read input
if [ -d $input ]; then
orig_dir=$input
else
echo -e "${txtred}Path doesn't exsist${txtrst}"; InputPathOrig
fi
}
CheckAosp () {
echo -e "\nIs this exsisting repository AOSP? (yes,no): "; read input
case $input in
"yes"|"no")
aosp=$input;;
*) echo "${txtred}Wrong input${txtrst}"; CheckAosp;;
esac
}
InputPathTarg () {
echo -e "\nPlease enter the path to the repository with exsisting translations
Up to the main folder (root of the applications)
For example: /home/redmaner/MA-XML-5.0-DUTCH/Dutch/main"
read input
if [ -d $input ]; then
targ_dir=$input
CheckAosp
else
echo "${txtred}Path doesn't exsist${txtrst}"; InputPathTarg
fi
}
InputPathNew () {
echo -e "\nPlease enter the path to the exsisting repository, up to the main folder (root of the applications)
For example: /home/redmaner/MIUI6-XML-NL/Dutch/main"
read input
if [ -d $input ]; then
new_dir=$input
else
echo "${txtred}Path doesn't exsist${txtrst}"; InputPathNew
fi
}
MakeConfig () {
InputPathTarg
echo -e "Where do the new strings.xml need to go?
1 - New folder/repository
2 - Exsisting repository
WARNING: If you select an exsising repository files could be overwritten by merge"
echo -en "\nPlease enter your choice: "; read input
case "$input" in
1) new_dir=$up/MergedXML/$lang_name/main;;
2) InputPathNew;;
esac
echo -e "\nConfiguration complete, thank you"
cat > .configuration << EOF
#!/bin/bash
lang_version=$lang_version
lang_name=$lang_name
lang_iso=$lang_iso
lang_iso_framework=$lang_iso_framework
orig_dir=$orig_dir
orig_dir_second=$orig_dir_second
dual_merge=$dual_merge
aosp=$aosp
dir_mode=$dir_mode
targ_dir=$targ_dir
new_dir=$new_dir
untranslateable_list=$untranslateable
auto_ignorelist=$auto_ignorelist
value_catcher=$value_catcher
EOF
}
MakeConfigSingleMerge () {
echo -e "\nWhich repository (MIUI Version) do you want to use as base for your new translation?
1 - MIUIv5 aries (Xiaomi Mi2)
2 - MIUIv5 cancro (Xiaomi Mi3/Mi4)
3 - MIUI6 Tablet mocha (Xiaomi MiPad)
4 - MIUI6 Cancro (Xiaomi Mi3/Mi4)
5 - MIUI7 Cancro (Xiaomi Mi3/Mi4)
6 - MIUI8 Cancro (Xiaomi Mi3/Mi4)
7 - MIUI8 Gemini (Xiaomi Mi5)
8 - An exsisting repository on my harddrive"
echo -en "\nPlease enter your choice: "; read input
case "$input" in
1) orig_dir=$up/MIUIv5/aries
dir_mode=auto
lang_version=5
untranslateable=$up/resources/MIUIv5_ignorelist.xml.mxcr;;
2) orig_dir=$up/MIUIv5/cancro
dir_mode=auto
lang_version=5
untranslateable=$up/resources/MIUIv5_ignorelist.xml.mxcr;;
3) orig_dir=$up/MIUI6/mocha
dir_mode=auto
lang_version=6
auto_ignorelist=$up/resources/MIUI6_auto_ignorelist.xml
untranslateable=$up/resources/MIUI6_ignorelist.xml.mxcr;;
4) orig_dir=$up/MIUI6/cancro
dir_mode=auto
lang_version=6
auto_ignorelist=$up/resources/MIUI6_auto_ignorelist.xml
untranslateable=$up/resources/MIUI6_ignorelist.xml.mxcr;;
5) orig_dir=$up/MIUI6/cancro
dir_mode=auto
lang_version=7
auto_ignorelist=$up/resources/MIUI7_auto_ignorelist.xml
untranslateable=$up/resources/MIUI7_ignorelist.xml.mxcr;;
6) orig_dir=$up/MIUI8/cancro
dir_mode=auto
lang_version=8
untranslateable=$up/resources/MIUI8_untranslateable.xml.mxcr
auto_ignorelist=$up/resources/MIUI8_auto_ignorelist.xml
value_catcher=$up/resources/MIUI8_value_catcher.sh;;
7) orig_dir=$up/MIUI8/cancro
dir_mode=auto
lang_version=8
untranslateable=$up/resources/MIUI8_untranslateable.xml.mxcr
auto_ignorelist=$up/resources/MIUI8_auto_ignorelist.xml
value_catcher=$up/resources/MIUI8_value_catcher.sh;;
8) InputPathOrig
dir_mode=custom
lang_version=8
untranslateable=$up/resources/MIUI8_untranslateable.xml.mxcr
auto_ignorelist=$up/resources/MIUI8_auto_ignorelist.xml
value_catcher=$up/resources/MIUI8_value_catcher.sh;;
esac
dual_merge=false
orig_dir_second=
MakeConfig
}
MakeConfigDualMerge () {
echo -e "\nWhich two repositories (MIUI Version) do you want to use as base for your new translation?
1 - MIUI8 Gemini and MIUI8 sagit
2 - MIUI9 Mido and MIUI9 sagit"
echo -en "\nPlease enter your choice: "; read input
case "$input" in
1)
orig_dir=$up/MIUI8/gemini
orig_dir_second=$up/MIUI8/sagit
dual_merge=true
dir_mode=auto
lang_version=8
untranslateable=$up/resources/MIUI8_untranslateable.xml.mxcr
auto_ignorelist=$up/resources/MIUI8_auto_ignorelist.xml
value_catcher=$up/resources/MIUI8_value_catcher.sh;;
2)
orig_dir=$up/MIUI9/mido
orig_dir_second=$up/MIUI9/sagit
dual_merge=true
dir_mode=auto
lang_version=9
untranslateable=$up/resources/MIUI9_untranslateable.xml.mxcr
auto_ignorelist=$up/resources/MIUI9_auto_ignorelist.xml
value_catcher=$up/resources/MIUI9_value_catcher_lean.sh;;
esac
MakeConfig
}
MakeConfigInit () {
echo -e "\nThis tool merges exsisting XML translations into new XML's and is designed for Xiaomi.eu translation repositories.
This tool requires some information to work properly and only works for the main folder."
echo -en "\nPlease enter the name of your language (for example: Dutch): "; read input
lang_name=$input
echo -en "\nplease enter the iso code of your language (for example: nl): "; read input
lang_iso=$input
echo -en "\nplease enter the framework iso code of your language (for example: nl-rNL): "; read input
lang_iso_framework=$input
echo -en "\nplease select merge type:
1 - Single repository
2 - Two repositories "; read input
case "$input" in
1) MakeConfigSingleMerge;;
2) MakeConfigDualMerge;;
esac
}
SyncRepo () {
case "$1" in
new)
rm -rf $3
git clone $2 $3;;
update)
cd $2; git pull origin $3; cd $up;;
esac
}
#echo -e "${txtblu}\nSyncing v5-XML-compare (MIUIv5)${txtrst}"
#if [ -d $up/MIUIv5 ]; then
# SyncRepo "update" "MIUIv5" "master"
#else
# SyncRepo "new" "https://github.com/Acid-miuipolskapl/v5-XML-Compare" "MIUIv5"
#fi
echo -e "${txtblu}\nSyncing v6-XML-compare (MIUI6/MIUI7)${txtrst}"
if [ -d $up/MIUI6 ]; then
SyncRepo "update" "MIUI6" "master"
else
SyncRepo "new" "https://github.com/Acid-miuipolskapl/v6-XML-Compare" "MIUI6"
fi
echo -e "${txtblu}\nSyncing v8-XML-compare (MIUI8)${txtrst}"
if [ -d $up/MIUI8 ]; then
SyncRepo "update" "MIUI8" "master"
else
SyncRepo "new" "https://github.com/Acid-miuipolskapl/v8-XML-Compare" "MIUI8"
fi
echo -e "${txtblu}\nSyncing Xiaomi.eu-MIUIv9-XML-Compare (MIUI9)${txtrst}"
if [ -d $up/MIUI9 ]; then
SyncRepo "update" "MIUI9" "master"
else
SyncRepo "new" "https://github.com/ingbrzy/Xiaomi.eu-MIUIv9-XML-Compare" "MIUI9"
fi
echo -e "${txtblu}\nSyncing resources${txtrst}"
if [ -d $up/resources ]; then
SyncRepo "update" "resources" "master"
else
SyncRepo "new" "https://github.com/Redmaner/MA-XML-CHECK-RESOURCES" "resources"
fi
echo -e "${txtblu}\nPreparing resources${txtrst}"
cat $up/resources/resources.xml | grep 'preparse="true"' | while read preparse_entry; do
preparse_file=$(echo $preparse_entry | cut -d' ' -f2 | cut -d'"' -f2)
if [ -e $up/resources/$preparse_file.md5 ]; then
if [ $(md5sum $up/resources/$preparse_file | cut -d' ' -f1) != $(cat $up/resources/$preparse_file.md5) ]; then
md5sum $up/resources/$preparse_file | cut -d' ' -f1 > $up/resources/$preparse_file.md5
$up/res_tools --parse_ignorelist $up/resources/$preparse_file $up/resources/$preparse_file.mxcr
fi
else
md5sum $up/resources/$preparse_file | cut -d' ' -f1 > $up/resources/$preparse_file.md5
$up/res_tools --parse_ignorelist $up/resources/$preparse_file $up/resources/$preparse_file.mxcr
fi
done
if [ ! -f "$up/.configuration" ]; then
MakeConfigInit
fi