forked from Phala-Network/solo-mining-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·92 lines (80 loc) · 2.71 KB
/
install.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
#!/bin/bash
basedir=$(cd `dirname $0`;pwd)
scriptdir=$basedir/scripts
installdir=/opt/phala
help()
{
cat << EOF
Usage:
cn install chinese phala script | 中文安装
en install english phala script | 英文安装
help show install help information | 展示帮助信息
EOF
exit 0
}
install_cn()
{
echo "--------------安装 phala 脚本程序-------------"
if [ -f /opt/phala/scripts/phala.sh ]; then
echo "删除旧的 Phala 脚本"
/opt/phala/scripts/phala.sh uninstall
fi
echo "安装新的 Phala 脚本"
if [ ! -f $installdir ]; then mkdir -p $installdir; fi
if [ -f $installdir/.env ]; then
cp $basedir/{docker-compose.yml,console.js} $installdir
else
cp $basedir/{.env,docker-compose.yml,console.js} $installdir
fi
cp -r $basedir/scripts/cn $installdir/scripts
echo "安装 Phala 命令行工具"
chmod +x $installdir/scripts/phala.sh
ln -s $installdir/scripts/phala.sh /usr/bin/phala
# sed -i '1c NODE_IMAGE=swr.cn-east-3.myhuaweicloud.com/phala/khala-dev-node' $installdir/.env
# sed -i '2c PRUNTIME_IMAGE=swr.cn-east-3.myhuaweicloud.com/phala/phala-dev-pruntime' $installdir/.env
# sed -i '3c PHERRY_IMAGE=swr.cn-east-3.myhuaweicloud.com/phala/phala-dev-pherry' $installdir/.env
# sed -i '4c NODE_VOLUMES=/var/phala-node-data:/root/data' $installdir/.env
# sed -i '5c PRUNTIME_VOLUMES=/var/phala-pruntime-data:/root/datas' $installdir/.env
echo "------------安装成功-------------"
}
install_en()
{
echo "--------------Install phala scripts-------------"
if [ -f /opt/phala/scripts/phala.sh ]; then
echo "Uninstall old phala scripts"
/opt/phala/scripts/phala.sh uninstall
fi
echo "Install new phala scripts"
if [ ! -f $installdir ]; then mkdir -p $installdir; fi
if [ -f $installdir/.env ]; then
cp $basedir/{docker-compose.yml,console.js} $installdir/
else
cp $basedir/{.env,docker-compose.yml,console.js} $installdir/
fi
cp -r $basedir/scripts/en $installdir/scripts
echo "Install phala command line tool"
chmod +x $installdir/scripts/phala.sh
ln -s $installdir/scripts/phala.sh /usr/bin/phala
# sed -i '1c NODE_IMAGE=phalanetwork/khala-dev-node' $installdir/.env
# sed -i '2c PRUNTIME_IMAGE=phalanetwork/phala-dev-pruntime' $installdir/.env
# sed -i '3c PHERRY_IMAGE=phalanetwork/phala-dev-pherry' $installdir/.env
# sed -i '4c NODE_VOLUMES=/var/phala-node-data:/root/data' $installdir/.env
# sed -i '5c PRUNTIME_VOLUMES=/var/phala-pruntime-data:/root/data' $installdir/.env
echo "------------Install success-------------"
}
if [ $(id -u) -ne 0 ]; then
echo "Please run with sudo!"
echo "请使用sudo运行!"
exit 1
fi
case "$1" in
"cn")
install_cn
;;
"en")
install_en
;;
*)
help
;;
esac