22
33set -e
44
5- download_resources () {
6- command -v wget > /dev/null || {
7- echo " wget not found, please install it and try again."
8- exit 1
9- }
10-
11- if [ ! -f " 1pctl" ]; then
12- wget https://github.com/1Panel-dev/installer/raw/v2/1pctl
13- fi
14-
15- if [ ! -f " install.sh" ]; then
16- wget https://github.com/1Panel-dev/installer/raw/v2/install.sh
17- fi
18-
19- if [ ! -d " initscript" ]; then
20- wget https://github.com/1Panel-dev/installer/raw/v2/initscript/1panel-core.service
21- wget https://github.com/1Panel-dev/installer/raw/v2/initscript/1panel-agent.service
22- mkdir -p initscript && cd initscript
23- for file in 1panel-core.init 1panel-agent.init 1panel-core.openrc 1panel-agent.openrc 1panel-core.procd 1panel-agent.procd 1panel-core.service 1panel-agent.service; do
24- wget -q https://github.com/1Panel-dev/installer/raw/v2/initscript/$file
25- done
26- cd ..
27- fi
28-
29- if [ ! -d " lang" ]; then
30- mkdir -p lang && cd lang
31- for lang in en fa pt-BR ru zh; do
32- wget -q https://github.com/1Panel-dev/installer/raw/v2/lang/$lang .sh
33- done
34- cd ..
35- fi
36-
37- if [ ! -f " GeoIP.mmdb" ]; then
38- wget https://resource.fit2cloud.com/1panel/package/v2/geo/GeoIP.mmdb
39- fi
40-
41- chmod 755 1pctl install.sh
42- }
43-
44- compress_binary () {
45- local binary_path=" $1 "
46- local arch=" $2 "
47-
48- echo " Attempting to compress: $binary_path for arch: $arch "
49-
50- if [ " $arch " = " s390x" ]; then
51- echo " Skipping UPX compression for s390x"
52- return
53- fi
54-
55- if ! command -v upx > /dev/null; then
56- echo " Installing upx..."
57- if [ " $( uname -m) " = " s390x" ]; then
58- echo " UPX not supported on s390x"
59- return
60- fi
61-
62- sudo apt-get update
63- sudo apt-get install -y upx-ucl
64- fi
65-
66- upx --best --lzma " $binary_path " && echo " [ok] Compressed: $binary_path " || echo " [warn] Failed to compress: $binary_path "
5+ command -v wget > /dev/null || {
6+ echo " wget not found, please install it and try again."
7+ exit 1
678}
689
69- if [ " $1 " = " compress_binary" ]; then
70- compress_binary " $2 " " $3 "
71- else
72- download_resources
73- fi
10+ if [ ! -f " 1pctl" ]; then
11+ wget https://github.com/1Panel-dev/installer/raw/v2/1pctl
12+ fi
13+
14+ if [ ! -f " install.sh" ]; then
15+ wget https://github.com/1Panel-dev/installer/raw/v2/install.sh
16+ fi
17+
18+ if [ ! -d " initscript" ]; then
19+ wget https://github.com/1Panel-dev/installer/raw/v2/initscript/1panel-core.service
20+ wget https://github.com/1Panel-dev/installer/raw/v2/initscript/1panel-agent.service
21+ mkdir -p initscript && cd initscript
22+ for file in 1panel-core.init 1panel-agent.init 1panel-core.openrc 1panel-agent.openrc 1panel-core.procd 1panel-agent.procd 1panel-core.service 1panel-agent.service; do
23+ wget -q https://github.com/1Panel-dev/installer/raw/v2/initscript/$file
24+ done
25+ cd ..
26+ fi
27+
28+ if [ ! -d " lang" ]; then
29+ mkdir -p lang && cd lang
30+ for lang in en fa pt-BR ru zh; do
31+ wget -q https://github.com/1Panel-dev/installer/raw/v2/lang/$lang .sh
32+ done
33+ cd ..
34+ fi
35+
36+ if [ ! -f " GeoIP.mmdb" ]; then
37+ wget https://resource.fit2cloud.com/1panel/package/v2/geo/GeoIP.mmdb
38+ fi
39+
40+ chmod 755 1pctl install.sh
0 commit comments