Skip to content

Commit

Permalink
Show download progress.
Browse files Browse the repository at this point in the history
Fix #128.
  • Loading branch information
IceCodeNew committed Sep 24, 2020
1 parent 99255e5 commit 098244b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions install-dat-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# 0 0 * * * /usr/local/bin/install-dat-release > /dev/null 2>&1

alias curl='curl --false-start --http2 --tlsv1.2 -L'

# You can modify it to /usr/local/lib/v2ray
V2RAY="/usr/local/share/v2ray"
DOWNLOAD_LINK_GEOIP="https://github.com/v2fly/geoip/releases/latest/download/geoip.dat"
Expand All @@ -31,11 +33,11 @@ check_if_running_as_root() {
}

download_files() {
if ! curl -L -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
if ! curl -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
echo 'error: Download failed! Please check your network or try again.'
exit 1
fi
if ! curl -L -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
if ! curl -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
echo 'error: Download failed! Please check your network or try again.'
exit 1
fi
Expand Down
8 changes: 5 additions & 3 deletions install-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)

alias curl='curl --false-start --http2 --tlsv1.2 -L'

check_if_running_as_root() {
# If you want to run as another user, please modify $UID to be owned by this user
if [[ "$UID" -ne '0' ]]; then
Expand Down Expand Up @@ -211,7 +213,7 @@ get_version() {
TMP_FILE="$(mktemp)"
install_software curl
# DO NOT QUOTE THESE `${PROXY}` VARIABLES!
if ! "curl" ${PROXY} -sSL -H "Accept: application/vnd.github.v3+json" -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then
if ! curl ${PROXY} -sS -H "Accept: application/vnd.github.v3+json" -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then
"rm" "$TMP_FILE"
echo 'error: Failed to get release list, please check your network.'
exit 1
Expand Down Expand Up @@ -254,12 +256,12 @@ get_version() {
download_v2ray() {
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
if ! "curl" ${PROXY} -sSLR -H "Accept: application/vnd.github.v3+json" -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
if ! curl ${PROXY} -R -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
if ! "curl" ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
if ! curl ${PROXY} -sSR -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
Expand Down

0 comments on commit 098244b

Please sign in to comment.