-
Notifications
You must be signed in to change notification settings - Fork 1
/
chromium_download.sh
85 lines (72 loc) · 2.8 KB
/
chromium_download.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
# Load custom functions
if [[ -s "${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/custom_functions.sh" ]]; then
source "${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/custom_functions.sh"
else
echo "${MY_SHELL_SCRIPTS:-$HOME/.dotfiles}/custom_functions.sh does not exist!"
exit 0
fi
[[ -z "${OS_INFO_TYPE}" ]] && get_os_type
[[ -z "${OS_INFO_ARCH}" ]] && get_arch
if [[ -x "$(command -v pacman)" ]]; then
PackagesList=(
curl
wget
)
InstallSystemPackages "" "${PackagesList[@]}"
fi
if [[ ! "$(command -v wget)" ]]; then
colorEcho "${FUCHSIA}wget${RED} is not installed!"
exit
fi
if [[ ! "$(command -v curl)" ]]; then
colorEcho "${FUCHSIA}curl${RED} is not installed!"
exit
fi
if [[ "${OS_INFO_TYPE}" == "windows" ]]; then
colorEchoN "${ORANGE}Use proxy?[y/${CYAN}N${ORANGE}]: "
read -r USE_PROXY
if [[ "${OS_INFO_ARCH}" == "amd64" ]]; then
ver="win64"
url1="https://storage.googleapis.com/chromium-browser-snapshots/Win_x64"
url2="https://storage.googleapis.com/chromium-browser-snapshots/win_rel"
else
ver="win32"
url1="https://storage.googleapis.com/chromium-browser-snapshots/Win"
url2="https://storage.googleapis.com/chromium-browser-snapshots/win32_rel"
fi
if [[ "$USE_PROXY" == 'y' || "$USE_PROXY" == 'Y' ]]; then
chromium_ver1=$(curl -fsSL --socks5-hostname 127.0.0.1:55880 "${url1}/LAST_CHANGE")
chromium_ver2=$(curl -fsSL --socks5-hostname 127.0.0.1:55880 "${url2}/LAST_CHANGE")
else
chromium_ver1=$(curl -fsSL "${url1}/LAST_CHANGE")
chromium_ver2=$(curl -fsSL "${url2}/LAST_CHANGE")
fi
if [[ $chromium_ver1 -gt $chromium_ver2 ]]; then
url=$url1
chromium_ver=$chromium_ver1
else
url=$url2
chromium_ver=$chromium_ver2
fi
if [[ -d "/d/Downloads" ]]; then
echo "Downloading Chromium Dev ${OS_INFO_TYPE}-${OS_INFO_ARCH}-r$chromium_ver"
if [[ "$USE_PROXY" == 'y' || "$USE_PROXY" == 'Y' ]]; then
wget -e "http_proxy=http://127.0.0.1:55881" -e "https_proxy=http://127.0.0.1:55881" \
-O "/d/Downloads/chrome-$ver-$chromium_ver.zip" \
-c "${url}/${chromium_ver}/chrome-win.zip"
else
wget -O "/d/Downloads/chrome-$ver-$chromium_ver.zip" \
-c "${url}/${chromium_ver}/chrome-win.zip"
fi
# if [[ "$USE_PROXY" == 'y' || "$USE_PROXY" == 'Y' ]]; then
# curl --socks5-hostname 127.0.0.1:55880 -fSL \
# -o "/d/Downloads/chrome-$ver-$chromium_ver.zip" \
# -C - "${url}/${chromium_ver}/chrome-win.zip"
# else
# curl -fSL \
# -o "/d/Downloads/chrome-$ver-$chromium_ver.zip" \
# -C - "${url}/${chromium_ver}/chrome-win.zip"
# fi
fi
fi