mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
prefer command line flags over interaction
This commit is contained in:
parent
8d282da1d9
commit
cbfc9adb95
@ -1,5 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
while [[ $# > 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-p|--proxy)
|
||||
PROXY="$2"
|
||||
shift # past argument
|
||||
;;
|
||||
-h|--help)
|
||||
HELP="1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
shift # past argument or value
|
||||
done
|
||||
|
||||
if [[ "$HELP" == "1" ]]; then
|
||||
echo "./install-release.sh [-p proxy]"
|
||||
echo "To download through a proxy server, use -p socks5://127.0.0.1:1080 or -p http://127.0.0.1:3128 etc"
|
||||
exit
|
||||
fi
|
||||
|
||||
YUM_CMD=$(command -v yum)
|
||||
APT_CMD=$(command -v apt-get)
|
||||
|
||||
@ -33,15 +59,8 @@ DOWNLOAD_LINK="https://github.com/v2ray/v2ray-core/releases/download/${VER}/v2ra
|
||||
rm -rf /tmp/v2ray
|
||||
mkdir -p /tmp/v2ray
|
||||
|
||||
# Download release with proxy or not
|
||||
echo 'Direct start downloading release,'
|
||||
echo 'Or Enter a proxy URI for Downloading release.'
|
||||
echo 'ex: socks5://127.0.0.1:1080'
|
||||
echo 'ex: http://127.0.0.1:3128'
|
||||
read PROXY_URI
|
||||
|
||||
if [ -n "${PROXY_URI}" ]; then
|
||||
curl -x ${PROXY_URI} -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
|
||||
if [ -n "${PROXY}" ]; then
|
||||
curl -x ${PROXY} -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
|
||||
else
|
||||
curl -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user