Skip to content

Commit

Permalink
fix: file not updated properly
Browse files Browse the repository at this point in the history
  • Loading branch information
DDSRem committed May 24, 2024
1 parent 71d474a commit bd49df6
Showing 1 changed file with 6 additions and 37 deletions.
43 changes: 6 additions & 37 deletions xiaoya_data_downloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,6 @@ function ERROR() {
echo -e "${Time} ${ERROR} ${1}"
}

function pull_run_glue() {

if docker inspect xiaoyaliu/glue:latest > /dev/null 2>&1; then
local_sha=$(docker inspect --format='{{index .RepoDigests 0}}' xiaoyaliu/glue:latest | cut -f2 -d:)
remote_sha=$(curl -s "https://hub.docker.com/v2/repositories/xiaoyaliu/glue/tags/latest" | grep -o '"digest":"[^"]*' | grep -o '[^"]*$' | tail -n1 | cut -f2 -d:)
if [ ! "$local_sha" == "$remote_sha" ]; then
docker rmi xiaoyaliu/glue:latest
if docker pull xiaoyaliu/glue:latest; then
INFO "镜像拉取成功!"
else
ERROR "镜像拉取失败!"
exit 1
fi
fi
else
if docker pull xiaoyaliu/glue:latest; then
INFO "镜像拉取成功!"
else
ERROR "镜像拉取失败!"
exit 1
fi
fi

docker run -i \
--security-opt seccomp=unconfined \
--rm \
--net=host \
-e LANG=C.UTF-8 \
-v "${data_dir}:${data_dir}" \
xiaoyaliu/glue:latest \
"${@}"

}

files=(tvbox.zip update.zip index.zip version.txt)
base_urls=(
"https://gitlab.com/xiaoyaliu/data/-/raw/main/"
Expand All @@ -84,13 +50,16 @@ else
fi

for base_url in "${base_urls[@]}"; do
if pull_run_glue curl --insecure -fsSL "${base_url}version.txt"; then
if curl --insecure -fsSL "${base_url}version.txt"; then
available_url=${base_url}
break
fi
done

for file in "${files[@]}"; do
pull_run_glue wget --no-check-certificate -nc -O "${data_dir}/${file}" "${available_url}${file}"
INFO "$available_url$file 更新成功"
if curl --insecure -fsSL -o "${data_dir}/${file}" "${available_url}${file}"; then
INFO "$available_url$file 更新成功!"
else
ERROR "$available_url$file 更新失败!"
fi
done

0 comments on commit bd49df6

Please sign in to comment.