-
Notifications
You must be signed in to change notification settings - Fork 2
/
kiss.sh
2980 lines (2825 loc) · 89.5 KB
/
kiss.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/bash
#author kissyouhunter
declare flag=0
clear
while [ "$flag" -eq 0 ]
do
# 青龙变量
QL_DOCKER_IMG_NAME="whyour/qinglong"
TAG="latest"
QL_PATH=""
QL_SHELL_FOLDER=$(pwd)/ql
N1_QL_FOLDER=/mnt/mmcblk2p4/ql
QL_CONTAINER_NAME=""
NETWORK="bridge"
QL_PORT="5700"
# elev2p变量
V2P_DOCKER_IMG_NAME="elecv2/elecv2p"
V2P_PATH=""
V2P_SHELL_FOLDER=$(pwd)/elecv2p
N1_V2P_FOLDER=/mnt/mmcblk2p4/elecv2p
V2P_CONTAINER_NAME=""
V2P_PORT="8100"
V2P_PORT1="8101"
V2P_PORT2="8102"
# emby变量
EMBY_DOCKER_IMG_NAME="xinjiawei1/emby_unlockd"
EMBY_TAG="latest"
EMBY_PATH=""
EMBY_CONFIG_FOLDER=$(pwd)/emby
EMBY_MOVIES_FOLDER=$(pwd)/movies
EMBY_TVSHOWS_FOLDER=$(pwd)/tvshows
EMBY_CONTAINER_NAME=""
EMBY_PORT="8096"
EMBY_PORT1="8920"
# jellyfin变量
JELLYFIN_DOCKER_IMG_NAME="jellyfin/jellyfin"
JELLYFIN_PATH=""
JELLYFIN_CONFIG_FOLDER=$(pwd)/jellyfin
JELLYFIN_MOVIES_FOLDER=$(pwd)/movies
JELLYFIN_TVSHOWS_FOLDER=$(pwd)/tvshows
JELLYFIN_CONTAINER_NAME=""
JELLYFIN_PORT="8096"
JELLYFIN_PORT1="8920"
# qbittorrent变量
QB_DOCKER_IMG_NAME="johngong/qbittorrent"
QB_TAG="qee-latest"
QB_PATH=""
QB_CONFIG_FOLDER=$(pwd)/qbittorrent
QB_DOWNLOADS_FOLDER=$(pwd)/downloads
QB_CONTAINER_NAME=""
# aria2变量
ARIA2_DOCKER_IMG_NAME="superng6/aria2"
ARIA2_TAG="webui-latest"
ARIA2_PATH=""
ARIA2_CONFIG_FOLDER=$(pwd)/aria2
ARIA2_DOWNLOADS_FOLDER=$(pwd)/downloads
ARIA2_CONTAINER_NAME=""
TOKEN="aria2"
# aria2-pro变量
ARIA2_PRO_DOCKER_IMG_NAME="p3terx/aria2-pro"
ARIA2_PRO_WEBUI_DOCKER_IMG_NAME="p3terx/ariang"
ARIA2_PRO_PATH=""
ARIA2_PRO_CONFIG_FOLDER=$(pwd)/aria2-pro
ARIA2_PRO_DOWNLOADS_FOLDER=$(pwd)/downloads
ARIA2_PRO_CONTAINER_NAME=""
# telethon变量
TG_DOCKER_IMG_NAME="kissyouhunter/telethon"
TAG="latest"
TG_PATH=""
TG_SHELL_FOLDER=$(pwd)/telethon
N1_TG_FOLDER=/mnt/mmcblk2p4/telethon
TG_CONTAINER_NAME=""
# adguardhome变量
ADG_DOCKER_IMG_NAME="adguard/adguardhome"
TAG="latest"
ADG_PATH=""
ADG_CONFIG_FOLDER=$(pwd)/adguardhome
N1_ADG_FOLDER=/mnt/mmcblk2p4/adguardhome
ADG_CONTAINER_NAME=""
# x-ui变量
XUI_DOCKER_IMG_NAME="kissyouhunter/x-ui"
TAG="latest"
DEV="dev"
XUI_PATH=""
XUI_CONFIG_FOLDER=$(pwd)/x-ui
XUI_CONTAINER_NAME=""
# aapanel变量
AAPANEL_DOCKER_IMG_NAME="aapanel/aapanel"
AAPANEL_TAG="lib"
AAPANEL_PATH=""
AAPANEL_CONFIG_FOLDER=$(pwd)/aapanel
N1_AAPANEL_FOLDER=/mnt/mmcblk2p4/aapanel
AAPANEL_CONTAINER_NAME=""
# MaiARK 变量
MAIARK_DOCKER_IMG_NAME="kissyouhunter/maiark"
MAIARK_PATH=""
MAIARK_CONFIG_FOLDER=$(pwd)/MaiARK
N1_MAIARK_FOLDER=/mnt/mmcblk2p4/MarARK
MAIARK_CONTAINER_NAME=""
MAIARK_PORT="8082"
log() {
echo -e "\n$1"
}
inp() {
echo -e "\n$1"
}
opt() {
echo -n -e "输入您的选择->"
}
cancelrun() {
if [ $# -gt 0 ]; then
echo -e " $1 "
fi
exit 1
}
TIME() {
[[ -z "$1" ]] && {
echo -ne " "
} || {
case $1 in
r) export Color="\e[31;1m";;
g) export Color="\e[32;1m";;
b) export Color="\e[34;1m";;
y) export Color="\e[33;1m";;
z) export Color="\e[35;1m";;
l) export Color="\e[36;1m";;
w) export Color="\e[29;1m";;
esac
[[ $# -lt 2 ]] && echo -e "\e[36m\e[0m ${1}" || {
echo -e "\e[36m\e[0m ${Color}${2}\e[0m"
}
}
}
TIME w "============================================"
TIME w " 欢迎使用一键脚本"
TIME w " 请按照命令提示操作"
TIME r " 请保证科学上网已经开启"
TIME w " 安装过程中可以按ctrl+c强制退出"
TIME w "============================================"
#cat << EOF
TIME w "(1) 安装docker和docker-compose"
TIME w "(2) 安装<青龙>到宿主机"
TIME w "(3) 安装<elecv2p>到宿主机"
TIME w "(4) 安装docker图形管理工具"
TIME w "(5) 安装emby或jellyfin(打造自己的爱奇艺)"
TIME w "(6) 安装下载工具"
TIME w "(7) TG定时发送信息工具"
TIME w "(8) AdGuardHome DNS解析+去广告"
TIME w "(9) x-ui"
TIME w "(10) aaPanel(宝塔国际版)"
TIME w "(11) MaiARK(对接青龙提交京东CK)"
TIME r "(0) 不想安装了,给老子退出!!!"
#EOF
read -p "Please enter your choice[0-11]: " input
case $input in
#安装docker and docker-compose
1)
clear
while [ "$flag" -eq 0 ]
do
#cat << EOF
TIME w "----------------------------------------"
TIME w "|****Please Enter Your Choice:[0-3]****|"
TIME w "|******* DOCKER & DOCKER-COMPOSE ******|"
TIME w "----------------------------------------"
TIME w "(1) 安装docker和docker-comopse"
TIME w "(2) X86 openwrt安装docker和装docker-comopse"
TIME w "(3) Arm64 openwrt安装docker和装docker-comopse(例 N1 等)"
TIME b "(0) 返回上级菜单"
#EOF
TIME l "<注>openwrt宿主机默认安装dockerman图形docker管理工具!"
read -p "Please enter your Choice[0-3]: " input1
case $input1 in
1)
TIME y " >>>>>>>>>>>开始安装docker和docker-compose"
if [ "$lsb_dist" == "openwrt" ]; then
TIME r "****openwrt宿主机请选择2或者3安装docker****"
else
sleep 1
bash <(curl -s -S -L https://raw.githubusercontent.com/kissyouhunter/Tools/main/docker-and-docker_compose.sh)
TIME g "****docker和docker-compose安装完成,请返回上级菜单!****"
sleep 5
fi
;;
2)
TIME y " >>>>>>>>>>>开始为X86 openwrt安装docker和docker-compose"
mkdir -p /tmp/upload/ && cd /tmp/upload/
curl -LO https://tt.kisssik.ga/d/aliyun/files/docker-2010.12-1_x86_64.zip
unzip docker-2010.12-1_x86_64.zip && rm -f docker-2010.12-1_x86_64.zip
cd /tmp/upload/docker-2010.12-1_x86_64 && opkg install *.ipk && cd .. && rm -rf docker-2010.12-1_x86_64/
docker -v && docker-compose -v
TIME g "****docker安装完成,请返回上级菜单!****"
sleep 5
;;
3)
TIME y " >>>>>>>>>>>开始为Arm64 openwrt安装docker和docker-compose"
mkdir -p /tmp/upload/ && cd /tmp/upload/
curl -LO https://tt.kisssik.ga/d/aliyun/files/docker-20.10.15-1_aarch64.zip
unzip docker-20.10.15-1_aarch64.zip && rm -f docker-20.10.15-1_aarch64.zip
cd /tmp/upload/docker-20.10.15-1_aarch64 && opkg install *.ipk
cd /tmp/upload && rm -rf docker-20.10.15-1_aarch64/
docker -v && docker-compose -v
TIME g "****docker安装完成,请返回上级菜单!****"
TIME g "****U盘上运行的OP,如果docker空间没有指定到 /mnt/sda4/docker ,请修改****"
TIME g "****dockerman > 设置 > Docker 根目录 修改为 /mnt/sda4/docker ****"
sleep 5
;;
0)
clear
break
;;
*) TIME r "----------------------------------"
TIME r "| Warning!!! |"
TIME r "| 请输入正确的选项! |"
TIME r "----------------------------------"
for i in $(seq -w 1 -1 1)
do
#TIME r "\b\b$i";
sleep 1;
done
clear
;;
esac
done
;;
#安装青龙
2)
clear
while [ "$flag" -eq 0 ]
do
#cat << EOF
TIME w "----------------------------------------"
TIME w "|****Please Enter Your Choice:[0-2]****|"
TIME w "|**************** 青龙 ****************|"
TIME w "----------------------------------------"
TIME w "(1) linxu系统、X86的openwrt、群辉等请选择 1"
TIME w "(2) N1的EMMC上运行的openwrt请选择 2"
TIME b "(0) 返回上级菜单"
#EOF
TIME r "<注>选择1或2后,如果不明白如何选择或输入,请狂按回车!"
read -p "Please enter your choice[0-3]: " input2
case $input2 in
1)
TIME y " >>>>>>>>>>>开始安装青龙"
input_container_ql1_info() {
log "列出所有宿主机上的容器"
docker ps -a
TIME g "-----------------------------------------------------"
TIME g "| 青龙启动需要一点点时间,请耐心等待! |"
sleep 10
TIME g "| 安装完成,自动退出脚本 |"
if [ "$NETWORK" = "host" ]; then
TIME g "| 访问方式为 宿主机ip:5700 |"
elif [ "$NETWORK" = "bridge" ]; then
TIME g "| 访问方式为 宿主机ip:$QL_PORT |"
fi
TIME g "-----------------------------------------------------"
exit 0
}
# 确认
input_container_ql1_check() {
while true
do
TIME y "青龙配置文件路径:$QL_PATH"
TIME y "青龙容器名:$QL_CONTAINER_NAME"
TIME y "青龙网络类型:$NETWORK"
TIME y "青龙版本:$TAG"
if [ "$NETWORK" = "host" ]; then
TIME y "青龙面板端口:5700"
elif [ "$NETWORK" = "bridge" ]; then
TIME y "青龙网络请求查看端口:$QL_PORT"
fi
read -r -p "以上信息是否正确?[Y/n] " input21
case $input21 in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
TIME w "即将返回上一步"
sleep 1
QL_PORT="5700"
TAG="latest"
input_container_ql1_version
input_container_ql1_judge
input_container_ql1_info
;;
*)
TIME r "输入错误,请输入[Y/n]"
;;
esac
done
}
# 版本号
input_container_ql1_version() {
TIME w "青龙自2.12.0开始改变了目录结构,本脚本开始提供不同青龙版本。"
TIME w "请根据提示驶入对应内容。"
TIME w "目前提供的版本有如下:"
TIME w "2.10、2.10.6、2.10.7、2.10.8、2.10.9、2.10.10、2.10.11、2.10.12、2.10.13"
TIME w "2.11.0、2.11.1、2.11.2.2.11.3"
TIME w "2.12.0、2.12.1、2.12.2"
TIME w "2.13.0、2.13.1、2.13.2和最新"
echo -n -e "请输入版本号(回车默认为最新版本): "
read ql_version
if [ -z "$ql_version" ]; then
QL_VERSION=$TAG
elif [ -n "$ql_version" ]; then
QL_VERSION=$ql_version
fi
TAG=$QL_VERSION
}
input_container_ql1_version
# 创建映射文件夹
input_container_ql1_config1() {
echo -n -e "请输入青龙配置文件保存的绝对路径(示例:/home/ql),回车默认为当前目录: "
read ql_path
if [ -z "$ql_path" ]; then
QL_PATH=$QL_SHELL_FOLDER
elif [ -d "$ql_path" ]; then
QL_PATH=$ql_path
else
#mkdir -p $ql_path
QL_PATH=$ql_path
fi
CONFIG_PATH=$QL_PATH
}
# 创建映射文件夹
input_container_ql1_config2() {
echo -n -e "请输入青龙配置文件保存的绝对路径(示例:/home/ql),回车默认为当前目录: "
read ql_path
if [ -z "$ql_path" ]; then
QL_PATH=$QL_SHELL_FOLDER
elif [ -d "$ql_path" ]; then
QL_PATH=$ql_path
else
#mkdir -p $ql_path
QL_PATH=$ql_path
fi
CONFIG_PATH=$QL_PATH/config
DB_PATH=$QL_PATH/db
REPO_PATH=$QL_PATH/repo
SCRIPT_PATH=$QL_PATH/scripts
LOG_PATH=$QL_PATH/log
DEPS_PATH=$QL_PATH/deps
}
# 输入容器名
input_container_ql1_name() {
echo -n -e "请输入将要创建的容器名[默认为:ql]-> "
read container_name
if [ -z "$container_name" ]; then
QL_CONTAINER_NAME="ql"
else
QL_CONTAINER_NAME=$container_name
fi
}
# 网络模式
input_container_ql1_network_config() {
inp "请选择容器的网络类型:\n1) host\n2) bridge[默认]"
opt
read net
if [ "$net" = "1" ]; then
NETWORK="host"
MAPPING_QL_PORT=""
fi
if [ "$NETWORK" = "bridge" ]; then
inp "是否修改青龙端口[默认 5700]:\n1) 修改\n2) 不修改[默认]"
opt
read change_ql_port
if [ "$change_ql_port" = "1" ]; then
echo -n -e "输入想修改的端口->"
read QL_PORT
else
QL_PORT="5700"
fi
fi
}
input_container_ql1_build1() {
TIME y " >>>>>>>>>>>配置完成,开始安装青龙"
log "1.开始创建配置文件目录"
PATH_LIST=($CONFIG_PATH)
for i in ${PATH_LIST[@]}; do
mkdir -p $i
done
log "2.开始创建容器并执行"
docker run -dit \
-t \
-v $CONFIG_PATH:/ql/data \
-e ENABLE_HANGUP=false \
-e ENABLE_WEB_PANEL=true \
-p $QL_PORT:5700 \
--name $QL_CONTAINER_NAME \
--hostname $QL_CONTAINER_NAME \
--restart always \
--network $NETWORK \
$QL_DOCKER_IMG_NAME:$TAG
if [ $? -ne 0 ] ; then
cancelrun "** 错误:容器创建失败,请翻译以上英文报错,Google/百度尝试解决问题!"
fi
}
input_container_ql1_build2() {
TIME y " >>>>>>>>>>>配置完成,开始安装青龙"
log "1.开始创建配置文件目录"
PATH_LIST=($CONFIG_PATH $DB_PATH $REPO_PATH $SCRIPT_PATH $LOG_PATH $DEPS_PATH)
for i in ${PATH_LIST[@]}; do
mkdir -p $i
done
log "2.开始创建容器并执行"
docker run -dit \
-t \
-v $CONFIG_PATH:/ql/config \
-v $DB_PATH:/ql/db \
-v $LOG_PATH:/ql/log \
-v $REPO_PATH:/ql/repo \
-v $SCRIPT_PATH:/ql/scripts \
-v $DEPS_PATH:/ql/deps \
-e ENABLE_HANGUP=false \
-e ENABLE_WEB_PANEL=true \
-p $QL_PORT:5700 \
--name $QL_CONTAINER_NAME \
--hostname $QL_CONTAINER_NAME \
--restart always \
--network $NETWORK \
$QL_DOCKER_IMG_NAME:$TAG
if [ $? -ne 0 ] ; then
cancelrun "** 错误:容器创建失败,请翻译以上英文报错,Google/百度尝试解决问题!"
fi
}
input_container_ql1_judge() {
if [ $TAG == latest ] || [ $TAG == "2.12" ] || [ $TAG == "2.12.0" ] || [ $TAG == "2.12.1" ] || [ $TAG == "2.12.2" ] || [ $TAG == "2.13" ] || [ $TAG == "2.13.0" ] || [ $TAG == "2.13.1" ]; then
input_container_ql1_config1
input_container_ql1_name
input_container_ql1_network_config
input_container_ql1_check
input_container_ql1_build1
else
input_container_ql1_config2
input_container_ql1_name
input_container_ql1_network_config
input_container_ql1_check
input_container_ql1_build2
fi
}
input_container_ql1_judge
log "列出所有宿主机上的容器"
docker ps -a
TIME g "-----------------------------------------------------"
TIME g "| 青龙启动需要一点点时间,请耐心等待! |"
sleep 10
TIME g "| 安装完成,自动退出脚本 |"
if [ "$NETWORK" = "host" ]; then
TIME g "| 访问方式为 宿主机ip:5700 |"
elif [ "$NETWORK" = "bridge" ]; then
TIME g "| 访问方式为 宿主机ip:$QL_PORT |"
fi
TIME g "-----------------------------------------------------"
exit 0
;;
2)
TIME y " >>>>>>>>>>>开始安装青龙到N1的/mnt/mmcblk2p4/"
input_container_ql2_info() {
log "列出所有宿主机上的容器"
docker ps -a
TIME g "-----------------------------------------------------"
TIME g "| 青龙启动需要一点点时间,请耐心等待! |"
sleep 10
TIME g "| 安装完成,自动退出脚本 |"
if [ "$NETWORK" = "host" ]; then
TIME g "| 访问方式为 宿主机ip:5700 |"
elif [ "$NETWORK" = "bridge" ]; then
TIME g "| 访问方式为 宿主机ip:$QL_PORT |"
fi
TIME g "-----------------------------------------------------"
exit 0
}
# 确认
input_container_ql2_check() {
while true
do
TIME y "青龙配置文件路径:$QL_PATH"
TIME y "青龙容器名:$QL_CONTAINER_NAME"
TIME y "青龙网络类型:$NETWORK"
TIME y "青龙版本:$TAG"
if [ "$NETWORK" = "host" ]; then
TIME y "青龙面板端口:5700"
elif [ "$NETWORK" = "bridge" ]; then
TIME y "青龙网络请求查看端口:$QL_PORT"
fi
read -r -p "以上信息是否正确?[Y/n] " input21
case $input21 in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
TIME w "即将返回上一步"
sleep 1
QL_PORT="5700"
TAG="latest"
input_container_ql2_version
input_container_ql2_judge
input_container_ql2_info
;;
*)
TIME r "输入错误,请输入[Y/n]"
;;
esac
done
}
# 版本号
input_container_ql2_version() {
TIME w "青龙自2.12.0开始改变了目录结构,本脚本开始提供不同青龙版本。"
TIME w "请根据提示驶入对应内容。"
TIME w "目前提供的版本有如下:"
TIME w "2.10、2.10.6、2.10.7、2.10.8、2.10.9、2.10.10、2.10.11、2.10.12、2.10.13"
TIME w "2.11.0、2.11.1、2.11.2.2.11.3"
TIME w "2.12.0、2.12.1、2.12.2"
TIME w "2.13.0、2.13.1、2.13.2和最新"
echo -n -e "请输入版本号(回车默认为最新版本): "
read ql_version
if [ -z "$ql_version" ]; then
QL_VERSION=$TAG
elif [ -n "$ql_version" ]; then
QL_VERSION=$ql_version
fi
TAG=$QL_VERSION
}
input_container_ql2_version
# 创建映射文件夹
input_container_ql2_config1() {
echo -n -e "请输入青龙存储的文件夹名称(如:ql),回车默认为 ql: "
read ql_path
if [ -z "$ql_path" ]; then
QL_PATH=$N1_QL_FOLDER
elif [ -d "$ql_path" ]; then
QL_PATH=/mnt/mmcblk2p4/$ql_path
else
#mkdir -p /mnt/mmcblk2p4/$ql_path
QL_PATH=/mnt/mmcblk2p4/$ql_path
fi
CONFIG_PATH=$QL_PATH
}
# 创建映射文件夹
input_container_ql2_config2() {
echo -n -e "请输入青龙存储的文件夹名称(如:ql),回车默认为 ql: "
read ql_path
if [ -z "$ql_path" ]; then
QL_PATH=$N1_QL_FOLDER
elif [ -d "$ql_path" ]; then
QL_PATH=/mnt/mmcblk2p4/$ql_path
else
#mkdir -p /mnt/mmcblk2p4/$ql_path
QL_PATH=/mnt/mmcblk2p4/$ql_path
fi
CONFIG_PATH=$QL_PATH/config
DB_PATH=$QL_PATH/db
REPO_PATH=$QL_PATH/repo
SCRIPT_PATH=$QL_PATH/scripts
LOG_PATH=$QL_PATH/log
DEPS_PATH=$QL_PATH/deps
}
# 输入容器名
input_container_ql2_name() {
echo -n -e "请输入将要创建的容器名[默认为:ql]-> "
read container_name
if [ -z "$container_name" ]; then
QL_CONTAINER_NAME="ql"
else
QL_CONTAINER_NAME=$container_name
fi
}
# 网络模式
input_container_ql2_network_config() {
inp "请选择容器的网络类型:\n1) host\n2) bridge[默认]"
opt
read net
if [ "$net" = "1" ]; then
NETWORK="host"
MAPPING_QL_PORT=""
fi
if [ "$NETWORK" = "bridge" ]; then
inp "是否修改青龙端口[默认 5700]:\n1) 修改\n2) 不修改[默认]"
opt
read change_ql_port
if [ "$change_ql_port" = "1" ]; then
echo -n -e "输入想修改的端口->"
read QL_PORT
else
QL_PORT="5700"
fi
fi
}
input_container_ql2_build1() {
TIME y " >>>>>>>>>>>配置完成,开始安装青龙"
log "1.开始创建配置文件目录"
PATH_LIST=($CONFIG_PATH $DB_PATH $REPO_PATH $SCRIPT_PATH $LOG_PATH $DEPS_PATH)
for i in ${PATH_LIST[@]}; do
mkdir -p $i
done
log "3.开始创建容器并执行"
docker run -dit \
-t \
-v $CONFIG_PATH:/ql/data \
-e ENABLE_HANGUP=false \
-e ENABLE_WEB_PANEL=true \
-p $QL_PORT:5700 \
--name $QL_CONTAINER_NAME \
--hostname $QL_CONTAINER_NAME \
--restart always \
--network $NETWORK \
$QL_DOCKER_IMG_NAME:$TAG
if [ $? -ne 0 ] ; then
cancelrun "** 错误:容器创建失败,请翻译以上英文报错,Google/百度尝试解决问题!"
fi
}
input_container_ql2_build2() {
TIME y " >>>>>>>>>>>配置完成,开始安装青龙"
log "1.开始创建配置文件目录"
PATH_LIST=($CONFIG_PATH $DB_PATH $REPO_PATH $SCRIPT_PATH $LOG_PATH $DEPS_PATH)
for i in ${PATH_LIST[@]}; do
mkdir -p $i
done
log "3.开始创建容器并执行"
docker run -dit \
-t \
-v $CONFIG_PATH:/ql/config \
-v $DB_PATH:/ql/db \
-v $LOG_PATH:/ql/log \
-v $REPO_PATH:/ql/repo \
-v $SCRIPT_PATH:/ql/scripts \
-v $DEPS_PATH:/ql/deps \
-e ENABLE_HANGUP=false \
-e ENABLE_WEB_PANEL=true \
-p $QL_PORT:5700 \
--name $QL_CONTAINER_NAME \
--hostname $QL_CONTAINER_NAME \
--restart always \
--network $NETWORK \
$QL_DOCKER_IMG_NAME:$TAG
if [ $? -ne 0 ] ; then
cancelrun "** 错误:容器创建失败,请翻译以上英文报错,Google/百度尝试解决问题!"
fi
}
input_container_ql2_judge() {
if [ $TAG == latest ]; then
input_container_ql2_config1
input_container_ql2_name
input_container_ql2_network_config
input_container_ql2_check
input_container_ql2_build1
else
input_container_ql2_config2
input_container_ql2_name
input_container_ql2_network_config
input_container_ql2_check
input_container_ql2_build2
fi
}
input_container_ql2_judge
log "列出所有宿主机上的容器"
docker ps -a
TIME g "-----------------------------------------------------"
TIME g "| 青龙启动需要一点点时间,请耐心等待! |"
sleep 10
TIME g "| 安装完成,自动退出脚本 |"
if [ "$NETWORK" = "host" ]; then
TIME g "| 访问方式为 宿主机ip:5700 |"
elif [ "$NETWORK" = "bridge" ]; then
TIME g "| 访问方式为 宿主机ip:$QL_PORT |"
fi
TIME g "-----------------------------------------------------"
exit 0
;;
0)
clear
break
;;
*) TIME r "----------------------------------"
TIME r "| Warning!!! |"
TIME r "| 请输入正确的选项! |"
TIME r "----------------------------------"
for i in $(seq -w 1 -1 1)
do
#TIME r "\b\b$i";
sleep 1;
done
clear
;;
esac
done
;;
#安装elecv2p
3)
clear
while [ "$flag" -eq 0 ]
do
#cat << EOF
TIME w "----------------------------------------"
TIME w "|****Please Enter Your Choice:[0-2]****|"
TIME w "|*************** ELECV2P **************|"
TIME w "----------------------------------------"
TIME w "(1) linxu系统、X86的openwrt、群辉等请选择 1"
TIME w "(2) N1的EMMC上运行的openwrt请选择 2"
TIME b "(0) 返回上级菜单"
#EOF
TIME r "<注>选择1或2后,如果不明白如何选择或输入,请狂按回车!"
read -p "Please enter your Choice[0-2]: " input3
case $input3 in
1)
TIME y " >>>>>>>>>>>开始安装elecv2p"
# 创建映射文件夹
input_container_v2p1_config() {
echo -n -e "请输入elecv2p配置文件保存的绝对路径(示例:/home/elecv2p),回车默认为当前目录: "
read v2p_path
if [ -z "$v2p_path" ]; then
V2P_PATH=$V2P_SHELL_FOLDER
elif [ -d "$v2p_path" ]; then
V2P_PATH=$v2p_path
else
#mkdir -p $v2p_path
V2P_PATH=$v2p_path
fi
JSFILE_PATH=$V2P_PATH/JSFile
LISTS_PATH=$V2P_PATH/Lists
STORE_PATH=$V2P_PATH/Store
SHELL_PATH=$V2P_PATH/Shell
ROOTCA_PATH=$V2P_PATH/rootCA
EFSS_PATH=$V2P_PATH/efss
LOG_PATH=$V2P_PATH/logs
}
input_container_v2p1_config
# 输入容器名
input_container_v2p1_name() {
echo -n -e "请输入将要创建的容器名[默认为:elecv2p]-> "
read container_name
if [ -z "$container_name" ]; then
V2P_CONTAINER_NAME="elecv2p"
else
V2P_CONTAINER_NAME=$container_name
fi
}
input_container_v2p1_name
# 面板端口
input_container_v2p1_webui_config() {
inp "是否修改elecv2p面板端口[默认 8100]:\n1) 修改\n2) 不修改[默认]"
opt
read change_v2p_port
if [ "$change_v2p_port" = "1" ]; then
echo -n -e "输入想修改的端口->"
read V2P_PORT
fi
}
input_container_v2p1_webui_config
# ANYPROXY端口
input_container_v2p1_anyproxy_config() {
inp "是否修改elecv2p的anyproxy端口[默认 8101]:\n1) 修改\n2) 不修改[默认]"
opt
read change_v2p_port1
if [ "$change_v2p_port1" = "1" ]; then
echo -n -e "输入想修改的端口->"
read V2P_PORT1
fi
}
input_container_v2p1_anyproxy_config
# 网络请求查看端口
input_container_v2p1_http_config() {
inp "是否修改elecv2p网络请求查看端口[默认 8102]:\n1) 修改\n2) 不修改[默认]"
opt
read change_v2p_port2
if [ "$change_v2p_port2" = "1" ]; then
echo -n -e "输入想修改的端口->"
read V2P_PORT2
fi
}
input_container_v2p1_http_config
# 确认
while true
do
TIME y "elecv2p 配置文件路径:$V2P_PATH"
TIME y "elecv2p 容器名:$V2P_CONTAINER_NAME"
TIME y "elecv2p 面板端口:$V2P_PORT"
TIME y "elecv2p anyproxy端口:$V2P_PORT1"
TIME y "elecv2p 网络请求查看端口:$V2P_PORT2"
read -r -p "以上信息是否正确?[Y/n] " input32
case $input32 in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
TIME w "即将返回上一步"
sleep 1
V2P_PORT="8100"
V2P_PORT1="8101"
V2P_PORT2="8102"
input_container_v2p1_config
input_container_v2p1_name
input_container_v2p1_webui_config
input_container_v2p1_anyproxy_config
input_container_v2p1_http_config
;;
*)
TIME r "输入错误,请输入[Y/n]"
;;
esac
done
TIME y " >>>>>>>>>>>配置完成,开始安装elecv2p"
log "1.开始创建配置文件目录"
PATH_LIST=($JSFILE_PATH $LISTS_PATH $STORE_PATH $SHELL_PATH $ROOTCA_PATH $EFSS_PATH $LOG_PATH)
for i in ${PATH_LIST[@]}; do
mkdir -p $i
done
log "2.开始创建容器并执行"
docker run -dit \
-v $JSFILE_PATH:/usr/local/app/script/JSFile \
-v $LISTS_PATH:/usr/local/app/script/Lists \
-v $STORE_PATH:/usr/local/app/script/Store \
-v $SHELL_PATH:/usr/local/app/script/Shell \
-v $ROOTCA_PATH:/usr/local/app/rootCA \
-v $EFSS_PATH:/usr/local/app/efss \
-v $LOG_PATH:/usr/local/app/logs \
-p $V2P_PORT:80 -p $V2P_PORT1:8001 -p $V2P_PORT2:8002 \
-e TZ=Asia/Shanghai \
--name $V2P_CONTAINER_NAME \
--hostname $V2P_CONTAINER_NAME \
--restart always \
$V2P_DOCKER_IMG_NAME:$TAG
if [ $? -ne 0 ] ; then
cancelrun "** 错误:容器创建失败,请翻译以上英文报错,Google/百度尝试解决问题!"
fi
log "列出所有宿主机上的容器"
docker ps -a
TIME g "-----------------------------------------------------"
TIME g "| elev2p启动需要一点点时间,请耐心等待! |"
sleep 10
TIME g "| 安装完成,自动退出脚本 |"
TIME g "| 访问方式为 宿主机ip:$V2P_PORT |"
TIME g "-----------------------------------------------------"
exit 0
;;
2)
TIME y " >>>>>>>>>>>开始安装elecv2p到N1的/mnt/mmcblk2p4/"
# 创建映射文件夹
input_container_v2p2_config() {
echo -n -e "请输入elecv2p存储的文件夹名称(如:elecv2p),回车默认为 elecv2p: "
read v2p_path
if [ -z "$v2p_path" ]; then
V2P_PATH=$N1_V2P_FOLDER
elif [ -d "$v2p_path" ]; then
V2P_PATH=/mnt/mmcblk2p4/$v2p_path
else
#mkdir -p /mnt/mmcblk2p4/$v2p_path
V2P_PATH=/mnt/mmcblk2p4/$v2p_path
fi
JSFILE_PATH=$V2P_PATH/JSFile
LISTS_PATH=$V2P_PATH/Lists
STORE_PATH=$V2P_PATH/Store
SHELL_PATH=$V2P_PATH/Shell
ROOTCA_PATH=$V2P_PATH/rootCA
EFSS_PATH=$V2P_PATH/efss
LOG_PATH=$V2P_PATH/logs
}
input_container_v2p2_config
# 输入容器名
input_container_v2p2_name() {
echo -n -e "请输入将要创建的容器名[默认为:elecv2p]-> "
read container_name
if [ -z "$container_name" ]; then
V2P_CONTAINER_NAME="elecv2p"
else
V2P_CONTAINER_NAME=$container_name
fi
}
input_container_v2p2_name
# 面板端口
input_container_v2p2_webui_config() {
inp "是否修改elecv2p面板端口[默认 8100]:\n1) 修改\n2) 不修改[默认]"
opt
read change_v2p_port
if [ "$change_v2p_port" = "1" ]; then
echo -n -e "输入想修改的端口->"
read V2P_PORT
fi
}
input_container_v2p2_webui_config
# ANYPROXY端口
input_container_v2p2_anyproxy_config() {
inp "是否修改elecv2p的anyproxy端口[默认 8101]:\n1) 修改\n2) 不修改[默认]"
opt
read change_v2p_port1
if [ "$change_v2p_port1" = "1" ]; then
echo -n -e "输入想修改的端口->"
read V2P_PORT1
fi
}
input_container_v2p2_anyproxy_config
# 网络请求查看端口
input_container_v2p2_http_config() {
inp "是否修改elecv2p网络请求查看端口[默认 8102]:\n1) 修改\n2) 不修改[默认]"
opt
read change_v2p_port2
if [ "$change_v2p_port2" = "1" ]; then
echo -n -e "输入想修改的端口->"
read V2P_PORT2
fi
}
input_container_v2p2_http_config
# 确认
while true
do
TIME y "elecv2p 配置文件路径:$V2P_PATH"
TIME y "elecv2p 容器名:$V2P_CONTAINER_NAME"
TIME y "elecv2p 面板端口:$V2P_PORT"
TIME y "elecv2p anyproxy端口:$V2P_PORT1"
TIME y "elecv2p 网络请求查看端口:$V2P_PORT2"
read -r -p "以上信息是否正确?[Y/n] " input32
case $input32 in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
TIME w "即将返回上一步"
sleep 1
V2P_PORT="8100"
V2P_PORT1="8101"
V2P_PORT2="8102"
input_container_v2p2_config
input_container_v2p2_name
input_container_v2p2_webui_config
input_container_v2p2_anyproxy_config
input_container_v2p2_http_config
;;
*)
TIME r "输入错误,请输入[Y/n]"
;;
esac
done
TIME y " >>>>>>>>>>>配置完成,开始安装elecv2p"
log "1.开始创建配置文件目录"
PATH_LIST=($JSFILE_PATH $LISTS_PATH $STORE_PATH $SHELL_PATH $ROOTCA_PATH $EFSS_PATH $LOG_PATH)
for i in ${PATH_LIST[@]}; do
mkdir -p $i
done
log "2.开始创建容器并执行"
docker run -dit \
-v $JSFILE_PATH:/usr/local/app/script/JSFile \
-v $LISTS_PATH:/usr/local/app/script/Lists \
-v $STORE_PATH:/usr/local/app/script/Store \
-v $SHELL_PATH:/usr/local/app/script/Shell \