Skip to content

Commit

Permalink
fix for build arg
Browse files Browse the repository at this point in the history
  • Loading branch information
laynepenney committed Jul 20, 2018
1 parent 9d3d94b commit 861c66c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ COPY tools .
ENTRYPOINT ["./entrypoint.sh"]

# Update sdk on build
ONBUILD ARG INSTALL_PACKAGES_FILE=default-packages.txt
ONBUILD RUN ./install.sh ${INSTALL_PACKAGES_FILE}
ONBUILD ARG INSTALL_PACKAGE_LIST=""
ONBUILD RUN ./install.sh "${INSTALL_PACKAGE_LIST}"
15 changes: 10 additions & 5 deletions images/sdk/tools/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,27 @@ function android_update() {
android_sdkmanager "--update --verbose"
}

function android_install_packages() {
while [[ $# -gt 0 ]]; do
local pkg="$1"
shift 1
echo "Installing package: ${pkg}"
android_sdkmanager "${pkg} --verbose"
done
}

function android_install() {
if [[ $# -eq 0 ]]; then
help
return 1
fi

echo "Installing packages"
local prev_ifs="$IFS"
IFS=$'\n'
local pkgs=($( cat "$@" ))
IFS="${prev_ifs}"

local pkg
for pkg in "${pkgs[@]}"; do
android_sdkmanager "${pkg} --verbose"
done
android_install_packages "${pkgs[@]}"
}

export -f help
Expand Down
10 changes: 8 additions & 2 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

source "${ANDROID_ROOT}/tools/env.sh"

echo "Installing packages"
android_install "${@}"
if [[ -n "$1" ]]; then
pkgs=("$@")
echo "Installing packages: ${pkgs[@]}"
android_install_packages "${pkgs[@]}"
else
echo "Installing default packages"
android_install default-packages.txt
fi

0 comments on commit 861c66c

Please sign in to comment.