Skip to content

Commit 804e5e3

Browse files
authored
Revert "Show download progress; Retry when transient error occurred."
1 parent 3e27de4 commit 804e5e3

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

install-dat-release.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

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

16-
alias curl='"curl" --retry 5 --retry-delay 10 --retry-max-time 60 --false-start --http2 --tlsv1.2 -L'
17-
1816
# You can modify it to /usr/local/lib/v2ray
1917
V2RAY="/usr/local/share/v2ray"
2018
DOWNLOAD_LINK_GEOIP="https://github.com/v2fly/geoip/releases/latest/download/geoip.dat"
@@ -33,11 +31,11 @@ check_if_running_as_root() {
3331
}
3432

3533
download_files() {
36-
if ! curl -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
34+
if ! curl -L -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
3735
echo 'error: Download failed! Please check your network or try again.'
3836
exit 1
3937
fi
40-
if ! curl -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
38+
if ! curl -L -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
4139
echo 'error: Download failed! Please check your network or try again.'
4240
exit 1
4341
fi

install-release.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ red=$(tput setaf 1)
2727
green=$(tput setaf 2)
2828
reset=$(tput sgr0)
2929

30-
alias curl='"curl" --retry 5 --retry-delay 10 --retry-max-time 60 --false-start --http2 --tlsv1.2 -L'
31-
3230
check_if_running_as_root() {
3331
# If you want to run as another user, please modify $UID to be owned by this user
3432
if [[ "$UID" -ne '0' ]]; then
@@ -172,7 +170,7 @@ judgment_parameters() {
172170

173171
install_software() {
174172
COMPONENT="$1"
175-
command -v "$COMPONENT" > /dev/null 2>&1 && return
173+
command -v "$COMPONENT" >/dev/null 2>&1 && return
176174
if ${PACKAGE_MANAGEMENT_INSTALL} "$COMPONENT"; then
177175
echo "info: $COMPONENT is installed."
178176
else
@@ -213,7 +211,7 @@ get_version() {
213211
TMP_FILE="$(mktemp)"
214212
install_software curl
215213
# DO NOT QUOTE THESE `${PROXY}` VARIABLES!
216-
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
214+
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
217215
"rm" "$TMP_FILE"
218216
echo 'error: Failed to get release list, please check your network.'
219217
exit 1
@@ -256,12 +254,12 @@ get_version() {
256254
download_v2ray() {
257255
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
258256
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
259-
if ! curl ${PROXY} -R -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
257+
if ! "curl" ${PROXY} -sSLR -H "Accept: application/vnd.github.v3+json" -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
260258
echo 'error: Download failed! Please check your network or try again.'
261259
return 1
262260
fi
263261
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
264-
if ! curl ${PROXY} -sSR -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
262+
if ! "curl" ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
265263
echo 'error: Download failed! Please check your network or try again.'
266264
return 1
267265
fi
@@ -314,7 +312,7 @@ install_v2ray() {
314312
# Install V2Ray configuration file to $JSON_PATH
315313
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
316314
install -d "$JSON_PATH"
317-
echo "{}" > "${JSON_PATH}/config.json"
315+
echo "{}" >"${JSON_PATH}/config.json"
318316
CONFIG_NEW='1'
319317
fi
320318

0 commit comments

Comments
 (0)