Skip to content
Snippets Groups Projects
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
Branches
No related tags found
No related merge requests found
...@@ -314,6 +314,28 @@ stages: ...@@ -314,6 +314,28 @@ stages:
done 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() { function install_bats_libs() {
export BATS_LIBRARIES_DIR=/opt/bats/libexec export BATS_LIBRARIES_DIR=/opt/bats/libexec
...@@ -322,6 +344,13 @@ stages: ...@@ -322,6 +344,13 @@ stages:
return return
fi 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 # install Bats libraries
for lib in $BASH_BATS_LIBRARIES for lib in $BASH_BATS_LIBRARIES
do do
...@@ -333,7 +362,7 @@ stages: ...@@ -333,7 +362,7 @@ stages:
target=$(mktemp) target=$(mktemp)
# 1: download # 1: download
log_info " ... download" log_info " ... download with wget"
wget -O "$target" "$lib_url" wget -O "$target" "$lib_url"
# 2: unzip # 2: unzip
...@@ -349,9 +378,11 @@ stages: ...@@ -349,9 +378,11 @@ stages:
fi fi
done done
if [ -n "${TRACE}" ]; then
# debug log # debug log
log_info " ... DONE" log_info " ... DONE"
ls -lart "$BATS_LIBRARIES_DIR" ls -lart "$BATS_LIBRARIES_DIR"
fi
} }
function glob_expand() { function glob_expand() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment