This commit is contained in:
DDSRem 2024-02-20 14:34:29 +08:00
parent daa8d80ec9
commit 5bac94cbc5

7
update
View File

@ -1,12 +1,13 @@
#!/bin/bash
# shellcheck shell=bash
# shellcheck disable=SC2086
# 下载及解压
download_and_unzip() {
url="$1"
target_dir="$2"
echo "正在下载 ${url}..."
if curl "${CURL_OPTIONS}" "${url}" "${CURL_HEADERS}" | busybox unzip -d /tmp -; then
if curl ${CURL_OPTIONS} "${url}" ${CURL_HEADERS} | busybox unzip -d /tmp -; then
mv /tmp/MoviePilot-* /tmp/"${target_dir}"
else
return 1
@ -20,7 +21,7 @@ install_backend_and_download_resources() {
pip install "${PIP_OPTIONS}" --upgrade pip
if pip install "${PIP_OPTIONS}" -r /tmp/App/requirements.txt; then
echo "安装依赖成功"
frontend_version=$(curl "${CURL_OPTIONS}" "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" "${CURL_HEADERS}" | jq -r .tag_name)
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" ${CURL_HEADERS} | jq -r .tag_name)
if [[ "${frontend_version}" == *v* ]]; then
if download_and_unzip "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" "dist"; then
echo "前端程序下载成功"
@ -103,7 +104,7 @@ if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}"
if [[ "${old_version}" == *APP_VERSION* ]]; then
current_version=v$(echo "${old_version}" | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
echo "当前版本号:${current_version}"
new_version=$(curl "${CURL_OPTIONS}" "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" "${CURL_HEADERS}" | jq -r .tag_name)
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" ${CURL_HEADERS} | jq -r .tag_name)
if [[ "${new_version}" == *v* ]]; then
release_version=${new_version}
echo "最新版本号:${release_version}"