This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathusbaccelerator.sh
3532 lines (3347 loc) · 124 KB
/
usbaccelerator.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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
###################################################################
###### USB Accelerator by Jack ######
###### Version 2.0.2 ######
###### ######
###### https://github.com/JackMerlin/USBAccelerator ######
###### ######
###################################################################
PARM_1="$1"
PARM_2="$2"
PARM_3="$3"
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:$PATH"
VERSION="2.0.2"
RELEASE_TYPE="stable"
S_DIR="/jffs/scripts"
ADD_DIR="/jffs/addons"
UA_DIR="$ADD_DIR/usbaccelerator"
CUR_DIR="$(cd `dirname $0`; pwd)"
S_NAME="$(basename $0)"
LANG="$(awk -F'"' '/^LANG=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)"
[ -z "$LANG" ] && LANG="$(nvram get preferred_lang 2>/dev/null)" || LANG="$LANG"
[ -z "$(nvram get odmpid 2>/dev/null)" ] && R_M="$(nvram get productid 2>/dev/null)" || R_M="$(nvram get odmpid 2>/dev/null)"
FWVER="$(nvram get buildno 2>/dev/null)"
TIMESTAMP="$(date +%F)"
FIRST_TIME="$(awk -F'"' '/^FIRST_TIME=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)"
SRC_1="https://raw.githubusercontent.com/JackMerlin/USBAccelerator/master"
SRC_2="https://gitlab.com/JackMerlin/USBAccelerator/raw/master"
HOST_HOME_1="https://github.com/JackMerlin/USBAccelerator"
HOST_HOME_2="https://gitlab.com/JackMerlin/USBAccelerator"
SC_GLOBAL="0"
FORCE="0"
QUIET="0"
C_LW='\033[1;37m'
C_LB='\033[1;30m'
C_G='\033[0;32m'
C_LG='\033[1;32m'
C_Y='\033[0;33m'
C_LY='\033[1;33m'
C_R='\033[0;31m'
C_LR='\033[1;31m'
C_C='\033[0;36m'
C_LC='\033[1;36m'
C_RS='\033[0m'
Home() {
if [ -n "$(awk -F'"' '/^UPDATE_COMPLETED=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" ]; then
Whats_New
sed -i '/UPDATE_COMPLETED/d' "$UA_DIR/CONFIG" 2>/dev/null
fi
if [ -z "$(awk -F'"' '/^ENABLE_STATUS=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" ]; then
Check_Firmware
Check_Model
fi
if [ "$FWTYPE" = "384M" ] && [ "$HND_MODEL" = "1" ] && [ "$(awk -F'"' '/^IGNORED_CKFWHW=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '你所使用的硬件和固件已经具备较好的性能,继续使用可能无法打破瓶颈\n'
printf '%b是否继续安装我呢?%b\n' "$C_Y" "$C_RS"
printf ' %by%b = 继续安装\n' "$C_LG" "$C_RS"
printf ' %bn%b = 卸载并退出\n' "$C_LG" "$C_RS"
else
printf 'Look at that, your firmware has many nice settings, and your router\n'
printf 'has a very powerful CPU. If you choose to install the speed may not\n'
printf 'be as expected.\n'
printf '%bDo you still want to install me?%b\n' "$C_Y" "$C_RS"
printf ' %by%b = Continue to install\n' "$C_LG" "$C_RS"
printf ' %bn%b = Uninstall and exit\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n该怎么做呢?\n'
else
printf '\nWhat do you want to do?\n'
fi
read -r "home_menu0"
case "$home_menu0" in
y|Y)
Check_Directories
sed -i '/IGNORED_CKFWHW/d' "$UA_DIR/CONFIG" 2>/dev/null
echo '' >> "$UA_DIR/CONFIG"
echo 'IGNORED_CKFWHW="1"' >> "$UA_DIR/CONFIG"
sed -i '/^$/d' "$UA_DIR/CONFIG"
chmod 644 "$UA_DIR/CONFIG"
break
;;
n|N)
UNINSTALL_RETURN="2"
SC_GLOBAL="3"
Uninstall_Confirmation
break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 不正确,请再试一次\n' "$C_LG" "$home_menu0" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, please try again\n' "$C_LG" "$home_menu0" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
fi
if [ ! -f "$UA_DIR/usbaccelerator.sh" ] || [ ! -f "$UA_DIR/usbstatus.png" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '正在准备为你下载文件,请稍等...\n'
else
printf 'Please wait while the download is starting...\n'
fi
TRIG_CKNT_BY_USER="1"
Check_Files
if [ "$SC_CKFILES" -eq "1" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '文件下载完成,正在重新载入...\n'
else
printf 'Download successful, reloading...\n'
fi
sh "$UA_DIR/usbaccelerator.sh"; SC_GLOBAL="$?"; rm -f /tmp/usbaccelerator.sh; exit "$SC_GLOBAL"
fi
if [ "$SC_CKFILES" -gt "1" ] && [ "$DONT_DL" != "1" ]; then
Download_Files_UI
if [ "$SC_DOWNLOAD" = "0" ] && [ -f "$UA_DIR/usbaccelerator.sh" ] && [ -f "$UA_DIR/usbstatus.png" ]; then
sh "$UA_DIR/usbaccelerator.sh"; SC_GLOBAL="$?"; rm -f /tmp/usbaccelerator.sh; exit "$SC_GLOBAL"
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b注意%b:所需文件未找到,无法顺利开启,建议手动重新安装\n' "$C_LR" "$C_RS"
else
printf '%bWARNING%b: Missing files, please reinstall\n' "$C_LR" "$C_RS"
fi
fi
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b注意%b:所需文件未找到,无法顺利开启,建议手动重新安装\n' "$C_LR" "$C_RS"
else
printf '%bWARNING%b: Missing files, please reinstall\n' "$C_LR" "$C_RS"
fi
fi
fi
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b欢迎来到USB加速器v%b的控制面板,\n你可以输入对应的内容进行相关的操作%b\n' "$C_Y" "$VERSION" "$C_RS"
if [ "$(awk -F'"' '/^ENABLE_STATUS=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
printf '\n %b1%b = 开启\n' "$C_LG" "$C_RS"
printf ' %b2 = 关闭%b\n' "$C_LB" "$C_RS"
else
printf '\n %b1 = 开启%b\n' "$C_LB" "$C_RS"
printf ' %b2%b = 关闭\n' "$C_LG" "$C_RS"
fi
printf '\n %b3%b = 下载和更新\n' "$C_LG" "$C_RS"
printf ' %b4%b = 其他设置\n' "$C_LG" "$C_RS"
printf ' %b5%b = 查看文档\n' "$C_LG" "$C_RS"
printf '\n %b8%b = 重新安装\n' "$C_LG" "$C_RS"
printf ' %b9%b = 卸载\n' "$C_LG" "$C_RS"
printf '\n %be%b = 退出控制面板\n' "$C_LG" "$C_RS"
else
printf '%bWelcome, here is the control panel of USB Accelerator v%b%b\n' "$C_Y" "$VERSION" "$C_RS"
if [ "$(awk -F'"' '/^ENABLE_STATUS=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
printf '\n %b1%b = Enable\n' "$C_LG" "$C_RS"
printf ' %b2 = Disable%b\n' "$C_LB" "$C_RS"
else
printf '\n %b1 = Enable%b\n' "$C_LB" "$C_RS"
printf ' %b2%b = Disable\n' "$C_LG" "$C_RS"
fi
printf '\n %b3%b = Download and Update\n' "$C_LG" "$C_RS"
printf ' %b4%b = Other Settings\n' "$C_LG" "$C_RS"
printf ' %b5%b = Read Documents\n' "$C_LG" "$C_RS"
printf '\n %b8%b = Re-install\n' "$C_LG" "$C_RS"
printf ' %b9%b = Uninstall\n' "$C_LG" "$C_RS"
printf '\n %be%b = Exit\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
e_r_r="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease enter\n'
fi
read -r "home_menu1"
case "$home_menu1" in
1)Enable_UI; break
;;
2)
if [ "$(awk -F'"' '/^ENABLE_STATUS=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "0" ]; then
Disable_UI; break
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then printf '已禁用,无须重复禁用\n'; else printf 'Disabled, no need to disable again\n'; fi
fi
;;
3)Update_Options_UI; break
;;
4)Other_Settings_UI; break
;;
5)Read_Documents_UI; break
;;
8)Reinstall_Confirmation; break
;;
9)Uninstall_Confirmation; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
0)
e_r_r="$((e_r_r + 1))"
if [ "$e_r_r" -ge "3" ]; then
Error_344; break
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '你输入的好像不对呀,要再试一次吗?\n'
else
printf 'You may have entered the wrong number.\nHow about trying again?\n'
fi
fi
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 不正确嘛,再试一次喽\n' "$C_LG" "$home_menu1" "$C_RS"
else
printf '\nUhhh...it looks like "%b%b%b" you entered is wrong.\n' "$C_LG" "$home_menu1" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
}
Enable_UI() {
if [ -n "$(nvram get usb_usb3 2>/dev/null)" ] && [ "$(nvram get usb_usb3)" != "1" ] && [ "$(awk -F'"' '/^USB_MODE=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "2_0" ]; then
Change_USB_Mode_UI
fi
SC_ENABLE=""
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b提示: 在开启USB加速器过程中请暂停对USB设备的任何读写操作%b\n' "$C_LW" "$C_RS"
printf ' %b1%b = 继续开启\n' "$C_LG" "$C_RS"
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bNOTE: Please suspend any read and write access to\nUSB device(s) before the enabling is complete.%b\n' "$C_LW" "$C_RS"
printf ' %b1%b = Enable\n' "$C_LG" "$C_RS"
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n准备好了吗?\n'
else
printf '\nEnter to continue\n'
fi
read -r "enable_ui_menu0"
case "$enable_ui_menu0" in
1)if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then printf '正在开启请稍等...\n'; else printf 'Please wait...\n'; fi; Enable
break
;;
0)Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次哦\n' "$C_LG" "$enable_ui_menu0" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, please try again.\n' "$C_LG" "$enable_ui_menu0" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
if [ "$SC_ENABLE" -eq "0" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%bUSB加速器已经成功开启%b(状态码:%b)\n' "$C_LC" "$C_RS" "$SC_ENABLE"
if [ "$ENABLE_JFFS_SCRIPTS" = "1" ]; then
printf '为现实正常运行已开启JFFS自定义脚本和配置\n'
fi
if [ "$SC_USBMODE" = "2" ]; then
printf '路由器需重新启动才能获得应用某些设置\n'
fi
printf '\n%b是否进行安全设置以提高路由器的安全性?%b\n' "$C_Y" "$C_RS"
printf ' %b1%b = 进行设置\n' "$C_LG" "$C_RS"
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
printf ' %be%b = 退出\n' "$C_LG" "$C_RS"
else
printf '%bUSB Accelerator has been successfully enabled.%b\n(Status Code:%b)\n' "$C_LC" "$C_RS" "$SC_ENABLE"
if [ "$ENABLE_JFFS_SCRIPTS" = "1" ]; then
printf 'I enabled JFFS custom scripts and configs to run USB Accelerator\n'
fi
if [ "$SC_USBMODE" = "2" ]; then
printf 'For get the best speed, please reboot your router later\n'
fi
printf '\n%bDo you want to check the unsafe settings of your router?%b\n' "$C_Y" "$C_RS"
printf ' %b1%b = Go to Check\n' "$C_LG" "$C_RS"
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
printf ' %be%b = Exit\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease enter\n'
fi
read -r "enable_ui_menu1"
case "$enable_ui_menu1" in
1)Check_Security_UI; Home; break
;;
0)Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次哦\n' "$C_LG" "$enable_ui_menu1" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, do you mind trying again?\n' "$C_LG" "$enable_ui_menu1" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
fi
if [ "$SC_ENABLE" -eq "100" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf 'USB加速器已开启了,无需重复启用(状态码:%b)\n' "$SC_ENABLE"
else
printf 'the USB Accelerator has been enabled, no need to enable again\n(Status Code:%b)\n' "$SC_ENABLE"
fi
printf '___________________________________________________________________\n'
Home
fi
if [ "$SC_ENABLE" -eq "1000" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf 'USB加速器可能不支持你的固件(状态码:%b)\n' "$SC_ENABLE"
else
printf 'Failed to enable USB Accelerator, may not support your firmware\n(Status Code:%b)\n' "$SC_ENABLE"
fi
printf '___________________________________________________________________\n'
Home
fi
if [ "$SC_ENABLE" -gt "0" ] && [ "$SC_ENABLE" -lt "100" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf 'USB加速器%b开启失败%b :(\n' "$C_LR" "$C_RS"
printf ' %b1%b = 再试一次\n' "$C_LG" "$C_RS"
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
printf ' %be%b = 退出\n' "$C_LG" "$C_RS"
else
printf '%bFailed to enable USB Accelerator%b :(\n' "$C_LR" "$C_RS"
printf ' %b1%b = Try again\n' "$C_LG" "$C_RS"
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
printf ' %be%b = Exit\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease enter\n'
fi
read -r "enable_ui_menu2"
case "$enable_ui_menu2" in
1)Enable_UI; break
;;
0)Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次哦\n' "$C_LG" "$enable_ui_menu2" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, please try again.\n' "$C_LG" "$enable_ui_menu2" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
fi
}
Disable_UI() {
SC_DISABLE=""
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b提示: 在关闭USB加速器过程中请暂停对USB设备的任何读写操作%b\n' "$C_LW" "$C_RS"
printf ' %b1%b = 继续关闭\n' "$C_LG" "$C_RS"
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bNOTE: Please suspend any read and write access to\nUSB device(s) before the disabling is complete.%b\n' "$C_LW" "$C_RS"
printf ' %b1%b = Disable\n' "$C_LG" "$C_RS"
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n准备好了吗?\n'
else
printf '\nEnter to continue\n'
fi
read -r "disable_ui_menu0"
case "$disable_ui_menu0" in
1)if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then printf '正在关闭请稍等...\n'; else printf 'Please wait...\n'; fi; Disable
break
;;
0)Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次哦\n' "$C_LG" "$disable_ui_menu0" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, please try again.\n' "$C_LG" "$disable_ui_menu0" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
if [ "$SC_DISABLE" -eq "0" ] || [ "$SC_DISABLE" -eq "100" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf 'USB加速器%b关闭成功%b (状态码:%b)\n' "$C_LC" "$C_RS" "$SC_DISABLE"
else
printf 'the USB Accelerator %bsuccessfully disabled%b\n(Status Code:%b)\n' "$C_LC" "$C_RS" "$SC_DISABLE"
fi
printf '___________________________________________________________________\n'
Home
else
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf 'USB加速器%b关闭失败%b (状态码:%b)\n' "$C_LR" "$C_RS" "$SC_DISABLE"
else
printf 'the USB Accelerator %bdisable failed%b\n(Status Code:%b)\n' "$C_LR" "$C_RS" "$SC_DISABLE"
fi
printf '___________________________________________________________________\n'
if [ -n "$SC_DISABLE" ]; then Home; fi
fi
}
Reinstall_Confirmation() {
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b你确定要重新安装吗?%b\n' "$C_Y" "$C_RS"
printf '提示:重新安装应仅用于排错,如果需升级请使用更新功能\n'
printf '\n %by%b = 确定重新安装\n' "$C_LG" "$C_RS"
printf ' %bn%b = 不进行重新安装\n' "$C_LG" "$C_RS"
else
printf '%bAre you sure you want to Re-install?%b\n' "$C_Y" "$C_RS"
printf 'NOTE: Re-install should only be used to try to solve issue.\nIf you want to update, should use the update function.\n'
printf '\n %by%b = Yes\n' "$C_LG" "$C_RS"
printf ' %bn%b = No\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease Enter\n'
fi
read -r "reinstall_menu0"
case "$reinstall_menu0" in
y|Y)CONFIRM_REINSTALL="1"; break
;;
n|N)CONFIRM_REINSTALL="0"; Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次吧\n' "$C_LG" "$reinstall_menu0" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, try again?\n' "$C_LG" "$reinstall_menu0" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
if [ "$CONFIRM_REINSTALL" = "1" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b要保留配置吗?%b\n' "$C_Y" "$C_RS"
printf '\n %b1%b = 保留配置\n' "$C_LG" "$C_RS"
printf ' %b2%b = 不保留配置\n' "$C_LG" "$C_RS"
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bDo you want to keep configuration?%b\n' "$C_Y" "$C_RS"
printf '\n %b1%b = Keep\n' "$C_LG" "$C_RS"
printf ' %b2%b = Don%st keep\n' "$C_LG" "$C_RS" "'"
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease Enter\n'
fi
read -r "reinstall_menu1"
case "$reinstall_menu1" in
1)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '请稍等,成功后将重新载入...\n'
else
printf 'Please wait for a while, if successful will reload...\n'
fi
CLEAN_INSTALL="0";TRIG_CKNT_BY_USER="1"; TRIG_RI_BY_USER="1"; Reinstall
if [ "$SC_REINSTALL" -gt "0" ] && [ "$SC_REINSTALL" -lt "100" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b注意%b:USB加速器已卸载却无法重装,退出后请手动重新下载\n' "$C_LR" "$C_RS"
else
printf '%bWARNING%b: Files are missing, please reinstall manually\n' "$C_LR" "$C_RS"
fi
Home; break
elif [ "$SC_REINSTALL" -gt "0" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '重装失败\n'
else
printf 'Re-install failed\n'
fi
Home; break
fi
break
;;
2)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '请稍等,成功后将重新载入...\n'
else
printf 'Please wait for a while, if successful will reload...\n'
fi
CLEAN_INSTALL="1";TRIG_CKNT_BY_USER="1"; TRIG_RI_BY_USER="1"; Reinstall
if [ "$SC_REINSTALL" -gt "0" ] && [ "$SC_REINSTALL" -lt "100" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b注意%b:USB加速器已卸载却无法重装,退出后请手动重新下载\n' "$C_LR" "$C_RS"
else
printf '%bWARNING%b: Files are missing, please reinstall manually\n' "$C_LR" "$C_RS"
fi
Home; break
elif [ "$SC_REINSTALL" -gt "0" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '重装失败\n'
else
printf 'Re-install failed\n'
fi
Home; break
fi
break
;;
0)Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次吧\n' "$C_LG" "$reinstall_menu1" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, try again?\n' "$C_LG" "$reinstall_menu1" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
fi
}
Uninstall_Confirmation() {
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '我不会卖萌装哭的,但是在上路前再问一句,你确定要卸载我吗?\n'
printf ' %by%b = %b确定%b\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
printf ' %bn%b = %b不卸载%b\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
else
printf 'Are you sure you want to uninstall me?\n'
printf ' %by%b = %bYES%b\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
printf ' %bn%b = %bNO%b\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
fi
printf '___________________________________________________________________'
err="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease Enter\n'
fi
read -r "uninstall_menu"
case "$uninstall_menu" in
y|Y)
Uninstall
if [ "$SC_UNINSTALL" -eq "0" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '已经成功卸载,感谢你的使用\n'
else
printf 'Uninstalled successfully\n'
fi
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '已经卸载,但可能有文件或目录被系统占用没有被删除\n'
else
printf 'USB Accelerator has been uninstalled,\nbut some files or directory may cannot be removed.\n'
fi
fi
exit "$SC_GLOBAL"
break
;;
n|N)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '宝宝吓屎了,但是宝宝不说\n'
else
printf 'Are you kidding me? don%st scare me again!\n' "'"
fi
if [ -z "$UNINSTALL_RETURN" ] || [ "$UNINSTALL_RETURN" = "2" ]; then
Home; break
else
Splash_Page_4; break
fi
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 不正确,请再试一次,超过三次错误将返回\n' "$C_LG" "$uninstall_menu" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, please try again.\nErrors entered more than three times will be returned\n' "$C_LG" "$uninstall_menu" "$C_RS"
fi
err="$((err + 1))" && if [ "$err" -gt "3" ]; then if [ -z "$UNINSTALL_RETURN" ] || [ "$UNINSTALL_RETURN" = "2" ]; then Home; break; else Splash_Page_4; break; fi; fi
;;
esac
done
}
Update_Options_UI() {
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b下载和更新%b\n' "$C_Y" "$C_RS"
printf '\n %b1%b = 设置下载来源\n' "$C_LG" "$C_RS"
printf ' %b2%b = 立即手动更新\n' "$C_LG" "$C_RS"
if [ "$(awk -F'"' '/^AUTO_UPDATE=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
printf ' %b3%b = 开启自动更新\n' "$C_LG" "$C_RS"
printf ' %b4 = 关闭自动更新%b\n' "$C_LB" "$C_RS"
else
printf ' %b3 = 开启自动更新%b\n' "$C_LB" "$C_RS"
printf ' %b4%b = 关闭自动更新\n' "$C_LG" "$C_RS"
fi
if [ ! -f "$UA_DIR/usbaccelerator.sh" ] || [ ! -f "$UA_DIR/usbstatus.png" ]; then
printf ' %b5%b = 下载缺失的文件\n' "$C_LG" "$C_RS"
fi
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bDownload and Update%b\n' "$C_Y" "$C_RS"
printf '\n %b1%b = Set Download Source\n' "$C_LG" "$C_RS"
printf ' %b2%b = Update Now\n' "$C_LG" "$C_RS"
if [ "$(awk -F'"' '/^AUTO_UPDATE=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
printf ' %b3%b = Enable Auto-update\n' "$C_LG" "$C_RS"
printf ' %b4 = Disable Auto-update%b\n' "$C_LB" "$C_RS"
else
printf ' %b3 = Enable Auto-update%b\n' "$C_LB" "$C_RS"
printf ' %b4%b = Disable Auto-update\n' "$C_LG" "$C_RS"
fi
if [ ! -f "$UA_DIR/usbaccelerator.sh" ] || [ ! -f "$UA_DIR/usbstatus.png" ]; then
printf ' %b5%b = Download Missing File(s)\n' "$C_LG" "$C_RS"
fi
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入\n'
else
printf '\nPlease enter\n'
fi
read -r "up_opts_menu"
case "$up_opts_menu" in
1)Set_Source_UI; Update_Options_UI; break
;;
2)Update_UI; Update_Options_UI; break
;;
3)
if [ "$(awk -F'"' '/^AUTO_UPDATE=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
Enable_Auto_Update
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '设置好了\n'
else
printf 'Setup is complete\n'
fi
if [ "$(awk -F'"' '/^AUTO_UPDATE_BY_USER=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" != "1" ]; then
sed -i '/AUTO_UPDATE_BY_USER/d' "$UA_DIR/CONFIG" 2>/dev/null
echo '' >> "$UA_DIR/CONFIG"
echo 'AUTO_UPDATE_BY_USER="1"' >> "$UA_DIR/CONFIG"
sed -i '/^$/d' "$UA_DIR/CONFIG"
chmod 644 "$UA_DIR/CONFIG"
fi
Update_Options_UI; break
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '自动更新已经开启,无须操作\n'
else
printf 'Auto-update is enabled\n'
fi
fi
;;
4)
if [ "$(awk -F'"' '/^AUTO_UPDATE=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" = "1" ]; then
Disable_Auto_Update
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '设置好了\n'
else
printf 'Setup is complete\n'
fi
Update_Options_UI; break
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '尚未开启自动更新,无须操作\n'
else
printf 'Auto-update is not been enabled\n'
fi
fi
;;
5)
if [ ! -f "$UA_DIR/usbaccelerator.sh" ] || [ ! -f "$UA_DIR/usbstatus.png" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '正在准备为你下载文件,请稍等...\n'
else
printf 'Please wait while the download is starting...\n'
fi
Check_Files
if [ "$SC_CKFILES" -gt "1" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b注意%b:USB加速器已卸载却无法重装,退出后请手动重新下载\n' "$C_LR" "$C_RS"
else
printf '%bWARNING%b: Files are missing, please reinstall manually\n' "$C_LR" "$C_RS"
fi
break
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '下载完成\n'
else
printf 'Download completed\n'
fi
fi
else
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '无效操作\n'
else
printf 'Invalid\n'
fi
fi
;;
0)Home; break
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n你输入的 "%b%b%b" 好像不正确嘛,再试一次哦\n' "$C_LG" "$up_opts_menu" "$C_RS"
else
printf '\n"%b%b%b" is incorrect, please try again.\n' "$C_LG" "$up_opts_menu" "$C_RS"
fi
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
}
Set_Source_UI() {
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b你想从哪里下载我的躯体?%b\n' "$C_Y" "$C_RS"
if [ -n "$(awk -F'"' '/^CFG_SRC=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" ]; then
printf '当前下载来源是: %b\n\n' "$(awk -F'"' '/^CFG_SRC=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)"
fi
printf ' %b1%b = 从章鱼喵 %bGitHub%b 那里\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
printf ' %b2%b = 从貉狸汪 %bGitLab%b 那里\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
if [ "$NO_RETURN_SETSRC" != "1" ]; then
printf ' %b0%b = 返回\n' "$C_LG" "$C_RS"
fi
setsrc_finish="设置好啦"
setsrc_error_1="你输入的"
setsrc_error_2="好像不正确嘛,再试一次哦"
else
printf '%bWhere do you want to download me?%b\n' "$C_Y" "$C_RS"
if [ -n "$(awk -F'"' '/^CFG_SRC=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)" ]; then
printf 'Download Source now is: %b\n' "$(awk -F'"' '/^CFG_SRC=/ {print $2}' $UA_DIR/CONFIG 2>/dev/null)"
fi
printf ' %b1%b = from %bGitHub%b\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
printf ' %b2%b = from %bGitLab%b\n' "$C_LG" "$C_RS" "$C_LW" "$C_RS"
if [ "$NO_RETURN_SETSRC" != "1" ]; then
printf ' %b0%b = Return to Control Panel\n' "$C_LG" "$C_RS"
fi
setsrc_finish="Set it up!"
setsrc_error_1="Sorry, I can not understand the"
setsrc_error_2="you entered,\ndo you want to try again?"
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '\n请输入吧!\n'
else
printf '\nPlease enter\n'
fi
read -r "setsrc_ui_menu"
case "$setsrc_ui_menu" in
1)Source_GitHub; NO_RETURN_SETSRC="0"; printf '%b\n' "$setsrc_finish"; break
;;
2)Source_GitLab; NO_RETURN_SETSRC="0"; printf '%b\n' "$setsrc_finish"; break
;;
0)
if [ "$NO_RETURN_SETSRC" != "1" ]; then
NO_RETURN_SETSRC="0"; Home; break
else
printf '\n%b "%b%b%b" %b\n' "$setsrc_error_1" "$C_LG" "$setsrc_ui_menu" "$C_RS" "$setsrc_error_2"
fi
;;
e|E)exit "$SC_GLOBAL"; break
;;
*)
printf '\n%b "%b%b%b" %b\n' "$setsrc_error_1" "$C_LG" "$setsrc_ui_menu" "$C_RS" "$setsrc_error_2"
egg="$((egg + 1))" && if [ "$egg" -gt "3" ]; then I_LOVE_YOU; break; fi
;;
esac
done
}
Update_UI() {
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '正在检查更新,若有更新将下载,请稍等...\n'
else
printf 'Checking and updates, please wait...\n'
fi
TRIG_UPD_BY_USER="1"
Update
if [ "$SC_UPDATE" -eq "0" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '检查完成,尚无可用更新\n'
printf '\n %b回车键%b = 返回\n' "$C_LG" "$C_RS"
else
printf 'No updates available yet, please check back later.\n'
printf '\n %bPress Enter key%b = Return to Previous Page\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________\n'
read -r "upd_menu0"
case "$upd_menu0" in
*)
TRIG_UPD_BY_USER="0"
;;
esac
fi
if [ "$SC_UPDATE" -eq "1" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b更新成功%b,已经由v%b更新至v%b\n' "$C_LC" "$C_RS" "$VERSION" "$NEW_VERSION"
printf '\n %b回车键%b = 载入新版\n' "$C_LG" "$C_RS"
else
printf '%bSuccessfully updated%b, from v%b to v%b\n' "$C_LC" "$C_RS" "$VERSION" "$NEW_VERSION"
printf '\n %bPress Enter key%b = Refresh to New Version\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________\n'
read -r "upd_menu1"
case "$upd_menu1" in
*)
sh "$UA_DIR/usbaccelerator.sh"; exit "$?"
;;
esac
fi
if [ "$SC_UPDATE" -eq "2" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b更新错误%b,请检查网络连接和路由器时间设置\n' "$C_LR" "$C_RS"
printf '\n %b回车键%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bUpdate failed%b, Please check network connection and router time.\n' "$C_LR" "$C_RS"
printf '\n %bPress Enter key%b = Return to Previous Page\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________\n'
read -r "upd_menu2"
case "$upd_menu2" in
*)
TRIG_UPD_BY_USER="0"
;;
esac
fi
if [ "$SC_UPDATE" -eq "3" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b更新错误%b,下载失败\n' "$C_LR" "$C_RS"
printf '\n %b回车键%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bUpdate failed%b, File cannot be downloaded\n' "$C_LR" "$C_RS"
printf '\n %bPress Enter key%b = Return to Previous Page\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________\n'
read -r "upd_menu3"
case "$upd_menu3" in
*)
TRIG_UPD_BY_USER="0"
;;
esac
fi
if [ "$SC_UPDATE" -eq "4" ]; then
Check_Files
if [ "$SC_CKFILES" -gt "1" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b文件丢失%b,请重新安装USB加速器\n' "$C_LR" "$C_RS"
printf '\n %b回车键%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bFile is missing%b, please return to the previous page\nto download missing file(s)\n' "$C_LR" "$C_RS"
printf '\n %bPress Enter key%b = Return to Previous Page\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________\n'
read -r "upd_menu4"
case "$upd_menu4" in
*)
TRIG_UPD_BY_USER="0"
;;
esac
else
SC_UPDATE=""
fi
fi
if [ -z "$SC_UPDATE" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b未知错误%b,暂时无法更新\n' "$C_LR" "$C_RS"
printf '\n %b回车键%b = 返回\n' "$C_LG" "$C_RS"
else
printf '%bUnknown error%b, please try again later\n' "$C_LR" "$C_RS"
printf '\n %bPress Enter key%b = Return to Previous Page\n' "$C_LG" "$C_RS"
fi
printf '___________________________________________________________________\n'
read -r "upd_menu5"
case "$upd_menu5" in
*)
TRIG_UPD_BY_USER="0"
;;
esac
fi
}
Download_Files_UI() {
if [ -n "$SC_NETWORK" ] && [ "$SC_NETWORK" -gt "0" ]; then
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '下载失败,请检查网络连接和路由器时间设置\n'
else
printf 'Download failed. Please check network connection and router time.\n'
fi
fi
if [ -n "$SC_DOWNLOAD" ] && [ "$SC_DOWNLOAD" -gt "0" ]; then
printf '___________________________________________________________________\n'
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then
printf '%b下载文件好像失败了呀,要不要再试一次呢?%b\n' "$C_Y" "$C_RS"
if [ "$SC_DOWNLOAD" -gt "99" ]; then
printf '你的固件不支持从GitLab下载,请切换到GitHub\n'
fi
printf ' %b1%b = 再试一次\n' "$C_LG" "$C_RS"
printf ' %b2%b = 切换安装来源再下载\n' "$C_LG" "$C_RS"
if [ "$DLUI_NOTRY" = "1" ]; then
printf ' %b0%b = 不试了\n' "$C_LG" "$C_RS"
fi
else
printf 'Uhhh...looks like the download failed.\n%bDo you want to try again?%b\n' "$C_Y" "$C_RS"
if [ "$SC_DOWNLOAD" -gt "99" ]; then
printf 'Your firmware cannot be downloaded from GitLab, please use GitHub\n'
fi
printf ' %b1%b = Try again\n' "$C_LG" "$C_RS"
printf ' %b2%b = Change Source and Download\n' "$C_LG" "$C_RS"
if [ "$DLUI_NOTRY" = "1" ]; then
printf ' %b0%b = No\n' "$C_LG" "$C_RS"
fi
fi
printf '___________________________________________________________________'
egg="0"
while true; do
if [ "$LANG" = "CN" ] || [ "$LANG" = "TW" ]; then