mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-03 17:27:17 +08:00
Update create_ct.sh
This commit is contained in:
parent
fb64988a6f
commit
c601d6968c
1 changed files with 24 additions and 1 deletions
|
@ -19,6 +19,29 @@ else
|
|||
_green "Locale set to $utf8_locale"
|
||||
fi
|
||||
|
||||
check_cdn() {
|
||||
local o_url=$1
|
||||
for cdn_url in "${cdn_urls[@]}"; do
|
||||
if curl -sL -k "$cdn_url$o_url" --max-time 6 | grep -q "success" > /dev/null 2>&1; then
|
||||
export cdn_success_url="$cdn_url"
|
||||
return
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
export cdn_success_url=""
|
||||
}
|
||||
|
||||
check_cdn_file() {
|
||||
check_cdn "https://raw.githubusercontent.com/spiritLHLS/ecs/main/back/test"
|
||||
if [ -n "$cdn_success_url" ]; then
|
||||
_yellow "CDN available, using CDN"
|
||||
else
|
||||
_yellow "No CDN available, no use CDN"
|
||||
fi
|
||||
}
|
||||
|
||||
cdn_urls=("https://cdn.spiritlhl.workers.dev/" "https://shrill-pond-3e81.hunsh.workers.dev/" "https://ghproxy.com/" "http://104.168.128.181:7823/" "https://gh.api.99988866.xyz/")
|
||||
check_cdn_file
|
||||
|
||||
pre_check(){
|
||||
home_dir=$(eval echo "~$(whoami)")
|
||||
|
@ -30,7 +53,7 @@ pre_check(){
|
|||
apt-get install dos2unix -y
|
||||
fi
|
||||
if [ ! -f "buildct.sh" ]; then
|
||||
curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildct.sh -o buildct.sh && chmod +x buildct.sh
|
||||
curl -L ${cdn_success_url}https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/buildct.sh -o buildct.sh && chmod +x buildct.sh
|
||||
dos2unix buildct.sh
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue