@@ -57,6 +57,7 @@ mkdir -p bin/
5757mkdir -p runtime/
5858mkdir -p var/runtime
5959APP_RUNTIME_DIR=${__PROJECT__} /runtime/php
60+ test -f ${__PROJECT__} /runtime/php && rm -f ${__PROJECT__} /runtime/php
6061mkdir -p ${APP_RUNTIME_DIR}
6162
6263cd ${__PROJECT__} /var/runtime
@@ -70,10 +71,12 @@ if [ $OS = 'windows' ]; then
7071fi
7172
7273MIRROR=' '
74+ CURL_OPTIONS=" "
7375while [ $# -gt 0 ]; do
7476 case " $1 " in
7577 --mirror)
7678 MIRROR=" $2 "
79+ CURL_OPTIONS+=" -H 'Referer: https://www.swoole.com/download' -H 'User-Agent: download swoole-cli runtime with setup-php-runtime.sh' -H 'X-Auth-Token: 6F0A7F038A69'"
7780 ;;
7881 --proxy)
7982 export HTTP_PROXY=" $2 "
@@ -103,6 +106,13 @@ china)
103106
104107esac
105108
109+ downloader () {
110+ local file=$1
111+ local url=$2
112+ local cmd=$( echo " curl $CURL_OPTIONS -fSLo $file $url " )
113+ eval $cmd
114+ }
115+
106116test -f composer.phar || curl -fSLo composer.phar ${COMPOSER_DOWNLOAD_URL}
107117chmod a+x composer.phar
108118
@@ -113,13 +123,13 @@ APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}"
113123if [ $OS = ' windows' ]; then
114124 {
115125 APP_RUNTIME=" ${APP_NAME} -${APP_VERSION} -cygwin-${ARCH} "
116- test -f ${APP_RUNTIME} .zip || curl -fSLo ${APP_RUNTIME} .zip ${APP_DOWNLOAD_URL}
126+ test -f ${APP_RUNTIME} .zip || downloader ${APP_RUNTIME} .zip ${APP_DOWNLOAD_URL}
117127 test -d ${APP_RUNTIME} && rm -rf ${APP_RUNTIME}
118128 unzip " ${APP_RUNTIME} .zip"
119129 exit 0
120130 }
121131else
122- test -f ${APP_RUNTIME} .tar.xz || curl -fSLo ${APP_RUNTIME} .tar.xz ${APP_DOWNLOAD_URL}
132+ test -f ${APP_RUNTIME} .tar.xz || downloader ${APP_RUNTIME} .tar.xz ${APP_DOWNLOAD_URL}
123133 test -f ${APP_RUNTIME} .tar || xz -d -k ${APP_RUNTIME} .tar.xz
124134 test -f swoole-cli && rm -f swoole-cli
125135 tar -xvf ${APP_RUNTIME} .tar
0 commit comments