feat: cn update

This commit is contained in:
DDSRem 2023-08-11 11:21:58 +08:00
parent e505f2d2c2
commit e895f8af8d
2 changed files with 12 additions and 3 deletions

View File

@ -8,6 +8,7 @@ ENV LANG="C.UTF-8" \
PGID=0 \ PGID=0 \
UMASK=000 \ UMASK=000 \
MOVIEPILOT_AUTO_UPDATE=true \ MOVIEPILOT_AUTO_UPDATE=true \
MOVIEPILOT_CN_UPDATE=false \
NGINX_PORT=3000 \ NGINX_PORT=3000 \
CONFIG_DIR="/config" \ CONFIG_DIR="/config" \
API_TOKEN="moviepilot" \ API_TOKEN="moviepilot" \

14
update
View File

@ -1,15 +1,23 @@
#!/bin/bash #!/bin/bash
if [ "${MOVIEPILOT_CN_UPDATE}" = "true" ]; then
GITHUB_URL="https://ghproxy.com/https://github.com"
GITHUBUSERCONTENT_URL="https://ghproxy.com/https://raw.githubusercontent.com"
else
GITHUB_URL="https://github.com"
GITHUBUSERCONTENT_URL="https://raw.githubusercontent.com"
fi
old_version=$(cat /app/version.py) old_version=$(cat /app/version.py)
new_version=$(curl -sL https://raw.githubusercontent.com/jxxghp/MoviePilot/main/version.py) new_version=$(curl -sL "${GITHUBUSERCONTENT_URL}/jxxghp/MoviePilot/main/version.py")
release_version=v$(echo ${new_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") release_version=v$(echo ${new_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
if [ "${old_version}" != "${new_version}" ]; then if [ "${old_version}" != "${new_version}" ]; then
echo "发现新版本,开始更新程序..." echo "发现新版本,开始更新程序..."
curl -sL "https://github.com/jxxghp/MoviePilot/archive/refs/tags/${release_version}.zip" | busybox unzip -d /tmp - curl -sL "${GITHUB_URL}/jxxghp/MoviePilot/archive/refs/tags/${release_version}.zip" | busybox unzip -d /tmp -
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "后端下载成功" echo "后端下载成功"
curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${release_version}/dist.zip" | busybox unzip -d /tmp - curl -sL "${GITHUB_URL}/jxxghp/MoviePilot-Frontend/releases/download/${release_version}/dist.zip" | busybox unzip -d /tmp -
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "前端下载成功" echo "前端下载成功"
rm -rf /app rm -rf /app