2
0

install-chrome.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. set -o pipefail -xeu
  3. dpkgArch="$(dpkg --print-architecture)"
  4. if [ "${USE_CHROMIUM}" = 1 -o "${dpkgArch##*-}" = "arm64" ]; then
  5. echo "Using Debian's Chromium"
  6. apt-dpkg-wrap apt-get install -y chromium chromium-driver chromium-sandbox
  7. chromium --version
  8. else
  9. if [ "${CHROME_RELEASE}" = "latest" ]; then
  10. wget -qO - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmour > /etc/apt/trusted.gpg.d/google.gpg
  11. echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
  12. apt-dpkg-wrap apt-get update
  13. apt-dpkg-wrap apt-get install -y google-chrome-stable
  14. else
  15. CHROME_DEB="/tmp/google-chrome-stable_${CHROME_RELEASE}-1_amd64.deb"
  16. curl -4so ${CHROME_DEB} "http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_RELEASE}-1_amd64.deb"
  17. apt-dpkg-wrap apt-get install -y ${CHROME_DEB}
  18. rm -f ${CHROME_DEB}
  19. fi
  20. google-chrome --version
  21. BASE_URL=https://googlechromelabs.github.io/chrome-for-testing
  22. if [ "${CHROME_RELEASE}" = "latest" ]; then
  23. CHROMEDRIVER_RELEASE="$(curl -4Ls ${BASE_URL}/LATEST_RELEASE_STABLE)"
  24. else
  25. CHROMEDRIVER_MAJOR_RELEASE=$(echo $CHROME_RELEASE | cut -d. -f1)
  26. CHROMEDRIVER_RELEASE="$(curl -4Ls ${BASE_URL}/LATEST_RELEASE_${CHROMEDRIVER_MAJOR_RELEASE})"
  27. fi
  28. CHROMEDRIVER_ZIP="/tmp/chromedriver_linux64.zip"
  29. curl -4Lso ${CHROMEDRIVER_ZIP} "https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_RELEASE}/linux64/chromedriver-linux64.zip"
  30. unzip ${CHROMEDRIVER_ZIP} -d /tmp/
  31. mv /tmp/chromedriver-linux64/chromedriver /usr/bin/
  32. chmod +x /usr/bin/chromedriver
  33. rm -rf /tmp/chromedriver*
  34. fi
  35. chromedriver --version