Browse Source

Reuse existing ImageBuilder archive for release versions

bryan 4 years ago
parent
commit
03090b031e
1 changed files with 4 additions and 3 deletions
  1. 4 3
      openwrtBuild

+ 4 - 3
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