Skip to content

Commit 3e27de4

Browse files
authored
Merge pull request #131 from v2fly/develop
2 parents 012d9be + b990f89 commit 3e27de4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

install-dat-release.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
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+
1618
# You can modify it to /usr/local/lib/v2ray
1719
V2RAY="/usr/local/share/v2ray"
1820
DOWNLOAD_LINK_GEOIP="https://github.com/v2fly/geoip/releases/latest/download/geoip.dat"
@@ -31,11 +33,11 @@ check_if_running_as_root() {
3133
}
3234

3335
download_files() {
34-
if ! curl -L -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
36+
if ! curl -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}" "${1}"; then
3537
echo 'error: Download failed! Please check your network or try again.'
3638
exit 1
3739
fi
38-
if ! curl -L -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
40+
if ! curl -R -H 'Cache-Control: no-cache' -o "${dir_tmp}/${2}.sha256sum" "${1}.sha256sum"; then
3941
echo 'error: Download failed! Please check your network or try again.'
4042
exit 1
4143
fi

install-release.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ 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+
3032
check_if_running_as_root() {
3133
# If you want to run as another user, please modify $UID to be owned by this user
3234
if [[ "$UID" -ne '0' ]]; then
@@ -170,7 +172,7 @@ judgment_parameters() {
170172

171173
install_software() {
172174
COMPONENT="$1"
173-
command -v "$COMPONENT" >/dev/null 2>&1 && return
175+
command -v "$COMPONENT" > /dev/null 2>&1 && return
174176
if ${PACKAGE_MANAGEMENT_INSTALL} "$COMPONENT"; then
175177
echo "info: $COMPONENT is installed."
176178
else
@@ -211,7 +213,7 @@ get_version() {
211213
TMP_FILE="$(mktemp)"
212214
install_software curl
213215
# DO NOT QUOTE THESE `${PROXY}` VARIABLES!
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
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
215217
"rm" "$TMP_FILE"
216218
echo 'error: Failed to get release list, please check your network.'
217219
exit 1
@@ -254,12 +256,12 @@ get_version() {
254256
download_v2ray() {
255257
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
256258
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
257-
if ! "curl" ${PROXY} -sSLR -H "Accept: application/vnd.github.v3+json" -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
259+
if ! curl ${PROXY} -R -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
258260
echo 'error: Download failed! Please check your network or try again.'
259261
return 1
260262
fi
261263
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
262-
if ! "curl" ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
264+
if ! curl ${PROXY} -sSR -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
263265
echo 'error: Download failed! Please check your network or try again.'
264266
return 1
265267
fi
@@ -312,7 +314,7 @@ install_v2ray() {
312314
# Install V2Ray configuration file to $JSON_PATH
313315
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
314316
install -d "$JSON_PATH"
315-
echo "{}" >"${JSON_PATH}/config.json"
317+
echo "{}" > "${JSON_PATH}/config.json"
316318
CONFIG_NEW='1'
317319
fi
318320

0 commit comments

Comments
 (0)