fix update

This commit is contained in:
jxxghp 2023-11-01 22:48:52 +08:00
parent 7bc4a6906a
commit c50576b508

108
update
View File

@ -23,33 +23,41 @@ if [ "${MOVIEPILOT_AUTO_UPDATE_DEV}" = "true" ]; then
# 下载插件 # 下载插件
echo "正在下载插件..." echo "正在下载插件..."
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
echo "插件下载成功" if [ $? -eq 0 ]; then
# 下载资源 echo "插件下载成功"
echo "正在下载资源包..." # 下载资源
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp - echo "正在下载资源包..."
echo "资源包下载成功" curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
# 检查前端最新版本
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
if [[ "${frontend_version}" == *v* ]]; then
echo "正在下载前端程序 ${frontend_version}..."
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" | busybox unzip -d /tmp -
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "前端程序下载成功" echo "资源包下载成功"
rm -rf /app # 检查前端最新版本
mv /tmp/app /app frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
rm -rf /public if [[ "${frontend_version}" == *v* ]]; then
mv /tmp/dist /public echo "正在下载前端程序 ${frontend_version}..."
mv /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/ curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" | busybox unzip -d /tmp -
mv /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/ if [ $? -eq 0 ]; then
mkdir -p /app/config/sites echo "前端程序下载成功"
mv /app/app/helper/user.sites.bin /app/config/sites/user.sites.bin rm -rf /app
rm -rf /tmp/MoviePilot-* mv /tmp/app /app
echo "程序更新成功,前端版本:${frontend_version}" rm -rf /public
mv /tmp/dist /public
mv /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/
mv /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/
mkdir -p /app/config/sites
mv /app/app/helper/user.sites.bin /app/config/sites/user.sites.bin
rm -rf /tmp/MoviePilot-*
echo "程序更新成功,前端版本:${frontend_version}"
else
echo "前端程序下载失败,继续使用旧的程序来启动..."
fi
else
echo "前端最新版本号获取失败,继续启动..."
fi
else else
echo "前端程序下载失败,继续使用旧的程序来启动..." echo "资源包下载失败,继续使用旧的程序来启动..."
fi fi
else else
echo "前端最新版本号获取失败,继续启动..." echo "插件下载失败,继续使用旧的程序来启动..."
fi fi
else else
echo "安装依赖失败,请重新拉取镜像" echo "安装依赖失败,请重新拉取镜像"
@ -81,33 +89,41 @@ else
# 下载插件 # 下载插件
echo "正在下载插件..." echo "正在下载插件..."
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
echo "插件下载成功" if [ $? -eq 0 ]; then
# 下载资源 echo "插件下载成功"
echo "正在下载资源包..." # 下载资源
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp - echo "正在下载资源包..."
echo "资源包下载成功" curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
# 检查前端最新版本
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
if [[ "${frontend_version}" == *v* ]]; then
echo "正在下载前端程序 ${frontend_version}..."
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" | busybox unzip -d /tmp -
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "前端程序下载成功" echo "资源包下载成功"
rm -rf /app # 检查前端最新版本
mv /tmp/MoviePilot* /app frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
rm -rf /public if [[ "${frontend_version}" == *v* ]]; then
mv /tmp/dist /public echo "正在下载前端程序 ${frontend_version}..."
mv /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/ curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" | busybox unzip -d /tmp -
mv /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/ if [ $? -eq 0 ]; then
mkdir -p /app/config/sites echo "前端程序下载成功"
mv /app/app/helper/user.sites.bin /app/config/sites/user.sites.bin rm -rf /app
rm -rf /tmp/MoviePilot-* mv /tmp/MoviePilot* /app
echo "程序更新成功,前端版本:${frontend_version},后端版本:${release_version}" rm -rf /public
mv /tmp/dist /public
mv /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/
mv /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/
mkdir -p /app/config/sites
mv /app/app/helper/user.sites.bin /app/config/sites/user.sites.bin
rm -rf /tmp/MoviePilot-*
echo "程序更新成功,前端版本:${frontend_version},后端版本:${release_version}"
else
echo "前端程序下载失败,继续使用旧的程序来启动..."
fi
else
echo "前端最新版本号获取失败,继续启动..."
fi
else else
echo "前端程序下载失败,继续使用旧的程序来启动..." echo "资源包下载失败,继续使用旧的程序来启动..."
fi fi
else else
echo "前端最新版本号获取失败,继续启动..." echo "插件下载失败,继续使用旧的程序来启动..."
fi fi
else else
echo "安装依赖失败,请重新拉取镜像" echo "安装依赖失败,请重新拉取镜像"