Fix wrongly handling proxy parameters given to curl
巧了,正好是我手贱把原来好好的 curl 参数顺序调乱了搞得脚本不指定代理就无法正常工作。 结果我意外因为这个发现脚本原本写的提供给 curl 的代理参数多了个空格,所以原来脚本是给了代理参数就不能正常工作的( --- ` curl '-x socks5h://1.1.1.1:9999' https://ipinfo.io ` > curl: (5) Unsupported proxy syntax in ' socks5h://1.1.1.1:9999' 注意这里报错消息里的空格。pull/10/head
parent
a0bb5d8eed
commit
56f37614f4
|
@ -149,7 +149,7 @@ judgment_parameters() {
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
PROXY="-x $2"
|
PROXY="-x$2"
|
||||||
# Parameters available through a proxy server
|
# Parameters available through a proxy server
|
||||||
if [[ "$#" -gt '2' ]]; then
|
if [[ "$#" -gt '2' ]]; then
|
||||||
case "$3" in
|
case "$3" in
|
||||||
|
@ -230,7 +230,7 @@ get_version() {
|
||||||
# Get V2Ray release version number
|
# Get V2Ray release version number
|
||||||
TMP_FILE="$(mktemp)"
|
TMP_FILE="$(mktemp)"
|
||||||
install_software curl
|
install_software curl
|
||||||
if ! curl -s "${PROXY}" -o "$TMP_FILE" https://api.github.com/repos/v2fly/v2ray-core/releases/latest; then
|
if ! curl ${PROXY} -s -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then
|
||||||
rm "$TMP_FILE"
|
rm "$TMP_FILE"
|
||||||
echo 'error: Failed to get release list, please check your network.'
|
echo 'error: Failed to get release list, please check your network.'
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -278,12 +278,12 @@ download_v2ray() {
|
||||||
mkdir "$TMP_DIRECTORY"
|
mkdir "$TMP_DIRECTORY"
|
||||||
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
|
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
|
||||||
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
|
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
|
||||||
if ! curl "${PROXY}" -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
|
if ! curl ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
|
||||||
echo 'error: Download failed! Please check your network or try again.'
|
echo 'error: Download failed! Please check your network or try again.'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
|
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} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
|
||||||
echo 'error: Download failed! Please check your network or try again.'
|
echo 'error: Download failed! Please check your network or try again.'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -354,11 +354,11 @@ install_startup_service_file() {
|
||||||
if [[ ! -f '/etc/systemd/system/v2ray.service' ]]; then
|
if [[ ! -f '/etc/systemd/system/v2ray.service' ]]; then
|
||||||
mkdir "${TMP_DIRECTORY}systemd/system/"
|
mkdir "${TMP_DIRECTORY}systemd/system/"
|
||||||
install_software curl
|
install_software curl
|
||||||
if ! curl -s "${PROXY}" -o "${TMP_DIRECTORY}systemd/system/v2ray.service" https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray.service; then
|
if ! curl ${PROXY} -s -o "${TMP_DIRECTORY}systemd/system/v2ray.service" 'https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray.service'; then
|
||||||
echo 'error: Failed to start service file download! Please check your network or try again.'
|
echo 'error: Failed to start service file download! Please check your network or try again.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! curl -s "${PROXY}" -o "${TMP_DIRECTORY}systemd/system/v2ray@.service" https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray@.service; then
|
if ! curl ${PROXY} -s -o "${TMP_DIRECTORY}systemd/system/v2ray@.service" 'https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray@.service'; then
|
||||||
echo 'error: Failed to start service file download! Please check your network or try again.'
|
echo 'error: Failed to start service file download! Please check your network or try again.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue