fix update
This commit is contained in:
parent
71c36881fb
commit
3178d9da88
24
update
24
update
@ -1,13 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Common function to download and unzip files
|
# 下载及解压
|
||||||
download_and_unzip() {
|
download_and_unzip() {
|
||||||
url="$1"
|
url="$1"
|
||||||
target_dir="$2"
|
target_dir="$2"
|
||||||
echo "正在下载 ${url}..."
|
echo "正在下载 ${url}..."
|
||||||
curl ${CURL_OPTIONS} "$url" | busybox unzip -d /tmp -
|
curl ${CURL_OPTIONS} "$url" | busybox unzip -d /tmp -
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "下载成功"
|
|
||||||
if [ -e /tmp/MoviePilot-* ]; then
|
if [ -e /tmp/MoviePilot-* ]; then
|
||||||
mv /tmp/MoviePilot-* /tmp/${target_dir}
|
mv /tmp/MoviePilot-* /tmp/${target_dir}
|
||||||
fi
|
fi
|
||||||
@ -16,7 +15,7 @@ download_and_unzip() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Common function to install backend and download resources
|
# 下载程序资源,$1: 后端版本路径
|
||||||
install_backend_and_download_resources() {
|
install_backend_and_download_resources() {
|
||||||
download_and_unzip "https://github.com/jxxghp/MoviePilot/archive/refs/${1}" "App"
|
download_and_unzip "https://github.com/jxxghp/MoviePilot/archive/refs/${1}" "App"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -36,13 +35,22 @@ install_backend_and_download_resources() {
|
|||||||
download_and_unzip "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" "dist"
|
download_and_unzip "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" "dist"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "前端程序下载成功"
|
echo "前端程序下载成功"
|
||||||
find /app/* -type d ! -path "/app/app/plugins" -exec rm -rf {} \;
|
# 备份插件目录
|
||||||
find /app/* -type f ! -path "/app/app/plugins/*" -exec rm -f {} \;
|
mv -f /app/app/plugins /plugins
|
||||||
mv -f /tmp/App/* /app/
|
# 清空目录
|
||||||
|
rm -rf /app
|
||||||
|
# 后端程序
|
||||||
|
mv -f /tmp/App /app
|
||||||
|
# 恢复插件目录
|
||||||
|
mv -f /plugins /app/app/plugins
|
||||||
|
# 插件仓库
|
||||||
|
mv -f /tmp/Plugins/plugins/* /app/app/plugins/
|
||||||
|
# 资源包
|
||||||
|
mv -f /tmp/Resources/resources/* /app/app/helper/
|
||||||
|
# 前端程序
|
||||||
rm -rf /public
|
rm -rf /public
|
||||||
mv /tmp/dist /public
|
mv /tmp/dist /public
|
||||||
mv -f /tmp/Plugins/plugins/* /app/app/plugins/
|
# 清理临时目录
|
||||||
mv -f /tmp/Resources/resources/* /app/app/helper/
|
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
echo "程序更新成功,前端版本:${frontend_version},后端版本:${1}"
|
echo "程序更新成功,前端版本:${frontend_version},后端版本:${1}"
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user