fix update
This commit is contained in:
parent
c50576b508
commit
6c13fa02c1
@ -22,6 +22,8 @@ def all_plugins(_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
|||||||
local_plugins = PluginManager().get_local_plugins()
|
local_plugins = PluginManager().get_local_plugins()
|
||||||
# 在线插件
|
# 在线插件
|
||||||
online_plugins = PluginManager().get_online_plugins()
|
online_plugins = PluginManager().get_online_plugins()
|
||||||
|
if not online_plugins:
|
||||||
|
return local_plugins
|
||||||
# 已安装插件IDS
|
# 已安装插件IDS
|
||||||
installed_ids = SystemConfigOper().get(SystemConfigKey.UserInstalledPlugins) or []
|
installed_ids = SystemConfigOper().get(SystemConfigKey.UserInstalledPlugins) or []
|
||||||
# 已经安装的本地
|
# 已经安装的本地
|
||||||
|
129
update
129
update
@ -1,52 +1,51 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -n "${PROXY_HOST}" ]; then
|
# Common function to download and unzip files
|
||||||
CURL_OPTIONS="-sL -x ${PROXY_HOST}"
|
download_and_unzip() {
|
||||||
PIP_OPTIONS="--proxy=${PROXY_HOST}"
|
url="$1"
|
||||||
echo "使用代理更新程序"
|
target_dir="$2"
|
||||||
else
|
echo "正在下载 ${url}..."
|
||||||
CURL_OPTIONS="-sL"
|
curl ${CURL_OPTIONS} "$url" | busybox unzip -d /tmp -
|
||||||
echo "不使用代理更新程序"
|
if [ $? -eq 0 ]; then
|
||||||
fi
|
echo "下载成功"
|
||||||
|
if [ -e /tmp/MoviePilot-* ]; then
|
||||||
if [ "${MOVIEPILOT_AUTO_UPDATE_DEV}" = "true" ]; then
|
mv /tmp/MoviePilot-* /tmp/${target_dir}
|
||||||
echo "Dev 更新模式"
|
fi
|
||||||
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Common function to install backend and download resources
|
||||||
|
install_backend_and_download_resources() {
|
||||||
|
download_and_unzip "https://github.com/jxxghp/MoviePilot/archive/refs/${1}" "App"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
mv /tmp/MoviePilot-main /tmp/app
|
|
||||||
echo "后端程序下载成功"
|
echo "后端程序下载成功"
|
||||||
# 重新安装依赖
|
|
||||||
pip install ${PIP_OPTIONS} --upgrade pip
|
pip install ${PIP_OPTIONS} --upgrade pip
|
||||||
pip install ${PIP_OPTIONS} -r /tmp/app/requirements.txt
|
pip install ${PIP_OPTIONS} -r /tmp/App/requirements.txt
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "安装依赖成功"
|
echo "安装依赖成功"
|
||||||
# 下载插件
|
download_and_unzip "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" "Plugins"
|
||||||
echo "正在下载插件..."
|
|
||||||
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "插件下载成功"
|
echo "插件下载成功"
|
||||||
# 下载资源
|
download_and_unzip "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" "Resources"
|
||||||
echo "正在下载资源包..."
|
|
||||||
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "资源包下载成功"
|
echo "资源包下载成功"
|
||||||
# 检查前端最新版本
|
|
||||||
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
|
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
|
||||||
if [[ "${frontend_version}" == *v* ]]; then
|
if [[ "${frontend_version}" == *v* ]]; then
|
||||||
echo "正在下载前端程序 ${frontend_version}..."
|
download_and_unzip "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" "dist"
|
||||||
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
|
rm -rf /app
|
||||||
mv /tmp/app /app
|
mv /tmp/App /app
|
||||||
rm -rf /public
|
rm -rf /public
|
||||||
mv /tmp/dist /public
|
mv /tmp/dist /public
|
||||||
mv /tmp/MoviePilot-Plugins-main/plugins/* /app/app/plugins/
|
mv /tmp/Plugins/plugins/* /app/app/plugins/
|
||||||
mv /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/
|
mv /tmp/Resources/resources/* /app/app/helper/
|
||||||
mkdir -p /app/config/sites
|
mkdir -p /app/config/sites
|
||||||
mv /app/app/helper/user.sites.bin /app/config/sites/user.sites.bin
|
mv /app/app/helper/user.sites.bin /app/config/sites/user.sites.bin
|
||||||
rm -rf /tmp/MoviePilot-*
|
rm -rf /tmp/*
|
||||||
echo "程序更新成功,前端版本:${frontend_version}"
|
echo "程序更新成功,前端版本:${frontend_version},后端版本:${1}"
|
||||||
else
|
else
|
||||||
echo "前端程序下载失败,继续使用旧的程序来启动..."
|
echo "前端程序下载失败,继续使用旧的程序来启动..."
|
||||||
fi
|
fi
|
||||||
@ -65,72 +64,34 @@ if [ "${MOVIEPILOT_AUTO_UPDATE_DEV}" = "true" ]; then
|
|||||||
else
|
else
|
||||||
echo "后端程序下载失败,继续使用旧的程序来启动..."
|
echo "后端程序下载失败,继续使用旧的程序来启动..."
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ...
|
||||||
|
|
||||||
|
if [ -n "${PROXY_HOST}" ]; then
|
||||||
|
CURL_OPTIONS="-sL -x ${PROXY_HOST}"
|
||||||
|
PIP_OPTIONS="--proxy=${PROXY_HOST}"
|
||||||
|
echo "使用代理更新程序"
|
||||||
|
else
|
||||||
|
CURL_OPTIONS="-sL"
|
||||||
|
echo "不使用代理更新程序"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${MOVIEPILOT_AUTO_UPDATE_DEV}" = "true" ]; then
|
||||||
|
echo "Dev 更新模式"
|
||||||
|
install_backend_and_download_resources "heads/main.zip"
|
||||||
else
|
else
|
||||||
old_version=$(cat /app/version.py)
|
old_version=$(cat /app/version.py)
|
||||||
if [[ "${old_version}" == *APP_VERSION* ]]; then
|
if [[ "${old_version}" == *APP_VERSION* ]]; then
|
||||||
current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
||||||
echo "当前版本号:${current_version}"
|
echo "当前版本号:${current_version}"
|
||||||
# 检查后端最新版本
|
|
||||||
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name)
|
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name)
|
||||||
if [[ "${new_version}" == *v* ]]; then
|
if [[ "${new_version}" == *v* ]]; then
|
||||||
release_version=${new_version}
|
release_version=${new_version}
|
||||||
echo "最新版本号:${release_version}"
|
echo "最新版本号:${release_version}"
|
||||||
if [ "${current_version}" != "${release_version}" ]; then
|
if [ "${current_version}" != "${release_version}" ]; then
|
||||||
echo "发现新版本,开始自动升级..."
|
echo "发现新版本,开始自动升级..."
|
||||||
echo "正在下载后端程序 ${release_version}..."
|
install_backend_and_download_resources "tags/${release_version}.zip"
|
||||||
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot/archive/refs/tags/${release_version}.zip" | busybox unzip -d /tmp -
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "后端程序下载成功"
|
|
||||||
# 重新安装依赖
|
|
||||||
pip install ${PIP_OPTIONS} --upgrade pip
|
|
||||||
pip install ${PIP_OPTIONS} -r /tmp/MoviePilot*/requirements.txt
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "安装依赖成功"
|
|
||||||
# 下载插件
|
|
||||||
echo "正在下载插件..."
|
|
||||||
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "插件下载成功"
|
|
||||||
# 下载资源
|
|
||||||
echo "正在下载资源包..."
|
|
||||||
curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp -
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "资源包下载成功"
|
|
||||||
# 检查前端最新版本
|
|
||||||
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
|
|
||||||
echo "前端程序下载成功"
|
|
||||||
rm -rf /app
|
|
||||||
mv /tmp/MoviePilot* /app
|
|
||||||
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
|
|
||||||
echo "资源包下载失败,继续使用旧的程序来启动..."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "插件下载失败,继续使用旧的程序来启动..."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "安装依赖失败,请重新拉取镜像"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "后端程序下载失败,继续使用旧的程序来启动..."
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "未发现新版本,跳过更新步骤..."
|
echo "未发现新版本,跳过更新步骤..."
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user