Commit f3dd2875 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Boot image download

parent e825b874
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -eu

FILE="$IMG/boot.img"
rm -f "$FILE"
TMP="/boot.img"
rm -f "$TMP"

echo "Downloading ${BOOT}..."

# Check if running with interactive TTY or redirected to docker log
if [ -t 1 ]; then
  wget "${BOOT}" -O "$FILE".tmp -q --no-check-certificate --show-progress
  wget "$BOOT" -O "$TMP" -q --no-check-certificate --show-progress --progress=bar:noscroll
else
  wget "${BOOT}" -O "$FILE".tmp -q --no-check-certificate --show-progress --progress=dot:giga
  wget "$BOOT" -O "$TMP" -q --no-check-certificate --show-progress --progress=dot:giga
fi

[ ! -f "$FILE".tmp ] && echo "Failed to download ${BOOT}" && exit 61
[ ! -f "$TMP" ] && echo "Failed to download ${BOOT}" && exit 61

FILE="$IMG/boot.img"

mv -f "$FILE".tmp "$FILE"
mv -f "$TMP" "$FILE"