这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ensure-environment() {
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
fi

hostname -f >/dev/null 2>&1 || {
hostname -f &>/dev/null || {
log-fail "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/dokku_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn-dokku-host() {
declare DOKKU_GIT_REMOTE="$1" DOKKU_HOST="$2"

if [[ -z "$DOKKU_HOST" ]]; then
if [[ -d .git ]] || git rev-parse --git-dir >/dev/null 2>&1; then
if [[ -d .git ]] || git rev-parse --git-dir &>/dev/null; then
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
fi
fi
Expand Down Expand Up @@ -109,7 +109,7 @@ main() {
fi

if [[ -z "$APP" ]]; then
if [[ -d .git ]] || git rev-parse --git-dir >/dev/null 2>&1; then
if [[ -d .git ]] || git rev-parse --git-dir &>/dev/null; then
set +e
APP=$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
set -e
Expand Down
2 changes: 1 addition & 1 deletion docs/development/plugin-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ if ! command -v "nginx" &>/dev/null; then
fi

# `which` example
if ! which nginx >/dev/null 2>&1; then
if ! which nginx &>/dev/null; then
dokku_log_fail "Missing nginx, install it"
fi
```
Expand Down
2 changes: 1 addition & 1 deletion docs/development/plugin-triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
dokku_log_info1 "Installing GraphicsMagick..."

CMD="cat > gm && \
dpkg -s graphicsmagick >/dev/null 2>&1 || \
dpkg -s graphicsmagick &>/dev/null || \
(apt-get update -qq && apt-get -qq -y --no-install-recommends install graphicsmagick && apt-get clean)"

CID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
Expand Down
2 changes: 1 addition & 1 deletion dokku
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export DOKKU_HOST_ROOT=${DOKKU_HOST_ROOT:=$DOKKU_ROOT}

export DOKKU_DISTRO
DOKKU_DISTRO=$(
. /etc/os-release >/dev/null 2>&1 || true
. /etc/os-release &>/dev/null || true
echo "$ID"
)

Expand Down
2 changes: 1 addition & 1 deletion plugins/20_events/install
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $DOKKU_LOGS_DIR/*.log {
compress
delaycompress
postrotate
reload rsyslog >/dev/null 2>&1 || true
reload rsyslog &>/dev/null || true
endscript
create 664 syslog dokku
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builder-herokuish/builder-build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn-builder-herokuish-ensure-cache() {

existing_cache="$("$DOCKER_BIN" volume ls --quiet --filter label=com.dokku.app-name=test --filter label=com.dokku.builder-type=herokuish)"
if [[ "$existing_cache" != "cache-$APP" ]]; then
"$DOCKER_BIN" volume rm "cache-$APP" >/dev/null 2>&1 || true
"$DOCKER_BIN" volume rm "cache-$APP" &>/dev/null || true
"$DOCKER_BIN" volume create "--label=org.label-schema.schema-version=1.0" "--label=org.label-schema.vendor=dokku" "--label=com.dokku.app-name=$APP" "--label=com.dokku.builder-type=herokuish" "cache-$APP" >/dev/null
fi
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builder-herokuish/post-app-rename-setup
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trigger-builder-herokuish-post-app-clone-setup() {
local OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache"
local OLD_CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$OLD_APP/cache"

if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR" >/dev/null 2>&1; then
if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR" &>/dev/null; then
local DOCKER_RUN_LABEL_ARGS="--label=com.dokku.app-name=$NEW_APP"
"$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --rm --volume "$OLD_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
fi
Expand Down
2 changes: 1 addition & 1 deletion plugins/common/functions
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ copy_from_image() {
fi

TMP_FILE_COMMAND_OUTPUT=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$TMP_FILE_COMMAND_OUTPUT' >/dev/null 2>&1 || true" RETURN
trap "rm -rf '$TMP_FILE_COMMAND_OUTPUT' &>/dev/null || true" RETURN

local CID=$("$DOCKER_BIN" container create "${DOCKER_CREATE_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS "$IMAGE")
"$DOCKER_BIN" container cp "$CID:$SRC_FILE" "$TMP_FILE_COMMAND_OUTPUT" 2>/dev/null || true
Expand Down
8 changes: 4 additions & 4 deletions plugins/git/functions
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ git_build_app_repo() {
chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR"
unset GIT_DIR GIT_QUARANTINE_PATH GIT_WORK_TREE

! plugn trigger app-exists "$APP" >/dev/null 2>&1 && plugn trigger app-maybe-create "$APP"
! plugn trigger app-exists "$APP" &>/dev/null && plugn trigger app-maybe-create "$APP"

fn-git-setup-build-dir "$APP" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
pushd "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" >/dev/null
Expand Down Expand Up @@ -79,7 +79,7 @@ cmd-git-hook() {
plugn trigger app-exists "$APP" 2>/dev/null || is_valid_app_name "$APP"

DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then
if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then
echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via deploy-branch setting."
echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'"
return
Expand Down Expand Up @@ -165,7 +165,7 @@ cmd-git-upload-pack() {

APP="$(echo "$APP" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
is_valid_app_name "$APP"
! plugn trigger app-exists "$APP" >/dev/null 2>&1 && plugn trigger app-maybe-create "$APP"
! plugn trigger app-exists "$APP" &>/dev/null && plugn trigger app-maybe-create "$APP"

plugn trigger git-pre-pull "$APP"
cat | git-upload-pack "$DOKKU_ROOT/$APP"
Expand All @@ -180,7 +180,7 @@ cmd-git-glob() {

plugn trigger app-exists "$APP" 2>/dev/null || is_valid_app_name "$APP"
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
! plugn trigger app-exists "$APP" >/dev/null 2>&1 && plugn trigger app-maybe-create "$APP"
! plugn trigger app-exists "$APP" &>/dev/null && plugn trigger app-maybe-create "$APP"

fn-git-create-hook "$APP"
fi
Expand Down
6 changes: 3 additions & 3 deletions plugins/git/internal-functions
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ fn-git-clone() {
fn-git-cmd "$APP_CLONE_ROOT" checkout -qq "$GIT_REF"
else
GIT_TERMINAL_PROMPT=0 suppress_output git clone -n --branch "$GIT_REF" "$GIT_REMOTE" "$APP_CLONE_ROOT"
if fn-git-cmd "$APP_CLONE_ROOT" show-ref --verify "refs/heads/$GIT_REF" >/dev/null 2>&1; then
if fn-git-cmd "$APP_CLONE_ROOT" show-ref --verify "refs/heads/$GIT_REF" &>/dev/null; then
dokku_log_verbose "Detected branch, setting deploy-branch to $GIT_REF"
fn-plugin-property-write "git" "$APP" "deploy-branch" "$GIT_REF"
fi
Expand Down Expand Up @@ -450,13 +450,13 @@ fn-git-fetch() {
fi

DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
if ! fn-git-cmd "$APP_ROOT" check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then
if ! fn-git-cmd "$APP_ROOT" check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" &>/dev/null; then
dokku_log_warn "Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via deploy-branch setting."
dokku_log_warn "For more details, please see the man page for 'git-check-ref-format.'"
return
fi

fn-git-cmd "$APP_ROOT" remote rm remote >/dev/null 2>&1 || true
fn-git-cmd "$APP_ROOT" remote rm remote &>/dev/null || true
fn-git-cmd "$APP_ROOT" remote add --mirror=fetch --no-tags remote "$GIT_REMOTE"
if [[ -z "$GIT_REF" ]]; then
GIT_TERMINAL_PROMPT=0 fn-git-cmd "$APP_ROOT" fetch --update-head-ok remote "$DOKKU_DEPLOY_BRANCH"
Expand Down
4 changes: 2 additions & 2 deletions plugins/nginx-vhosts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ validate_nginx() {
fi

set +e
sudo "$NGINX_LOCATION" -t >/dev/null 2>&1
sudo "$NGINX_LOCATION" -t &>/dev/null
EXIT_CODE=$?
set -e
if [[ "$EXIT_CODE" -eq "0" ]]; then
Expand All @@ -115,7 +115,7 @@ validate_nginx() {
fi

set +e
sudo "$NGINX_LOCATION" -t >/dev/null 2>&1
sudo "$NGINX_LOCATION" -t &>/dev/null
EXIT_CODE=$?
set -e
if [[ "$EXIT_CODE" -eq "0" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion plugins/scheduler-docker-local/core-post-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ trigger-scheduler-docker-local-core-post-deploy() {
if [[ "$PREVIOUS_CONTAINER_STATUS" != "dead" ]]; then
local CONTAINER_DATE_NAME="$NAME.$(date +%s)"
dokku_log_verbose_quiet "Renaming container ($cid) ${NAME} to $CONTAINER_DATE_NAME"
"$DOCKER_BIN" container rename "$NAME" "$CONTAINER_DATE_NAME" >/dev/null 2>&1 || dokku_log_warn "Unable to rename container"
"$DOCKER_BIN" container rename "$NAME" "$CONTAINER_DATE_NAME" &>/dev/null || dokku_log_warn "Unable to rename container"
fi
done
fi
Expand Down
6 changes: 3 additions & 3 deletions plugins/scheduler-docker-local/internal-functions
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn-scheduler-docker-local-retire-container() {
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"

if [[ "$STATE" == "restarting" ]]; then
"$DOCKER_BIN" container update --restart=no "$CID" >/dev/null 2>&1
"$DOCKER_BIN" container update --restart=no "$CID" &>/dev/null
fi

if [[ "$STATE" != "dead" ]] && [[ "$STATE" != "exited" ]]; then
Expand Down Expand Up @@ -142,8 +142,8 @@ fn-scheduler-docker-local-retire-containers() {
continue
fi

"$DOCKER_BIN" container rm --force "$CID" >/dev/null 2>&1 || true
if "$DOCKER_BIN" container inspect "${CID}" >/dev/null 2>&1; then
"$DOCKER_BIN" container rm --force "$CID" &>/dev/null || true
if "$DOCKER_BIN" container inspect "${CID}" &>/dev/null; then
dokku_log_warn "Container ${CID} still running"
continue
fi
Expand Down
2 changes: 1 addition & 1 deletion plugins/scheduler-docker-local/scheduler-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ trigger-scheduler-docker-local-scheduler-deploy() {
trap '' INT HUP
sleep "$DOKKU_WAIT_TO_RETIRE"
for oldid in $oldids; do
if ! docker container inspect "$oldid" >/dev/null 2>&1; then
if ! docker container inspect "$oldid" &>/dev/null; then
continue
fi
# Disable the container restart policy
Expand Down
2 changes: 1 addition & 1 deletion plugins/scheduler-docker-local/scheduler-logs-failed
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trigger-scheduler-docker-local-scheduler-logs-failed() {
while read -r LINE || [[ -n "$LINE" ]]; do
CID="$(echo "$LINE" | cut -d ' ' -f1)"
PREFIX="$(echo "$LINE" | cut -d ' ' -f2)"
if "$DOCKER_BIN" container inspect "${CID}" >/dev/null 2>&1; then
if "$DOCKER_BIN" container inspect "${CID}" &>/dev/null; then
RUNNING_CONTAINERS+=("$CID")
else
DEAD_CONTAINERS+=("$CID")
Expand Down
2 changes: 1 addition & 1 deletion plugins/scheduler-docker-local/scheduler-stop
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ trigger-scheduler-docker-local-scheduler-stop() {
plugn trigger scheduler-register-retired "$APP" "$CID"
done

"$DOCKER_BIN" container rm --force $DOKKU_APP_CIDS >/dev/null 2>&1 || true
"$DOCKER_BIN" container rm --force $DOKKU_APP_CIDS &>/dev/null || true
fi
fi
}
Expand Down
4 changes: 2 additions & 2 deletions tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ else
endif

shellcheck:
ifneq ($(shell shellcheck --version >/dev/null 2>&1 ; echo $$?),0)
ifneq ($(shell shellcheck --version >/dev/null 2>&1; echo $$?),0)
ifeq ($(SYSTEM),Darwin)
brew install shellcheck
else
Expand All @@ -22,7 +22,7 @@ endif
endif

shfmt:
ifneq ($(shell shfmt --version >/dev/null 2>&1 ; echo $$?),0)
ifneq ($(shell shfmt --version >/dev/null 2>&1; echo $$?),0)
ifeq ($(shfmt),Darwin)
brew install shfmt
else
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ check_container() {
while true; do
echo "$(date) [count: $cnt]: waiting for dokku startup"
is_up=$(
docker exec dokku ps -ef | grep "/usr/sbin/sshd -D" >/dev/null 2>&1
docker exec dokku ps -ef | grep "/usr/sbin/sshd -D" &>/dev/null
echo $?
)
if [[ $is_up -eq 0 ]]; then
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ setup_test_tls() {
local TLS_TYPE="$1"
local TLS="/home/dokku/$TEST_APP/tls"

if ! dokku apps:exists "$TEST_APP" >/dev/null 2>&1; then
if ! dokku apps:exists "$TEST_APP" &>/dev/null; then
create_app "$TEST_APP"
fi
mkdir -p "$TLS"
Expand Down