mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
tools/update-scan: update error handling and special case for jellyfin
This commit is contained in:
parent
b7b40a6d68
commit
682bf6e685
@ -27,9 +27,11 @@ test_github_api() {
|
||||
echo "Github api usage activated"
|
||||
github_api="yes"
|
||||
else
|
||||
msg=$(curl -m 5 -sL -I "${github_api_token}" https://api.github.com/user || true)
|
||||
message="\n your Github token is not working\n"
|
||||
message+=" github_token=${github_token}\n"
|
||||
message+=" github_user=${github_user}\n"
|
||||
message+=" ${msg}\n"
|
||||
die "${message}"
|
||||
fi
|
||||
else
|
||||
@ -48,13 +50,25 @@ check_for_update() {
|
||||
|
||||
# source variables from package.mk
|
||||
PKG_NAME="$(grep -oP -m 1 '(?<=PKG_NAME=\").*(?=\")' ${1} || true)"
|
||||
PKG_VERSION="$(grep -oP -m 1 '(?<=PKG_VERSION=\").*(?=\")' ${1} || true)"
|
||||
eval PKG_URL="$(grep -oP -m 1 '(?<=PKG_URL=\").*(?=\")' ${1} || true)"
|
||||
case ${PKG_NAME} in
|
||||
jellyfin)
|
||||
PKG_VERSION="$(grep -oP -m 1 '(?<=PKG_VERSION_NUMBER=\").*(?=\")' ${1} || true)"
|
||||
;;
|
||||
*)
|
||||
PKG_VERSION="$(grep -oP -m 1 '(?<=PKG_VERSION=\").*(?=\")' ${1} || true)"
|
||||
;;
|
||||
esac
|
||||
|
||||
# check if version and url are empty or self hosted by us and ignore those packages
|
||||
if [ -z "${PKG_VERSION}" ] || [[ ${PKG_VERSION} == '$(get_pkg_version '* ]] || [ -z "${PKG_URL}" ] || [[ "${PKG_URL}" == "$DISTRO_SRC"* ]]; then
|
||||
PACKAGES_IGNORED+="${PKG_NAME} "
|
||||
return
|
||||
# check the version of some packages even if they do not have a PKG_URL
|
||||
# the PKG_WITHOUT_URLS is space seperated
|
||||
PKGS_WITHOUT_URLS="jellyfin"
|
||||
if [[ ! " ${PKG_NAME} " == *" ${PKGS_WITHOUT_URLS} "* ]]; then
|
||||
# check if version and url are empty or self hosted by us and ignore those packages
|
||||
if [ -z "${PKG_VERSION}" ] || [[ ${PKG_VERSION} == '$(get_pkg_version '* ]] || [ -z "${PKG_URL}" ] || [[ "${PKG_URL}" == "$DISTRO_SRC"* ]]; then
|
||||
PACKAGES_IGNORED+="${PKG_NAME} "
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
upstream_version=""
|
||||
@ -91,8 +105,8 @@ check_for_update() {
|
||||
github_repos=$(echo "${PKG_URL}" | grep -oP '(?<=https:\/\/github.com\/)?[0-9A-Za-z._-]+\/[0-9A-Za-z._-]+(?=/archive|/tags|/releases)')
|
||||
le_master_version_date="Commit date: $(curl -m 5 -sL ${github_api_token} https://api.github.com/repos/${github_repos}/git/commits/${PKG_VERSION} | jq -r '.committer.date')"
|
||||
upstream_default_branch=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}" | jq -r '.default_branch')
|
||||
upstream_latest_commit=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/${upstream_default_branch}" | jq -r '.object.url')
|
||||
upstream_latest_commit_date=$(curl -m 5 -sL "${github_api_token}" "${upstream_latest_commit}" | jq -r '.committer.date')
|
||||
upstream_latest_commit=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/${upstream_default_branch}" | jq -r '.object.url' || true)
|
||||
upstream_latest_commit_date=$(curl -m 5 -sL "${github_api_token}" "${upstream_latest_commit}" | jq -r '.committer.date' || true)
|
||||
GH_API_TAG=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/tags")
|
||||
upstream_latest_tag=$(echo "${GH_API_TAG}" | jq -r '.[0].name')
|
||||
upstream_latest_tag_url=$(echo "${GH_API_TAG}" | jq -r '.[0].commit.url')
|
||||
|
Loading…
x
Reference in New Issue
Block a user