mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix(docker): make source updates recoverable (#6379)
This commit is contained in:
@@ -12,6 +12,8 @@ export PATH
|
||||
SOURCE_CONTROL_DIR="${MOVIEPILOT_SOURCE_CONTROL_DIR:-/app/docker}"
|
||||
IMAGE_CONTROL_DIR="${MOVIEPILOT_IMAGE_CONTROL_DIR:-/usr/local/lib/moviepilot/control}"
|
||||
RUNTIME_ROOT="${MOVIEPILOT_RUNTIME_CONTROL_ROOT:-/run/moviepilot/control}"
|
||||
UPDATE_PENDING_FILE="${CONFIG_DIR:-/config}/temp/__update_pending__"
|
||||
UPDATE_PREVIOUS_APP="/app.__update_previous__"
|
||||
CONTROL_FILES=()
|
||||
CONTROL_REQUIRED_FILES=(entrypoint.sh update.sh browser.sh cert.sh)
|
||||
|
||||
@@ -94,7 +96,33 @@ function source_bundle_is_trusted() {
|
||||
control_bundle_generation "${control_dir}" >/dev/null
|
||||
}
|
||||
|
||||
function pending_update_state() {
|
||||
[ -f "${UPDATE_PENDING_FILE}" ] || return 1
|
||||
tr -d '\r\n' < "${UPDATE_PENDING_FILE}"
|
||||
}
|
||||
|
||||
function pending_recovery_control_dir() {
|
||||
local state
|
||||
local previous_control_dir="${UPDATE_PREVIOUS_APP}/docker"
|
||||
|
||||
state="$(pending_update_state 2>/dev/null || true)"
|
||||
case "${state}" in
|
||||
prepared|dependencies)
|
||||
[ -e "${UPDATE_PREVIOUS_APP}" ] || return 1
|
||||
source_bundle_is_trusted "${previous_control_dir}" || return 1
|
||||
printf '%s\n' "${previous_control_dir}"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
function select_control_dir() {
|
||||
local recovery_dir
|
||||
if recovery_dir="$(pending_recovery_control_dir)"; then
|
||||
printf '%s\n' "${recovery_dir}"
|
||||
return 0
|
||||
fi
|
||||
if source_bundle_is_trusted "${SOURCE_CONTROL_DIR}"; then
|
||||
printf '%s\n' "${SOURCE_CONTROL_DIR}"
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user