Commit c897c852 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/issue-12' into 'master'

fix: issue #12 by installing classic wget

Closes #12

See merge request to-be-continuous/bash!38
parents 36a85876 c0d51df7
Loading
Loading
Loading
Loading
+35 −4
Original line number Diff line number Diff line
@@ -314,6 +314,28 @@ stages:
    done
  }

  function maybe_install_packages() {
    if command -v apt-get > /dev/null
    then
      # Debian
      if ! dpkg --status "$@" > /dev/null
      then
        apt-get update
        apt-get install --no-install-recommends --yes --quiet "$@"
      fi
    elif command -v apk > /dev/null
    then
      # Alpine
      if ! apk info --installed "$@" > /dev/null
      then
        apk add --no-cache "$@"
      fi
    else
      log_error "... didn't find any supported package manager to install $*"
      exit 1
    fi
  }

  function install_bats_libs() {
    export BATS_LIBRARIES_DIR=/opt/bats/libexec

@@ -322,6 +344,13 @@ stages:
      return
    fi

    if [[ "$https_proxy" || "$HTTPS_PROXY" ]]
    then
      # BusyBox wget doesn't support proxies and TLS/SSL at the same time: need to use offical full-featured wget instead

      maybe_install_packages wget
    fi

    # install Bats libraries
    for lib in $BASH_BATS_LIBRARIES
    do
@@ -333,7 +362,7 @@ stages:
      target=$(mktemp)

      # 1: download
      log_info " ... download"
      log_info " ... download with wget"
      wget -O "$target" "$lib_url"

      # 2: unzip
@@ -349,9 +378,11 @@ stages:
      fi
    done

    if [ -n "${TRACE}" ]; then
      # debug log
      log_info " ... DONE"
      ls -lart "$BATS_LIBRARIES_DIR"
    fi
  }

  function glob_expand() {