This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 19e2d70  fix: `make deps` should not require root. (#3500)
19e2d70 is described below

commit 19e2d70ec7f78f3c5539d8b580ab50316705ad22
Author: 罗泽轩 <spacewander...@gmail.com>
AuthorDate: Wed Feb 3 22:38:27 2021 +0800

    fix: `make deps` should not require root. (#3500)
---
 Makefile                        | 7 ++++++-
 utils/linux-install-luarocks.sh | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 473f74f..d1345c8 100644
--- a/Makefile
+++ b/Makefile
@@ -55,9 +55,14 @@ help: default
 .PHONY: deps
 deps: default
 ifeq ($(LUAROCKS_VER),luarocks 3.)
-       mkdir ~/.luarocks || true
+       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)
+else
+       luarocks config --local variables.OPENSSL_LIBDIR $(addprefix 
$(OR_PREFIX), openssl/lib)
+       luarocks config --local variables.OPENSSL_INCDIR $(addprefix 
$(OR_PREFIX), openssl/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:"
diff --git a/utils/linux-install-luarocks.sh b/utils/linux-install-luarocks.sh
index 92276e8..e1070df 100755
--- a/utils/linux-install-luarocks.sh
+++ b/utils/linux-install-luarocks.sh
@@ -16,6 +16,7 @@
 # limitations under the License.
 #
 
+# you might need sudo to run this script
 if [ -z ${OPENRESTY_PREFIX} ]; then
     OPENRESTY_PREFIX="/usr/local/openresty"
 fi

Reply via email to