2019-09-03 15:46:45 +03:00
|
|
|
#!/usr/bin/env bash
|
2019-09-04 03:04:48 +03:00
|
|
|
env
|
2019-09-04 02:29:48 +03:00
|
|
|
set -x
|
2019-09-03 15:46:45 +03:00
|
|
|
|
2019-09-04 02:09:52 +03:00
|
|
|
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d'.' -f2)
|
2019-09-03 15:46:45 +03:00
|
|
|
|
|
|
|
[ "${BUILD_ARCH}" == "Dockerfile" ] && \
|
|
|
|
{ echo 'qemu-user-static: Download not required for this arch'; exit 0; }
|
|
|
|
|
|
|
|
TAGS_API="https://api.github.com/repos/multiarch/qemu-user-static/tags"
|
|
|
|
URL="https://github.com/multiarch/qemu-user-static/releases/download"
|
2019-09-04 02:09:52 +03:00
|
|
|
LATEST_TAG=$(curl -Ls $TAGS_API | \
|
|
|
|
awk -F'"' '/name.*v[0-9]/ {print $4; exit}')
|
2019-09-03 15:46:45 +03:00
|
|
|
STATIC_ARCH=$([ "${BUILD_ARCH}" == "armhf" ] && \
|
2019-09-04 02:09:52 +03:00
|
|
|
echo "${BUILD_ARCH::-2}" || echo "${BUILD_ARCH}")
|
2019-09-03 15:46:45 +03:00
|
|
|
|
2019-09-04 02:09:52 +03:00
|
|
|
curl -Ls "${URL}/${LATEST_TAG}/x86_64_qemu-${STATIC_ARCH}-static.tar.gz" | \
|
|
|
|
tar xzv
|