Reuse existing ImageBuilder archive for release versions

This commit is contained in:
2020-05-21 14:50:44 -04:00
parent 98acb8e0db
commit 03090b031e

View File

@@ -205,9 +205,13 @@ acquireImageBuilder() {
local _url _filename local _url _filename
if [[ "$_version" == "snapshot" ]]; then if [[ "$_version" == "snapshot" ]]; then
# Remove existing ImageBuilders
[[ -f "$_source_archive" ]] && rm "$_source_archive"
_filename="openwrt-imagebuilder-${_target//\//-}.Linux-x86_64.tar.xz" _filename="openwrt-imagebuilder-${_target//\//-}.Linux-x86_64.tar.xz"
_url="https://downloads.openwrt.org/snapshots/targets/$_target/$_filename" _url="https://downloads.openwrt.org/snapshots/targets/$_target/$_filename"
else else
# Reuse existing ImageBuilders
[[ -f "$_source_archive" ]] && return 0
_filename="openwrt-imagebuilder-$_version-${_target//\//-}.Linux-x86_64.tar.xz" _filename="openwrt-imagebuilder-$_version-${_target//\//-}.Linux-x86_64.tar.xz"
_url="https://downloads.openwrt.org/releases/$_version/targets/$_target/$_filename" _url="https://downloads.openwrt.org/releases/$_version/targets/$_target/$_filename"
fi fi
@@ -215,9 +219,6 @@ acquireImageBuilder() {
# Make sources directory if it does not exist # Make sources directory if it does not exist
[[ ! -d "$_builddir/sources" ]] && mkdir -p "$_builddir/sources" [[ ! -d "$_builddir/sources" ]] && mkdir -p "$_builddir/sources"
# Remove existing ImageBuilder archives
[[ -f "$_source_archive" ]] && rm "$_source_archive"
echo "Downloading image archive" echo "Downloading image archive"
debug "axel -o $_source_archive $_url" debug "axel -o $_source_archive $_url"
if ! axel -o "$_source_archive" "$_url" > /dev/null 2>&1; then if ! axel -o "$_source_archive" "$_url" > /dev/null 2>&1; then