mirror of
https://github.com/xubiaolin/docker-zerotier-planet.git
synced 2025-01-22 12:48:14 -05:00
feat: 🎸 自动获取ip
This commit is contained in:
parent
1177c234e4
commit
fd063b1948
33
deploy.sh
33
deploy.sh
@ -1,14 +1,45 @@
|
||||
#!/bin/sh
|
||||
imageName="zerotier-planet"
|
||||
|
||||
# 处理ip信息
|
||||
curr_ip=$(curl -s cip.cc | grep http | awk -F '/' '{print $4}')
|
||||
|
||||
echo "-------------------------------------------"
|
||||
echo 您当前公网ip为:"$curr_ip", 使用当前ip请输入:y
|
||||
echo "-------------------------------------------"
|
||||
echo 使用其他ip请输入要使用的ip,例如1.1.1.1
|
||||
echo "-------------------------------------------"
|
||||
|
||||
ip=""
|
||||
read c
|
||||
|
||||
if [ "$c" = 'y' ]; then
|
||||
ip=$curr_ip
|
||||
else
|
||||
ip=$c
|
||||
fi
|
||||
|
||||
echo "----------------------------"
|
||||
echo "当前的ip为:$ip, 是否继续? y/n"
|
||||
read or
|
||||
if [ "$or" = "y" ]; then
|
||||
echo "{
|
||||
\"stableEndpoints\": [
|
||||
\"$ip/9993\"
|
||||
]
|
||||
}
|
||||
" > ./patch/patch.json
|
||||
else
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# 开始安装程序
|
||||
echo "清除原有内容"
|
||||
rm /opt/planet
|
||||
docker stop $imageName
|
||||
docker rm $imageName
|
||||
docker rmi $imageName
|
||||
|
||||
|
||||
echo "打包镜像"
|
||||
docker build --network host -t $imageName .
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"stableEndpoints": [
|
||||
"82.157.68.236/9993"
|
||||
]
|
||||
}
|
||||
{
|
||||
"stableEndpoints": [
|
||||
"1.1.1.1/9993"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user