mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #38527 from thaJeztah/bash_the_bashisms
Shell scripts: remove bashisms and fix bare variables
This commit is contained in:
commit
5d5798c7cc
30 changed files with 97 additions and 97 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# DinD: a wrapper script which allows docker to be run inside a docker container.
|
||||
|
@ -13,7 +13,7 @@ set -e
|
|||
# apparmor sucks and Docker needs to know that it's in a container (c) @tianon
|
||||
export container=docker
|
||||
|
||||
if [[ -d /sys/kernel/security ]] && ! mountpoint -q /sys/kernel/security; then
|
||||
if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
|
||||
mount -t securityfs none /sys/kernel/security || {
|
||||
echo >&2 'Could not mount /sys/kernel/security.'
|
||||
echo >&2 'AppArmor detection and --privileged mode might break.'
|
||||
|
@ -25,7 +25,7 @@ if ! mountpoint -q /tmp; then
|
|||
mount -t tmpfs none /tmp
|
||||
fi
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
if [ $# -gt 0 ]; then
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ TMP_GOPATH=${TMP_GOPATH:-""}
|
|||
|
||||
: ${PREFIX:="/usr/local/bin"}
|
||||
|
||||
if [[ -z "$TMP_GOPATH" ]]; then
|
||||
if [ -z "$TMP_GOPATH" ]; then
|
||||
export GOPATH="$(mktemp -d)"
|
||||
RM_GOPATH=1
|
||||
else
|
||||
|
@ -21,7 +21,7 @@ dir="$(dirname $0)"
|
|||
bin=$1
|
||||
shift
|
||||
|
||||
if [[ ! -f "${dir}/${bin}.installer" ]]; then
|
||||
if [ ! -f "${dir}/${bin}.installer" ]; then
|
||||
echo "Could not find installer for \"$bin\""
|
||||
exit 1
|
||||
fi
|
||||
|
|
30
hack/make.sh
30
hack/make.sh
|
@ -31,17 +31,17 @@ export PKG_CONFIG=${PKG_CONFIG:-pkg-config}
|
|||
# We're a nice, sexy, little shell script, and people might try to run us;
|
||||
# but really, they shouldn't. We want to be in a container!
|
||||
inContainer="AssumeSoInitially"
|
||||
if [[ "$(go env GOHOSTOS)" = 'windows' ]]; then
|
||||
if [[ -z "$FROM_DOCKERFILE" ]]; then
|
||||
if [ "$(go env GOHOSTOS)" = 'windows' ]; then
|
||||
if [ -z "$FROM_DOCKERFILE" ]; then
|
||||
unset inContainer
|
||||
fi
|
||||
else
|
||||
if [[ "$PWD" != "/go/src/$DOCKER_PKG" ]]; then
|
||||
if [ "$PWD" != "/go/src/$DOCKER_PKG" ]; then
|
||||
unset inContainer
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$inContainer" ]]; then
|
||||
if [ -z "$inContainer" ]; then
|
||||
{
|
||||
echo "# WARNING! I don't seem to be running in a Docker container."
|
||||
echo "# The result of this command might be an incorrect build, and will not be"
|
||||
|
@ -67,11 +67,11 @@ DEFAULT_BUNDLES=(
|
|||
|
||||
VERSION=${VERSION:-dev}
|
||||
! BUILDTIME=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
|
||||
if [[ "$DOCKER_GITCOMMIT" ]]; then
|
||||
if [ "$DOCKER_GITCOMMIT" ]; then
|
||||
GITCOMMIT="$DOCKER_GITCOMMIT"
|
||||
elif command -v git &> /dev/null && [ -e .git ] && git rev-parse &> /dev/null; then
|
||||
GITCOMMIT=$(git rev-parse --short HEAD)
|
||||
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
|
||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||
GITCOMMIT="$GITCOMMIT-unsupported"
|
||||
echo "#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "# GITCOMMIT = $GITCOMMIT"
|
||||
|
@ -90,14 +90,14 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$AUTO_GOPATH" ]]; then
|
||||
if [ "$AUTO_GOPATH" ]; then
|
||||
rm -rf .gopath
|
||||
mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
|
||||
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
|
||||
export GOPATH="${PWD}/.gopath"
|
||||
fi
|
||||
|
||||
if [[ ! "$GOPATH" ]]; then
|
||||
if [ ! "$GOPATH" ]; then
|
||||
echo >&2 'error: missing GOPATH; please see https://golang.org/doc/code.html#GOPATH'
|
||||
echo >&2 ' alternatively, set AUTO_GOPATH=1'
|
||||
exit 1
|
||||
|
@ -137,7 +137,7 @@ fi
|
|||
# Use these flags when compiling the tests and final binary
|
||||
|
||||
IAMSTATIC='true'
|
||||
if [[ -z "$DOCKER_DEBUG" ]]; then
|
||||
if [ -z "$DOCKER_DEBUG" ]; then
|
||||
LDFLAGS='-w'
|
||||
fi
|
||||
|
||||
|
@ -151,9 +151,9 @@ ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS"
|
|||
BUILDFLAGS=( ${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}" )
|
||||
|
||||
# Test timeout.
|
||||
if [[ "${DOCKER_ENGINE_GOARCH}" == "arm64" ]] || [[ "${DOCKER_ENGINE_GOARCH}" == "arm" ]]; then
|
||||
if [ "${DOCKER_ENGINE_GOARCH}" == "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
|
||||
: ${TIMEOUT:=10m}
|
||||
elif [[ "${DOCKER_ENGINE_GOARCH}" == "windows" ]]; then
|
||||
elif [ "${DOCKER_ENGINE_GOARCH}" == "windows" ]; then
|
||||
: ${TIMEOUT:=8m}
|
||||
else
|
||||
: ${TIMEOUT:=5m}
|
||||
|
@ -164,7 +164,7 @@ LDFLAGS_STATIC_DOCKER="
|
|||
-extldflags \"$EXTLDFLAGS_STATIC\"
|
||||
"
|
||||
|
||||
if [[ "$(uname -s)" = 'FreeBSD' ]]; then
|
||||
if [ "$(uname -s)" = 'FreeBSD' ]; then
|
||||
# Tell cgo the compiler is Clang, not GCC
|
||||
# https://code.google.com/p/go/source/browse/src/cmd/cgo/gcc.go?spec=svne77e74371f2340ee08622ce602e9f7b15f29d8d3&r=e6794866ebeba2bf8818b9261b54e2eef1c9e588#752
|
||||
export CC=clang
|
||||
|
@ -181,7 +181,7 @@ bundle() {
|
|||
}
|
||||
|
||||
main() {
|
||||
if [[ -z "${KEEPBUNDLE-}" ]]; then
|
||||
if [ -z "${KEEPBUNDLE-}" ]; then
|
||||
echo "Removing bundles/"
|
||||
rm -rf "bundles/*"
|
||||
echo
|
||||
|
@ -189,13 +189,13 @@ main() {
|
|||
mkdir -p bundles
|
||||
|
||||
# Windows and symlinks don't get along well
|
||||
if [[ "$(go env GOHOSTOS)" != 'windows' ]]; then
|
||||
if [ "$(go env GOHOSTOS)" != 'windows' ]; then
|
||||
rm -f bundles/latest
|
||||
# preserve latest symlink for backward compatibility
|
||||
ln -sf . bundles/latest
|
||||
fi
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
bundles=(${DEFAULT_BUNDLES[@]})
|
||||
else
|
||||
bundles=($@)
|
||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
|||
|
||||
# a helper to provide ".exe" when it's appropriate
|
||||
binary_extension() {
|
||||
if [[ "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
echo -n '.exe'
|
||||
fi
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
|
|||
source "${MAKEDIR}/.go-autogen"
|
||||
|
||||
hash_files() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
while [ $# -gt 0 ]; do
|
||||
f="$1"
|
||||
shift
|
||||
dir="$(dirname "$f")"
|
||||
|
@ -40,7 +40,7 @@ hash_files() {
|
|||
(
|
||||
export GOGC=${DOCKER_BUILD_GOGC:-1000}
|
||||
|
||||
if [[ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]]; then
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
|
||||
# must be cross-compiling!
|
||||
case "$(go env GOOS)/$(go env GOARCH)" in
|
||||
windows/amd64)
|
||||
|
|
|
@ -36,7 +36,7 @@ DOCKER_CLIENT_GOARCH=${DOCKER_CLIENT_GOARCH:=amd64}
|
|||
|
||||
DOCKERFILE='Dockerfile'
|
||||
|
||||
if [[ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]]; then
|
||||
if [ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]; then
|
||||
DOCKERFILE='Dockerfile.windows'
|
||||
fi
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ if ! docker image inspect emptyfs > /dev/null; then
|
|||
tar -cf layer.tar --files-from /dev/null
|
||||
)
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
tar -cC "$dir" . | docker load
|
||||
)
|
||||
rm -rf "$dir"
|
||||
|
|
|
@ -43,7 +43,7 @@ const (
|
|||
DVEOF
|
||||
|
||||
# Compile the Windows resources into the sources
|
||||
if [[ "$(go env GOOS)" = "windows" ]]; then
|
||||
if [ "$(go env GOOS)" = "windows" ]; then
|
||||
mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
|
||||
cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
|
||||
cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
|
||||
|
@ -62,9 +62,9 @@ if [[ "$(go env GOOS)" = "windows" ]]; then
|
|||
|
||||
# Pass version and commit information into the resource compiler
|
||||
defs=
|
||||
[[ ! -z $VERSION ]] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
||||
[[ ! -z $VERSION_QUAD ]] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
||||
[[ ! -z $GITCOMMIT ]] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
||||
[ ! -z $VERSION ] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
||||
[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
||||
[ ! -z $GITCOMMIT ] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
||||
|
||||
function makeres {
|
||||
${WINDRES} \
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
set -e
|
||||
|
||||
source "$MAKEDIR/.detect-daemon-osarch"
|
||||
if [[ "$DOCKER_ENGINE_GOOS" != "windows" ]]; then
|
||||
if [ "$DOCKER_ENGINE_GOOS" != "windows" ]; then
|
||||
bundle .ensure-emptyfs
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@ export PATH="$base/binary-daemon:$base/dynbinary-daemon:$PATH"
|
|||
|
||||
export TEST_CLIENT_BINARY=docker
|
||||
|
||||
if [[ -n "$DOCKER_CLI_PATH" ]]; then
|
||||
if [ -n "$DOCKER_CLI_PATH" ]; then
|
||||
export TEST_CLIENT_BINARY=/usr/local/cli/$(basename "$DOCKER_CLI_PATH")
|
||||
fi
|
||||
|
||||
|
@ -19,11 +19,11 @@ fi
|
|||
|
||||
# This is a temporary hack for split-binary mode. It can be removed once
|
||||
# https://github.com/docker/docker/pull/22134 is merged into docker master
|
||||
if [[ "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
if docker version &> /dev/null; then
|
||||
echo >&2 'skipping daemon start, since daemon appears to be already started'
|
||||
return
|
||||
|
@ -43,7 +43,7 @@ export DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
|
|||
|
||||
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
|
||||
storage_params=""
|
||||
if [[ -n "$DOCKER_STORAGE_OPTS" ]]; then
|
||||
if [ -n "$DOCKER_STORAGE_OPTS" ]; then
|
||||
IFS=','
|
||||
for i in ${DOCKER_STORAGE_OPTS}; do
|
||||
storage_params="--storage-opt $i $storage_params"
|
||||
|
@ -53,24 +53,24 @@ fi
|
|||
|
||||
# example usage: DOCKER_REMAP_ROOT=default
|
||||
extra_params=""
|
||||
if [[ "$DOCKER_REMAP_ROOT" ]]; then
|
||||
if [ "$DOCKER_REMAP_ROOT" ]; then
|
||||
extra_params="--userns-remap $DOCKER_REMAP_ROOT"
|
||||
fi
|
||||
|
||||
# example usage: DOCKER_EXPERIMENTAL=1
|
||||
if [[ "$DOCKER_EXPERIMENTAL" ]]; then
|
||||
if [ "$DOCKER_EXPERIMENTAL" ]; then
|
||||
echo >&2 '# DOCKER_EXPERIMENTAL is set: starting daemon with experimental features enabled! '
|
||||
extra_params="$extra_params --experimental"
|
||||
fi
|
||||
|
||||
if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
# Start apparmor if it is enabled
|
||||
if [[ -e "/sys/module/apparmor/parameters/enabled" ]] && [[ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]]; then
|
||||
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
||||
# reset container variable so apparmor profile is applied to process
|
||||
# see https://github.com/docker/libcontainer/blob/master/apparmor/apparmor.go#L16
|
||||
export container=""
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
/etc/init.d/apparmor start
|
||||
)
|
||||
fi
|
||||
|
@ -79,7 +79,7 @@ if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
|||
export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock"
|
||||
(
|
||||
echo "Starting dockerd"
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
exec \
|
||||
dockerd --debug \
|
||||
--host "$DOCKER_HOST" \
|
||||
|
@ -99,9 +99,9 @@ tries=60
|
|||
echo "INFO: Waiting for daemon to start..."
|
||||
while ! ${TEST_CLIENT_BINARY} version &> /dev/null; do
|
||||
(( tries-- ))
|
||||
if [[ $tries -le 0 ]]; then
|
||||
if [ $tries -le 0 ]; then
|
||||
printf "\n"
|
||||
if [[ -z "$DOCKER_HOST" ]]; then
|
||||
if [ -z "$DOCKER_HOST" ]; then
|
||||
echo >&2 "error: daemon failed to start"
|
||||
echo >&2 " check $DEST/docker.log for details"
|
||||
else
|
||||
|
@ -109,7 +109,7 @@ while ! ${TEST_CLIENT_BINARY} version &> /dev/null; do
|
|||
${TEST_CLIENT_BINARY} version >&2 || true
|
||||
# Additional Windows CI debugging as this is a common error as of
|
||||
# January 2016
|
||||
if [[ "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
echo >&2 "Container log below:"
|
||||
echo >&2 "---"
|
||||
# Important - use the docker on the CI host, not the one built locally
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ! "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ ! "$(go env GOOS)" = 'windows' ]; then
|
||||
for pidFile in $(find "$DEST" -name docker.pid); do
|
||||
pid=$([[ -n "$TESTDEBUG" ]] && set -x; cat "$pidFile")
|
||||
pid=$([ -n "$TESTDEBUG" ] && set -x; cat "$pidFile")
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
kill "$pid"
|
||||
)
|
||||
if ! wait "$pid"; then
|
||||
|
@ -12,11 +12,11 @@ if [[ ! "$(go env GOOS)" = 'windows' ]]; then
|
|||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
# Stop apparmor if it is enabled
|
||||
if [[ -e "/sys/module/apparmor/parameters/enabled" ]] && [[ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]]; then
|
||||
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
/etc/init.d/apparmor stop
|
||||
)
|
||||
fi
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
# TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration
|
||||
#
|
||||
if [[ -z ${MAKEDIR} ]]; then
|
||||
if [ -z ${MAKEDIR} ]; then
|
||||
export MAKEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
fi
|
||||
source "$MAKEDIR/.go-autogen"
|
||||
|
@ -28,7 +28,7 @@ run_test_integration_suites() {
|
|||
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
|
||||
for dir in ${integration_api_dirs}; do
|
||||
if ! (
|
||||
cd ${dir}
|
||||
cd "$dir"
|
||||
echo "Running $PWD"
|
||||
test_env ./test.main ${flags}
|
||||
); then exit 1; fi
|
||||
|
@ -45,7 +45,7 @@ run_test_integration_legacy_suites() {
|
|||
}
|
||||
|
||||
build_test_suite_binaries() {
|
||||
if [[ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]]; then
|
||||
if [ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]; then
|
||||
echo "Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set"
|
||||
return
|
||||
fi
|
||||
|
@ -64,7 +64,7 @@ build_test_suite_binary() {
|
|||
}
|
||||
|
||||
cleanup_test_suite_binaries() {
|
||||
[[ -n "$TESTDEBUG" ]] && return
|
||||
[ -n "$TESTDEBUG" ] && return
|
||||
echo "Removing test suite binaries"
|
||||
find integration* -name test.main | xargs -r rm
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ repeat() {
|
|||
test_env() {
|
||||
(
|
||||
set -e
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
env -i \
|
||||
DEST="$ABS_DEST" \
|
||||
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
|
||||
|
@ -107,13 +107,13 @@ test_env() {
|
|||
|
||||
|
||||
error_on_leaked_containerd_shims() {
|
||||
if [[ "$(go env GOOS)" == 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" == 'windows' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
leftovers=$(ps -ax -o pid,cmd |
|
||||
awk '$2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }')
|
||||
if [[ -n "$leftovers" ]]; then
|
||||
if [ -n "$leftovers" ]; then
|
||||
ps aux
|
||||
kill -9 ${leftovers} 2> /dev/null
|
||||
echo "!!!! WARNING you have left over shim(s), Cleanup your test !!!!"
|
||||
|
|
|
@ -7,21 +7,21 @@ copy_binaries() {
|
|||
# Add nested executables to bundle dir so we have complete set of
|
||||
# them available, but only if the native OS/ARCH is the same as the
|
||||
# OS/ARCH of the build target
|
||||
if [[ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]]; then
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
|
||||
return
|
||||
fi
|
||||
if [[ ! -x /usr/local/bin/runc ]]; then
|
||||
if [ ! -x /usr/local/bin/runc ]; then
|
||||
return
|
||||
fi
|
||||
echo "Copying nested executables into $dir"
|
||||
for file in containerd containerd-shim ctr runc docker-init docker-proxy; do
|
||||
cp -f `which "$file"` "$dir/"
|
||||
if [[ "$hash" == "hash" ]]; then
|
||||
if [ "$hash" == "hash" ]; then
|
||||
hash_files "$dir/$file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
[[ -z "$KEEPDEST" ]] && rm -rf "$DEST"
|
||||
[ -z "$KEEPDEST" ] && rm -rf "$DEST"
|
||||
source "${MAKEDIR}/.binary"
|
||||
copy_binaries "$DEST" 'hash'
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
set -e
|
||||
|
||||
# if we have our linux/amd64 version compiled, let's symlink it in
|
||||
if [[ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]]; then
|
||||
if [ -x "${DEST}/../binary-daemon/dockerd-${VERSION}" ]; then
|
||||
arch=$(go env GOHOSTARCH)
|
||||
mkdir -p "$DEST/linux/${arch}"
|
||||
(
|
||||
cd "$DEST/linux/${arch}"
|
||||
cd "${DEST}/linux/${arch}"
|
||||
ln -sf ../../../binary-daemon/* ./
|
||||
)
|
||||
echo "Created symlinks:" "$DEST/linux/${arch}/"*
|
||||
echo "Created symlinks:" "${DEST}/linux/${arch}/"*
|
||||
fi
|
||||
|
||||
DOCKER_CROSSPLATFORMS=${DOCKER_CROSSPLATFORMS:-"linux/amd64 windows/amd64"}
|
||||
|
@ -17,13 +17,13 @@ DOCKER_CROSSPLATFORMS=${DOCKER_CROSSPLATFORMS:-"linux/amd64 windows/amd64"}
|
|||
for platform in ${DOCKER_CROSSPLATFORMS}; do
|
||||
(
|
||||
export KEEPDEST=1
|
||||
export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
|
||||
export DEST="${DEST}/${platform}" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
|
||||
export GOOS=${platform%/*}
|
||||
export GOARCH=${platform##*/}
|
||||
|
||||
echo "Cross building: $DEST"
|
||||
mkdir -p "$DEST"
|
||||
ABS_DEST="$(cd "$DEST" && pwd -P)"
|
||||
echo "Cross building: ${DEST}"
|
||||
mkdir -p "${DEST}"
|
||||
ABS_DEST="$(cd "${DEST}" && pwd -P)"
|
||||
source "${MAKEDIR}/binary-daemon"
|
||||
|
||||
source "${MAKEDIR}/cross-platform-dependent"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [[ ${platform} == "windows/amd64" ]]; then
|
||||
if [ ${platform} == "windows/amd64" ]; then
|
||||
source "${MAKEDIR}/containerutility"
|
||||
fi
|
||||
|
|
|
@ -6,7 +6,7 @@ rm -rf "$DEST"
|
|||
install_binary() {
|
||||
local file="$1"
|
||||
local target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
|
||||
if [[ "$(go env GOOS)" == "linux" ]]; then
|
||||
if [ "$(go env GOOS)" == "linux" ]; then
|
||||
echo "Installing $(basename $file) to ${target}"
|
||||
mkdir -p "$target"
|
||||
cp -f -L "$file" "$target"
|
||||
|
|
|
@ -13,7 +13,7 @@ DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
|
|||
|
||||
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
|
||||
storage_params=""
|
||||
if [[ -n "$DOCKER_STORAGE_OPTS" ]]; then
|
||||
if [ -n "$DOCKER_STORAGE_OPTS" ]; then
|
||||
IFS=','
|
||||
for i in ${DOCKER_STORAGE_OPTS}; do
|
||||
storage_params="--storage-opt $i $storage_params"
|
||||
|
@ -23,13 +23,13 @@ fi
|
|||
|
||||
|
||||
listen_port=2375
|
||||
if [[ -n "$DOCKER_PORT" ]]; then
|
||||
if [ -n "$DOCKER_PORT" ]; then
|
||||
IFS=':' read -r -a ports <<< "$DOCKER_PORT"
|
||||
listen_port="${ports[-1]}"
|
||||
fi
|
||||
|
||||
extra_params="$DOCKERD_ARGS"
|
||||
if [[ "$DOCKER_REMAP_ROOT" ]]; then
|
||||
if [ "$DOCKER_REMAP_ROOT" ]; then
|
||||
extra_params="$extra_params --userns-remap $DOCKER_REMAP_ROOT"
|
||||
fi
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ source hack/make/.integration-test-helpers
|
|||
bundle .integration-daemon-start
|
||||
|
||||
dockerPy='/docker-py'
|
||||
[[ -d "$dockerPy" ]] || {
|
||||
[ -d "$dockerPy" ] || {
|
||||
dockerPy="$DEST/docker-py"
|
||||
git clone https://github.com/docker/docker-py.git "$dockerPy"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e -u -o pipefail
|
||||
|
||||
ARCH=$(uname -m)
|
||||
if [[ "$ARCH" == "x86_64" ]]; then
|
||||
if [ "$ARCH" == "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
|
@ -45,7 +45,7 @@ run_test_integration_legacy_suites() {
|
|||
test_env() {
|
||||
(
|
||||
set -e +u
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
env -i \
|
||||
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
|
||||
DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -e -o pipefail
|
||||
|
||||
if [[ -z "$VALIDATE_UPSTREAM" ]]; then
|
||||
if [ -z "$VALIDATE_UPSTREAM" ]; then
|
||||
# this is kind of an expensive check, so let's not do this twice if we
|
||||
# are running more than one validate bundlescript
|
||||
|
||||
|
@ -18,12 +18,12 @@ if [[ -z "$VALIDATE_UPSTREAM" ]]; then
|
|||
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
||||
|
||||
validate_diff() {
|
||||
if [[ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]]; then
|
||||
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
||||
git diff "$VALIDATE_COMMIT_DIFF" "$@"
|
||||
fi
|
||||
}
|
||||
validate_log() {
|
||||
if [[ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]]; then
|
||||
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
||||
git log "$VALIDATE_COMMIT_LOG" "$@"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
changelogFile=${1:-CHANGELOG.md}
|
||||
|
||||
if [[ ! -r "$changelogFile" ]]; then
|
||||
if [ ! -r "$changelogFile" ]; then
|
||||
echo "Unable to read file $changelogFile" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
changelogFile=${1:-CHANGELOG.md}
|
||||
|
||||
if [[ ! -r "$changelogFile" ]]; then
|
||||
if [ ! -r "$changelogFile" ]; then
|
||||
echo "Unable to read file $changelogFile" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -21,13 +21,13 @@ check_dco() {
|
|||
grep -qE "$dcoRegex"
|
||||
}
|
||||
|
||||
if [[ ${adds} -eq 0 && ${dels} -eq 0 ]]; then
|
||||
if [ ${adds} -eq 0 -a ${dels} -eq 0 ]; then
|
||||
echo '0 adds, 0 deletions; nothing to validate! :)'
|
||||
else
|
||||
commits=( $(validate_log --format='format:%H%n') )
|
||||
badCommits=()
|
||||
for commit in "${commits[@]}"; do
|
||||
if [[ -z "$(git log -1 --format='format:' --name-status "$commit")" ]]; then
|
||||
if [ -z "$(git log -1 --format='format:' --name-status "$commit")" ]; then
|
||||
# no content (ie, Merge commit, etc)
|
||||
continue
|
||||
fi
|
||||
|
@ -35,7 +35,7 @@ else
|
|||
badCommits+=( "$commit" )
|
||||
fi
|
||||
done
|
||||
if [[ ${#badCommits[@]} -eq 0 ]]; then
|
||||
if [ ${#badCommits[@]} -eq 0 ]; then
|
||||
echo "Congratulations! All commits are properly signed with the DCO!"
|
||||
else
|
||||
{
|
||||
|
|
|
@ -7,12 +7,12 @@ IFS=$'\n'
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
# We run 'go generate' and see if we have a diff afterwards
|
||||
go generate ./profiles/seccomp/ >/dev/null
|
||||
# Let see if the working directory is clean
|
||||
diffs="$(git status --porcelain -- profiles/seccomp 2>/dev/null)"
|
||||
if [[ "$diffs" ]]; then
|
||||
if [ "$diffs" ]; then
|
||||
{
|
||||
echo 'The result of go generate ./profiles/seccomp/ differs'
|
||||
echo
|
||||
|
|
|
@ -9,7 +9,7 @@ new_tests=$(
|
|||
grep -E '^\+func (.*) Test' || true
|
||||
)
|
||||
|
||||
if [[ -z "$new_tests" ]]; then
|
||||
if [ -z "$new_tests" ]; then
|
||||
echo 'Congratulations! No new tests added to integration-cli.'
|
||||
exit
|
||||
fi
|
||||
|
|
|
@ -19,7 +19,7 @@ for f in "${files[@]}"; do
|
|||
done
|
||||
done
|
||||
|
||||
if [[ ${#badFiles[@]} -eq 0 ]]; then
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! "./pkg/..." is safely isolated from internal code.'
|
||||
else
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ IFS=$'\n'
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/swagger.yaml' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
yamllint -c ${SCRIPTDIR}/.swagger-yamllint api/swagger.yaml
|
||||
swagger validate api/swagger.yaml
|
||||
fi
|
||||
|
|
|
@ -7,11 +7,11 @@ IFS=$'\n'
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' 'api/swagger.yaml' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
${SCRIPTDIR}/../generate-swagger-api.sh 2> /dev/null
|
||||
# Let see if the working directory is clean
|
||||
diffs="$(git diff -- api/types/)"
|
||||
if [[ "$diffs" ]]; then
|
||||
if [ "$diffs" ]; then
|
||||
{
|
||||
echo 'The result of hack/generate-swagger-api.sh differs'
|
||||
echo
|
||||
|
|
|
@ -11,20 +11,20 @@ unset IFS
|
|||
badFiles=()
|
||||
for f in "${files[@]}"; do
|
||||
# skip check_test.go since it *does* use the testing package
|
||||
if [[ "$f" = "integration-cli/check_test.go" ]]; then
|
||||
if [ "$f" = "integration-cli/check_test.go" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# we use "git show" here to validate that what's committed doesn't contain golang built-in testing
|
||||
if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
|
||||
if [[ "$(echo $f | grep '_test')" ]]; then
|
||||
if [ "$(echo $f | grep '_test')" ]; then
|
||||
# allow testing.T for non- _test files
|
||||
badFiles+=( "$f" )
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#badFiles[@]} -eq 0 ]]; then
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! No testing.T found.'
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ for f in "${files[@]}"; do
|
|||
fi
|
||||
done
|
||||
|
||||
if [[ ${#badFiles[@]} -eq 0 ]]; then
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All toml source files changed here have valid syntax.'
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,12 +8,12 @@ validate_vendor_diff(){
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
# recreate vendor/
|
||||
vndr
|
||||
# check if any files have changed
|
||||
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
|
||||
if [[ "$diffs" ]]; then
|
||||
if [ "$diffs" ]; then
|
||||
{
|
||||
echo 'The result of vndr differs'
|
||||
echo
|
||||
|
@ -38,7 +38,7 @@ validate_vendor_used() {
|
|||
for f in $pkgs; do
|
||||
if ls -d vendor/$f > /dev/null 2>&1; then
|
||||
found=$(find vendor/$f -iregex '.*LICENSE.*' -or -iregex '.*COPYRIGHT.*' -or -iregex '.*COPYING.*' | wc -l)
|
||||
if [[ ${found} -eq 0 ]]; then
|
||||
if [ $found -eq 0 ]; then
|
||||
echo "WARNING: could not find copyright information for $f"
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue