From c92133a861ecc0b64bfa72196d7dda50d51913b3 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Fri, 19 Feb 2021 11:32:56 +0800 Subject: [PATCH 01/10] fix: use openssl111 in openresty dir in precedence --- Makefile | 18 ++++++++++++------ doc/install-dependencies.md | 3 ++- utils/linux-install-luarocks.sh | 11 +++++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1b6e98275c11..2d2e65c65bbb 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,12 @@ UNAME ?= $(shell uname) OR_EXEC ?= $(shell which openresty || which nginx) LUAROCKS_VER ?= $(shell luarocks --version | grep -E -o "luarocks [0-9]+.") OR_PREFIX ?= $(shell $(OR_EXEC) -V 2>&1 | grep -Eo 'prefix=(.*)/nginx\s+' | grep -Eo '/.*/') +OPENSSL_PREFIX ?= $(addprefix $(OR_PREFIX), openssl) + +# OpenResty 1.17.8 or higher version uses openssl111 as the openssl dirname. +ifeq ($(shell test -d $(addprefix $(OR_PREFIX), openssl111) && echo -n yes), yes) + OPENSSL_PREFIX=$(addprefix $(OR_PREFIX), openssl111) +endif SHELL := /bin/bash -o pipefail @@ -57,18 +63,18 @@ deps: default ifeq ($(LUAROCKS_VER),luarocks 3.) mkdir -p ~/.luarocks ifeq ($(shell whoami),root) - luarocks config variables.OPENSSL_LIBDIR $(addprefix $(OR_PREFIX), openssl/lib) - luarocks config variables.OPENSSL_INCDIR $(addprefix $(OR_PREFIX), openssl/include) + luarocks config variables.OPENSSL_LIBDIR $(addprefix $(OPENSSL_PREFIX), /lib) + luarocks config variables.OPENSSL_INCDIR $(addprefix $(OPENSSL_PREFIX), /include) else - luarocks config --local variables.OPENSSL_LIBDIR $(addprefix $(OR_PREFIX), openssl/lib) - luarocks config --local variables.OPENSSL_INCDIR $(addprefix $(OR_PREFIX), openssl/include) + luarocks config --local variables.OPENSSL_LIBDIR $(addprefix $(OPENSSL_PREFIX), /lib) + luarocks config --local variables.OPENSSL_INCDIR $(addprefix $(OPENSSL_PREFIX), /include) endif luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local else @echo "WARN: You're not using LuaRocks 3.x, please add the following items to your LuaRocks config file:" @echo "variables = {" - @echo " OPENSSL_LIBDIR=$(addprefix $(OR_PREFIX), openssl/lib)" - @echo " OPENSSL_INCDIR=$(addprefix $(OR_PREFIX), openssl/include)" + @echo " OPENSSL_LIBDIR=$(addprefix $(OPENSSL_PREFIX), /lib)" + @echo " OPENSSL_INCDIR=$(addprefix $(OPENSSL_PREFIX), /include)" @echo "}" luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local endif diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md index 464903e8bd3d..05ac858efe99 100644 --- a/doc/install-dependencies.md +++ b/doc/install-dependencies.md @@ -39,6 +39,8 @@ - On some platforms, installing LuaRocks via the package manager will cause Lua to be upgraded to Lua 5.3, so we recommend installing LuaRocks via source code. if you install OpenResty and its OpenSSL develop library (openresty-openssl-devel for rpm and openresty-openssl-dev for deb) via the official repository, then [we provide a script for automatic installation](../utils/linux-install-luarocks.sh). If you compile OpenResty yourself, you can refer to the above script and change the path in it. If you don't specify the OpenSSL library path when you compile, you don't need to configure the OpenSSL variables in LuaRocks, because the system's OpenSSL is used by default. If the OpenSSL library is specified at compile time, then you need to ensure that LuaRocks' OpenSSL configuration is consistent with OpenResty's. +- If you are using OpenResty/1.17.8 or higher version, please installing openresty-openssl111-devel instead of openresty-openssl-devel. + # CentOS 7 ```shell @@ -52,7 +54,6 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo yum install yum-utils sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo -# install OpenResty and some compilation tools sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip # install LuaRocks diff --git a/utils/linux-install-luarocks.sh b/utils/linux-install-luarocks.sh index 2456db0eb3a1..332945b46709 100755 --- a/utils/linux-install-luarocks.sh +++ b/utils/linux-install-luarocks.sh @@ -43,5 +43,12 @@ cd .. || exit rm -rf luarocks-3.4.0 mkdir ~/.luarocks || true -luarocks config variables.OPENSSL_LIBDIR ${OPENRESTY_PREFIX}/openssl/lib -luarocks config variables.OPENSSL_INCDIR ${OPENRESTY_PREFIX}/openssl/include + +# OpenResty 1.17.8 or higher version uses openssl111 as the openssl dirname. +OPENSSL_PREFIX=${OPENRESTY_PREFIX}/openssl +if [ -d ${OPENRESTY_PREFIX}/openssl111 ]; then + OPENSSL_PREFIX=${OPENRESTY_PREFIX}/openssl111 +fi + +luarocks config variables.OPENSSL_LIBDIR ${OPENSSL_PREFIX}/lib +luarocks config variables.OPENSSL_INCDIR ${OPENSSL_PREFIX}/include From d6bbcc197ccc504e836522f8aee4584c60b8fa78 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Fri, 19 Feb 2021 11:49:42 +0800 Subject: [PATCH 02/10] fix --- doc/install-dependencies.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md index 05ac858efe99..c7918b40dab9 100644 --- a/doc/install-dependencies.md +++ b/doc/install-dependencies.md @@ -54,6 +54,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo yum install yum-utils sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo +# install OpenResty and some compilation tools sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip # install LuaRocks From 22827880f46e50cc657371ed36a5ae76f412fa57 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Fri, 19 Feb 2021 14:51:24 +0800 Subject: [PATCH 03/10] fix --- doc/install-dependencies.md | 12 ++++++------ doc/zh-cn/install-dependencies.md | 12 +++++++----- utils/linux-install-openresty.sh | 23 +++++++++++++++++++++-- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md index c7918b40dab9..66008de4e8a3 100644 --- a/doc/install-dependencies.md +++ b/doc/install-dependencies.md @@ -37,9 +37,9 @@ - If it is OpenResty 1.19, APISIX will use OpenResty's built-in LuaJIT to run `bin/apisix`; otherwise it will use Lua 5.1. If you encounter `luajit: lj_asm_x86.h:2819: asm_loop_ fixup: Assertion '((intptr_t)target & 15) == 0' failed`, this is a problem with the low version of OpenResty's built-in LuaJIT under certain compilation conditions. -- On some platforms, installing LuaRocks via the package manager will cause Lua to be upgraded to Lua 5.3, so we recommend installing LuaRocks via source code. if you install OpenResty and its OpenSSL develop library (openresty-openssl-devel for rpm and openresty-openssl-dev for deb) via the official repository, then [we provide a script for automatic installation](../utils/linux-install-luarocks.sh). If you compile OpenResty yourself, you can refer to the above script and change the path in it. If you don't specify the OpenSSL library path when you compile, you don't need to configure the OpenSSL variables in LuaRocks, because the system's OpenSSL is used by default. If the OpenSSL library is specified at compile time, then you need to ensure that LuaRocks' OpenSSL configuration is consistent with OpenResty's. +- On some platforms, installing LuaRocks via the package manager will cause Lua to be upgraded to Lua 5.3, so we recommend installing LuaRocks via source code. if you install OpenResty and its OpenSSL develop library (openresty-openssl111-devel for rpm and openresty-openssl111-dev for deb) via the official repository, then [we provide a script for automatic installation](../utils/linux-install-luarocks.sh). If you compile OpenResty yourself, you can refer to the above script and change the path in it. If you don't specify the OpenSSL library path when you compile, you don't need to configure the OpenSSL variables in LuaRocks, because the system's OpenSSL is used by default. If the OpenSSL library is specified at compile time, then you need to ensure that LuaRocks' OpenSSL configuration is consistent with OpenResty's. -- If you are using OpenResty/1.17.8 or higher version, please installing openresty-openssl111-devel instead of openresty-openssl-devel. +- WARNING: If you are using OpenResty which is older than `1.17.8`, please installing openresty-openss-devel instead of openresty-openssl111-devel. # CentOS 7 @@ -55,7 +55,7 @@ sudo yum install yum-utils sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo # install OpenResty and some compilation tools -sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip +sudo yum install -y openresty curl git gcc openresty-openssl111-devel unzip # install LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - @@ -78,7 +78,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # install OpenResty and some compilation tools -sudo yum install -y openresty curl git gcc openresty-openssl-devel +sudo yum install -y openresty curl git gcc openresty-openssl111-devel # install LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - @@ -104,7 +104,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # install OpenResty and some compilation tools -sudo apt-get install -y git openresty curl openresty-openssl-dev +sudo apt-get install -y git openresty curl openresty-openssl111-dev # install LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - @@ -135,7 +135,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # install OpenResty and some compilation tools -sudo apt-get install -y git openresty curl make openresty-openssl-dev +sudo apt-get install -y git openresty curl make openresty-openssl111-dev # install LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - diff --git a/doc/zh-cn/install-dependencies.md b/doc/zh-cn/install-dependencies.md index 8e986c96b640..f58855627362 100644 --- a/doc/zh-cn/install-dependencies.md +++ b/doc/zh-cn/install-dependencies.md @@ -36,7 +36,9 @@ - 如果是 OpenResty 1.19,APISIX 会使用 OpenResty 内置的 LuaJIT 来运行 `bin/apisix`;否则会使用 Lua 5.1。如果运行过程中遇到 `luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion '((intptr_t)target & 15) == 0' failed`,这是低版本 OpenResty 内置的 LuaJIT 在特定编译条件下的问题。 -- 在某些平台上,通过包管理器安装 LuaRocks 会导致 Lua 被升级为 Lua 5.3,所以我们建议通过源代码的方式安装 LuaRocks。如果你通过官方仓库安装 OpenResty 和 OpenResty 的 OpenSSL 开发库(rpm 版本:openresty-openssl-devel,deb 版本:openresty-openssl-dev),那么 [我们提供了自动安装的脚本](../../utils/linux-install-luarocks.sh)。如果你是自己编译的 OpenResty,可以参考上述脚本并修改里面的路径。如果编译时没有指定 OpenSSL 库的路径,那么无需配置 LuaRocks 内跟 OpenSSL 相关的变量,因为默认都是用的系统自带的 OpenSSL。如果编译时指定了 OpenSSL 库,那么需要保证 LuaRocks 的 OpenSSL 配置跟 OpenResty 的相一致。 +- 在某些平台上,通过包管理器安装 LuaRocks 会导致 Lua 被升级为 Lua 5.3,所以我们建议通过源代码的方式安装 LuaRocks。如果你通过官方仓库安装 OpenResty 和 OpenResty 的 OpenSSL 开发库(rpm 版本:openresty-openssl111-devel,deb 版本:openresty-openssl111-dev),那么 [我们提供了自动安装的脚本](../../utils/linux-install-luarocks.sh)。如果你是自己编译的 OpenResty,可以参考上述脚本并修改里面的路径。如果编译时没有指定 OpenSSL 库的路径,那么无需配置 LuaRocks 内跟 OpenSSL 相关的变量,因为默认都是用的系统自带的 OpenSSL。如果编译时指定了 OpenSSL 库,那么需要保证 LuaRocks 的 OpenSSL 配置跟 OpenResty 的相一致。 + +- 警告:如果你正在使用低于 `1.17.8` 的 OpenResty 版本,请安装 openresty-openssl-devel,而不是 openresty-openssl111-devel。 # CentOS 7 @@ -52,7 +54,7 @@ sudo yum install yum-utils sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo # 安装 OpenResty 和 编译工具 -sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip +sudo yum install -y openresty curl git gcc openresty-openssl111-devel unzip # 安装 LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - @@ -75,7 +77,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # 安装 OpenResty 和 编译工具 -sudo yum install -y openresty curl git gcc openresty-openssl-devel +sudo yum install -y openresty curl git gcc openresty-openssl111-devel # 安装 LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - @@ -101,7 +103,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # 安装 OpenResty 和 编译工具 -sudo apt-get install -y git openresty curl openresty-openssl-dev +sudo apt-get install -y git openresty curl openresty-openssl111-dev # 安装 LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - @@ -132,7 +134,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # 安装 OpenResty 和 编译工具 -sudo apt-get install -y git openresty curl make openresty-openssl-dev +sudo apt-get install -y git openresty curl make openresty-openssl111-dev # 安装 LuaRocks curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index 4d4d3bc7ab86..de68e571491e 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -70,7 +70,7 @@ if [ "$OPENRESTY_VERSION" == "source" ]; then make sudo make install - sudo apt-get install openresty-openssl-debug-dev + sudo apt-get install openresty-openssl111-debug-dev exit 0 fi @@ -80,4 +80,23 @@ else openresty="openresty-debug=$OPENRESTY_VERSION*" fi -sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev openresty-openssl-debug-dev +verlte() { + [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] +} + +verlt() { + [ "$1" = "$2" ] && return 1 || verlte $1 $2 +} + +sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev + +if [ $OPENRESTY_VERSION == "default" ]; then + sudo apt-get install openresty-openssl111-debug-dev +else + verlt $OPENRESTY_VERSION 1.17.8 + if [ $? -eq 0 ]; then + sudo apt-get install openresty-openssl-debug-dev + else + sudo apt-get install openresty-openssl111-debug-dev + fi +fi From 0f53b319eec51abafa13a793d894797b16237101 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Fri, 19 Feb 2021 19:30:48 +0800 Subject: [PATCH 04/10] fix --- utils/centos7-ci.sh | 2 +- utils/linux-install-openresty.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/centos7-ci.sh b/utils/centos7-ci.sh index d0065ac00c97..5ca6ef54224a 100755 --- a/utils/centos7-ci.sh +++ b/utils/centos7-ci.sh @@ -27,7 +27,7 @@ install_dependencies() { # install openresty yum install -y yum-utils && yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo - yum install -y openresty-debug openresty-openssl-debug-devel + yum install -y openresty-debug openresty-openssl111-debug-devel # install luarocks ./utils/linux-install-luarocks.sh diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index de68e571491e..fcf5d0796681 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -93,7 +93,7 @@ sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev if [ $OPENRESTY_VERSION == "default" ]; then sudo apt-get install openresty-openssl111-debug-dev else - verlt $OPENRESTY_VERSION 1.17.8 + verlt $OPENRESTY_VERSION 1.17.8.1 if [ $? -eq 0 ]; then sudo apt-get install openresty-openssl-debug-dev else From 45994203581b807aabea9d01f2d5194e1bc13286 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Fri, 19 Feb 2021 20:27:58 +0800 Subject: [PATCH 05/10] fix and debug --- .github/workflows/fuzzing-ci.yaml | 2 +- utils/linux-install-openresty.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fuzzing-ci.yaml b/.github/workflows/fuzzing-ci.yaml index 125ea983781d..1b27660c4ee3 100644 --- a/.github/workflows/fuzzing-ci.yaml +++ b/.github/workflows/fuzzing-ci.yaml @@ -36,7 +36,7 @@ jobs: sudo apt-get -y install software-properties-common sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" sudo apt-get update - sudo apt-get install -y git openresty curl openresty-openssl-dev unzip make gcc + sudo apt-get install -y git openresty curl openresty-openssl111-dev unzip make gcc ./utils/linux-install-luarocks.sh make deps diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index fcf5d0796681..1ec8372945a6 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -88,15 +88,22 @@ verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 } +echo "before install openresty" + sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev +echo "after install openresty" + if [ $OPENRESTY_VERSION == "default" ]; then + echo "install openresty-openssl111 default" sudo apt-get install openresty-openssl111-debug-dev else verlt $OPENRESTY_VERSION 1.17.8.1 if [ $? -eq 0 ]; then + echo "install openresty-openssl" sudo apt-get install openresty-openssl-debug-dev else + echo "install openresty-openssl111-debug" sudo apt-get install openresty-openssl111-debug-dev fi fi From 865974e91e30e0a804ffa0564900eac545628774 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Sat, 20 Feb 2021 09:28:55 +0800 Subject: [PATCH 06/10] fix --- utils/linux-install-openresty.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index 1ec8372945a6..b82af94cc085 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -88,22 +88,15 @@ verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 } -echo "before install openresty" - sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev -echo "after install openresty" - -if [ $OPENRESTY_VERSION == "default" ]; then - echo "install openresty-openssl111 default" +if [ "$OPENRESTY_VERSION" == "default" ]; then sudo apt-get install openresty-openssl111-debug-dev else verlt $OPENRESTY_VERSION 1.17.8.1 if [ $? -eq 0 ]; then - echo "install openresty-openssl" sudo apt-get install openresty-openssl-debug-dev else - echo "install openresty-openssl111-debug" sudo apt-get install openresty-openssl111-debug-dev fi fi From 3adecb0387ec5fc56af26730a2982f31e428e030 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Sat, 20 Feb 2021 09:51:33 +0800 Subject: [PATCH 07/10] fix --- utils/linux-install-openresty.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index b82af94cc085..82b5210022ca 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -88,6 +88,7 @@ verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 } +echo "OR: $openresty" sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev if [ "$OPENRESTY_VERSION" == "default" ]; then From b405834de4deae12c788d0efabf89e591055b395 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Sat, 20 Feb 2021 09:52:16 +0800 Subject: [PATCH 08/10] debug --- utils/linux-install-openresty.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index 82b5210022ca..29d947578f09 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -15,7 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -set -euo pipefail +# set -euo pipefail +set -uo pipefail wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add - sudo apt-get -y update --fix-missing From ae0358d15bf908ba84a79ffeaa37206b30b881b6 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Sat, 20 Feb 2021 10:31:40 +0800 Subject: [PATCH 09/10] fix --- utils/linux-install-openresty.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index 29d947578f09..9d37e70f58f6 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -89,7 +89,6 @@ verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 } -echo "OR: $openresty" sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev if [ "$OPENRESTY_VERSION" == "default" ]; then From e7cf710fb5bd0998f9253455f74640d28b91b2e7 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Sat, 20 Feb 2021 13:34:41 +0800 Subject: [PATCH 10/10] fix --- utils/linux-install-openresty.sh | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index 9d37e70f58f6..6bdde1f25428 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -15,8 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# set -euo pipefail -set -uo pipefail +set -euo pipefail wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add - sudo apt-get -y update --fix-missing @@ -81,23 +80,10 @@ else openresty="openresty-debug=$OPENRESTY_VERSION*" fi -verlte() { - [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] -} - -verlt() { - [ "$1" = "$2" ] && return 1 || verlte $1 $2 -} - sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev -if [ "$OPENRESTY_VERSION" == "default" ]; then - sudo apt-get install openresty-openssl111-debug-dev +if [ "$OPENRESTY_VERSION" == "1.15.8.2" ]; then + sudo apt-get install openresty-openssl-debug-dev else - verlt $OPENRESTY_VERSION 1.17.8.1 - if [ $? -eq 0 ]; then - sudo apt-get install openresty-openssl-debug-dev - else - sudo apt-get install openresty-openssl111-debug-dev - fi + sudo apt-get install openresty-openssl111-debug-dev fi