Skip to content

Commit

Permalink
fix: πŸ› xz download failed
Browse files Browse the repository at this point in the history
  • Loading branch information
abcfy2 committed Apr 6, 2024
1 parent 09b5c0b commit cc89a8d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,17 @@ prepare_zlib() {
}

prepare_xz() {
xz_release_info="$(retry wget -qO- --compression=auto https://api.github.com/repos/tukaani-project/xz/releases \| jq -r "'[.[] | select(.prerelease == false)][0]'")"
xz_tag="$(printf '%s' "${xz_release_info}" | jq -r '.tag_name')"
xz_archive_name="$(printf '%s' "${xz_release_info}" | jq -r '.assets[].name | select(endswith("tar.xz"))')"
xz_latest_url="https://github.com/tukaani-project/xz/releases/download/${xz_tag}/${xz_archive_name}"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
xz_latest_url="https://mirror.ghproxy.com/${xz_latest_url}"
fi
# Download from github release (now breakdown)
# xz_release_info="$(retry wget -qO- --compression=auto https://api.github.com/repos/tukaani-project/xz/releases \| jq -r "'[.[] | select(.prerelease == false)][0]'")"
# xz_tag="$(printf '%s' "${xz_release_info}" | jq -r '.tag_name')"
# xz_archive_name="$(printf '%s' "${xz_release_info}" | jq -r '.assets[].name | select(endswith("tar.xz"))')"
# xz_latest_url="https://github.com/tukaani-project/xz/releases/download/${xz_tag}/${xz_archive_name}"
# if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
# xz_latest_url="https://mirror.ghproxy.com/${xz_latest_url}"
# fi
# Download from sourceforge
xz_tag="$(retry wget -qO- --compression=auto https://sourceforge.net/projects/lzmautils/files/ \| grep -i \'span class=\"sub-label\"\' \| head -1 \| sed -r "'s/.*xz-(.+)\.tar\.gz.*/\1/'")"
xz_latest_url="https://sourceforge.net/projects/lzmautils/files/xz-${xz_tag}.tar.xz"
if [ ! -f "${DOWNLOADS_DIR}/xz-${xz_tag}.tar.xz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/xz-${xz_tag}.tar.xz.part" "${xz_latest_url}"
mv -fv "${DOWNLOADS_DIR}/xz-${xz_tag}.tar.xz.part" "${DOWNLOADS_DIR}/xz-${xz_tag}.tar.xz"
Expand Down

0 comments on commit cc89a8d

Please sign in to comment.