#!/bin/sh
#can see these if browse to:
# https://commondatastorage.googleapis.com/chrome-linux-sysroot/

if [ ! -d depot_tools ];then
 echo "ERROR: a terminal must be opened in the 'chromium-project' folder and"
 echo "       this script run from the terminal window."
 exit
fi

ARCH="`arch`"
case "$ARCH" in
 x86_64) ARCH='amd64' ;;
 aarch64) ARCH='arm64' ;;
 *) echo 'ERROR: arch'; exit ;;
esac

case "$ARCH" in
 amd64)
  if [ -f debian_sid_amd64_sysroot.tar.xz ];then
   rm -f debian_sid_amd64_sysroot.tar.xz
  fi
  wget https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/0001d6cdb1e1761dae27902b616f0981669fdfb9/debian_sid_amd64_sysroot.tar.xz
  RETVAL=$?
 ;;
 arm64)
  if [ -f debian_sid_arm64_sysroot.tar.xz ];then
   rm -f debian_sid_arm64_sysroot.tar.xz
  fi
  wget https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/013a1c4e9a58f34c5daaaf342247d5ce262b8470/debian_sid_arm64_sysroot.tar.xz
  RETVAL=$?
 ;;
 *)
  echo 'ERROR: arch'
  exit
 ;;
esac

if [ $RETVAL -ne 0 ];then
 echo 'ERROR: DOWNLOAD FAILED'
fi
sync
###end###
