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