-
Notifications
You must be signed in to change notification settings - Fork 114
/
browser_downloader.sh
executable file
·55 lines (45 loc) · 1.37 KB
/
browser_downloader.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
BROWSER_DIR=`dirname $(realpath $0)` && cd $BROWSER_DIR
function download_chromium {
# Set defaults
arch="x64"
os="linux"
chromium_version="112"
chromium_binary="chrome"
ARCHTYPE=`uname -m`
force=$1
# Architecture
if [ "$ARCHTYPE" = "aarch64" ] || [ "$ARCHTYPE" = "arm64" ]; then
arch="arm64"
fi
# Platform
if (echo "$OSTYPE" | grep -qi darwin); then
os="mac"
chromium_binary="Chromium.app/Contents/MacOS/Chromium"
elif [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "win32" ]; then
os="win"
chromium_binary="chrome.exe"
BROWSER_DIR=`pwd -W`
fi
# Variables
artifact="chromium-$os-$arch.zip"
chromium_url="https://ci.opensearch.org/ci/dbc/tools/chromium/$chromium_version/zip/$artifact"
chromium_path="$BROWSER_DIR/chromium/chrome-$os/$chromium_binary"
# Get artifact
if [ "$force" = "true" ] || [ ! -f "$chromium_path" ]; then
rm -rf chromium
mkdir -p chromium
cd chromium
curl -sSLO $chromium_url
unzip -qq $artifact
rm $artifact
fi
echo "$chromium_path chromium-$chromium_version os-$os arch-$arch"
# Verify binary
if [ "$os" = "win" ]; then
powershell -command "(Get-Item $chromium_path)".VersionInfo
else
$chromium_path --version
fi
}