Merge pull request #4890 from dokku/drop-which

Drop which in favor of command -v
This commit is contained in:
Jose Diaz-Gonzalez
2021-10-28 19:10:34 -04:00
committed by GitHub
7 changed files with 7 additions and 8 deletions

View File

@@ -160,7 +160,7 @@ main() {
} }
} }
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(command -v dokku) ]]; then
main "$@" main "$@"
exit $? exit $?
fi fi

View File

@@ -6,7 +6,7 @@ if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(hostname -f)") ]] && hostname -f >"$DOKKU_ROOT/VHOST" [[ $(dig +short "$(hostname -f)") ]] && hostname -f >"$DOKKU_ROOT/VHOST"
fi fi
dokku_path="$(which dokku)" dokku_path="$(command -v dokku)"
# temporary hack for https://github.com/dokku/dokku/issues/82 # temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot # redeploys all apps after a reboot

View File

@@ -7,7 +7,7 @@ nginx_needs_upgrade() {
local MAJOR_VERSION MINOR_VERSION local MAJOR_VERSION MINOR_VERSION
local NEEDS_UPGRADE=true local NEEDS_UPGRADE=true
if ! which nginx >/dev/null 2>&1; then if ! command -v nginx &>/dev/null; then
echo $NEEDS_UPGRADE echo $NEEDS_UPGRADE
return return
fi fi
@@ -45,7 +45,7 @@ trigger-nginx-vhosts-dependencies() {
return return
fi fi
if ! which nginx >/dev/null 2>&1; then if ! command -v nginx &>/dev/null; then
nginx_install nginx_install
return return
fi fi

View File

@@ -75,7 +75,7 @@ fn-nginx-vhosts-nginx-location() {
declare desc="check that nginx is at the expected location and return it" declare desc="check that nginx is at the expected location and return it"
local NGINX_LOCATION local NGINX_LOCATION
NGINX_LOCATION=$(which nginx 2>/dev/null) NGINX_LOCATION=$(command -v nginx 2>/dev/null)
if [[ -z "$NGINX_LOCATION" ]]; then if [[ -z "$NGINX_LOCATION" ]]; then
NGINX_LOCATION="/usr/sbin/nginx" NGINX_LOCATION="/usr/sbin/nginx"
fi fi

View File

@@ -14,7 +14,7 @@ trigger-scheduler-docker-local-install() {
fn-plugin-property-setup "scheduler-docker-local" fn-plugin-property-setup "scheduler-docker-local"
DOKKU_PATH="$(which dokku)" DOKKU_PATH="$(command -v dokku)"
if [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then if [[ $(systemctl 2>/dev/null) =~ -\.mount ]]; then
cat <<EOF >/etc/systemd/system/dokku-retire.service cat <<EOF >/etc/systemd/system/dokku-retire.service

View File

@@ -26,7 +26,6 @@
# SC2207 - Prefer mapfile or read -a to split command output (or quote to avoid splitting) - https://github.com/koalaman/shellcheck/wiki/SC2207 # SC2207 - Prefer mapfile or read -a to split command output (or quote to avoid splitting) - https://github.com/koalaman/shellcheck/wiki/SC2207
# SC2219 - Instead of 'let expr', prefer (( expr )) - https://github.com/koalaman/shellcheck/wiki/SC2219 # SC2219 - Instead of 'let expr', prefer (( expr )) - https://github.com/koalaman/shellcheck/wiki/SC2219
# SC2220 - Invalid flags are not handled. Add a *) case - https://github.com/koalaman/shellcheck/wiki/SC2220 # SC2220 - Invalid flags are not handled. Add a *) case - https://github.com/koalaman/shellcheck/wiki/SC2220
# SC2230 - which is non-standard. Use builtin 'command -v' instead - https://github.com/koalaman/shellcheck/wiki/SC2230
# SC2231 - Quote expansions in this for loop glob to prevent wordsplitting, e.g. "$dir"/*.txt - https://github.com/koalaman/shellcheck/wiki/SC2231 # SC2231 - Quote expansions in this for loop glob to prevent wordsplitting, e.g. "$dir"/*.txt - https://github.com/koalaman/shellcheck/wiki/SC2231
# SC2235 - Use { ..; } instead of (..) to avoid subshell overhead - https://github.com/koalaman/shellcheck/wiki/SC2235 # SC2235 - Use { ..; } instead of (..) to avoid subshell overhead - https://github.com/koalaman/shellcheck/wiki/SC2235
# SC2267 - GNU xargs -i is deprecated in favor of -I{} - https://github.com/koalaman/shellcheck/wiki/SC2267 # SC2267 - GNU xargs -i is deprecated in favor of -I{} - https://github.com/koalaman/shellcheck/wiki/SC2267

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -xeo pipefail set -xeo pipefail
SELF=$(which "$0") SELF=$(command -v "$0")
APP="$1" APP="$1"
TARGET="$2" TARGET="$2"
FORWARDED_PORT="$3" FORWARDED_PORT="$3"