Skip to content

Commit

Permalink
Add an error handing logic when qemu-$arch-statis.tar.gz URL is not f…
Browse files Browse the repository at this point in the history
…ound.
  • Loading branch information
junaruga committed Sep 2, 2019
1 parent 00cd7f9 commit a3ceb59
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ for to_arch in $to_archs; do
if [ "$from_arch" != "$to_arch" ]; then
work_dir="${out_dir}/${from_arch}_qemu-${to_arch}"
mkdir -p "${work_dir}"
curl -sSL -o "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" \
"https://github.com/${REPO}/releases/download/v${VERSION}/${from_arch}_qemu-${to_arch}-static.tar.gz"
tar_gz_url="https://github.com/${REPO}/releases/download/v${VERSION}/${from_arch}_qemu-${to_arch}-static.tar.gz"
http_status="$(curl -s -o /dev/null -w "%{http_code}" "${tar_gz_url}")"
if [ "${http_status}" = 404 ]; then
echo "URL not found: ${tar_gz_url}" 1>&2
exit 1
fi
curl -sSL -o "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" "${tar_gz_url}"
tar xzvf "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" -C "${work_dir}"
rm -f "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz"

Expand Down

0 comments on commit a3ceb59

Please sign in to comment.