You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/04/02 00:58:53 UTC

[apisix] branch master updated: feat: use `command -v` instead of `which` to find the installed path. (#6778)

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

spacewander 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 97bcb56  feat: use `command -v` instead of `which` to find the installed path. (#6778)
97bcb56 is described below

commit 97bcb565075e59372842973844216c129af5d812
Author: mango <35...@users.noreply.github.com>
AuthorDate: Sat Apr 2 08:58:45 2022 +0800

    feat: use `command -v` instead of `which` to find the installed path. (#6778)
---
 Makefile                      | 2 +-
 bin/apisix                    | 2 +-
 ci/centos7-ci.sh              | 2 +-
 utils/install-dependencies.sh | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 36f659c..00f3988 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ ENV_RM                 ?= rm -vf
 ENV_DOCKER             ?= docker
 ENV_DOCKER_COMPOSE     ?= docker-compose --project-directory $(CURDIR) -p $(project_name) -f $(project_compose_ci)
 ENV_NGINX              ?= $(ENV_NGINX_EXEC) -p $(CURDIR) -c $(CURDIR)/conf/nginx.conf
-ENV_NGINX_EXEC         := $(shell which openresty 2>/dev/null || which nginx 2>/dev/null)
+ENV_NGINX_EXEC         := $(shell command -v openresty 2>/dev/null || command -v nginx 2>/dev/null)
 ENV_OPENSSL_PREFIX     ?= $(addprefix $(ENV_NGINX_PREFIX), openssl)
 ENV_LUAROCKS           ?= luarocks
 ## These variables can be injected by luarocks
diff --git a/bin/apisix b/bin/apisix
index d83b0ce..409ece5 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -29,7 +29,7 @@ else
 fi
 
 # find the openresty
-OR_BIN=$(which openresty || exit 1)
+OR_BIN=$(command -v openresty || exit 1)
 OR_EXEC=${OR_BIN:-'/usr/local/openresty-debug/bin/openresty'}
 OR_VER=$(openresty -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1"."$2}')
 LUA_VERSION=$(lua -v 2>&1| grep -E -o  "Lua [0-9]+.[0-9]+")
diff --git a/ci/centos7-ci.sh b/ci/centos7-ci.sh
index e29d401..1eefc14 100755
--- a/ci/centos7-ci.sh
+++ b/ci/centos7-ci.sh
@@ -23,7 +23,7 @@ install_dependencies() {
 
     # install development tools
     yum install -y wget tar gcc automake autoconf libtool make unzip \
-        git which sudo openldap-devel
+        git sudo openldap-devel
 
     # curl with http2
     wget https://github.com/moparisthebest/static-curl/releases/download/v7.79.1/curl-amd64 -O /usr/bin/curl
diff --git a/utils/install-dependencies.sh b/utils/install-dependencies.sh
index d4ebd36..fc0b03d 100755
--- a/utils/install-dependencies.sh
+++ b/utils/install-dependencies.sh
@@ -20,9 +20,9 @@
 set -ex
 
 function detect_aur_helper() {
-    if [[ $(which yay) ]]; then
+    if [[ $(command -v yay) ]]; then
         AUR_HELPER=yay
-    elif [[ $(which pacaur) ]]; then
+    elif [[ $(command -v pacaur) ]]; then
         AUR_HELPER=pacaur
     else
         echo No available AUR helpers found. Please specify your AUR helper by AUR_HELPER.