Browse code

Bash scripts; use double brackets, fix bare variables, add quotes

These scripts explicitly use Bash, so we should be able to use
`[[` instead of `[` (which seems to be recommended).

Also added curly brackets to some bare variables, and quoted some paths.

This makes my IDE a bit more silent :-)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/12/23 04:18:33
Showing 43 changed files
... ...
@@ -13,7 +13,7 @@ set -e
13 13
 # apparmor sucks and Docker needs to know that it's in a container (c) @tianon
14 14
 export container=docker
15 15
 
16
-if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
16
+if [[ -d /sys/kernel/security ]] && ! mountpoint -q /sys/kernel/security; then
17 17
 	mount -t securityfs none /sys/kernel/security || {
18 18
 		echo >&2 'Could not mount /sys/kernel/security.'
19 19
 		echo >&2 'AppArmor detection and --privileged mode might break.'
... ...
@@ -25,7 +25,7 @@ if ! mountpoint -q /tmp; then
25 25
 	mount -t tmpfs none /tmp
26 26
 fi
27 27
 
28
-if [ $# -gt 0 ]; then
28
+if [[ $# -gt 0 ]]; then
29 29
 	exec "$@"
30 30
 fi
31 31
 
... ...
@@ -28,9 +28,9 @@ install_containerd() {
28 28
 		make
29 29
 	)
30 30
 
31
-	mkdir -p ${PREFIX}
31
+	mkdir -p "${PREFIX}"
32 32
 
33
-	cp bin/containerd ${PREFIX}/containerd
34
-	cp bin/containerd-shim ${PREFIX}/containerd-shim
35
-	cp bin/ctr ${PREFIX}/ctr
33
+	cp bin/containerd "${PREFIX}/containerd"
34
+	cp bin/containerd-shim "${PREFIX}/containerd-shim"
35
+	cp bin/ctr "${PREFIX}/ctr"
36 36
 }
... ...
@@ -8,14 +8,13 @@ install_dockercli() {
8 8
 
9 9
 	arch=$(uname -m)
10 10
 	# No official release of these platforms
11
-	if [[ "$arch" != "x86_64" ]] && [[ "$arch" != "s390x" ]]; then
11
+	if [ "$arch" != "x86_64" ] && [ "$arch" != "s390x" ]; then
12 12
 		build_dockercli
13 13
 		return
14 14
 	fi
15 15
 
16 16
 	url=https://download.docker.com/linux/static
17
-	curl -Ls $url/$DOCKERCLI_CHANNEL/$arch/docker-$DOCKERCLI_VERSION.tgz | \
18
-	tar -xz docker/docker
17
+	curl -Ls "${url}/${DOCKERCLI_CHANNEL}/${arch}/docker-${DOCKERCLI_VERSION}.tgz" | tar -xz docker/docker
19 18
 	mkdir -p ${PREFIX}
20 19
 	mv docker/docker ${PREFIX}/
21 20
 	rmdir docker
... ...
@@ -27,5 +26,5 @@ build_dockercli() {
27 27
 	git checkout -q "v$DOCKERCLI_VERSION"
28 28
 	mkdir -p "$GOPATH/src/github.com/docker"
29 29
 	mv components/cli "$GOPATH/src/github.com/docker/cli"
30
-	go build -buildmode=pie -o ${PREFIX}/docker github.com/docker/cli/cmd/docker
30
+	go build -buildmode=pie -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker"
31 31
 }
... ...
@@ -7,6 +7,6 @@ install_gometalinter() {
7 7
 	go get -d github.com/alecthomas/gometalinter
8 8
 	cd "$GOPATH/src/github.com/alecthomas/gometalinter"
9 9
 	git checkout -q "$GOMETALINTER_COMMIT"
10
-	go build -buildmode=pie -o ${PREFIX}/gometalinter github.com/alecthomas/gometalinter
11
-	GOBIN=${PREFIX} ${PREFIX}/gometalinter --install
10
+	go build -buildmode=pie -o "${PREFIX}/gometalinter" "github.com/alecthomas/gometalinter"
11
+	GOBIN=${PREFIX} "${PREFIX}/gometalinter" --install
12 12
 }
... ...
@@ -9,7 +9,7 @@ TMP_GOPATH=${TMP_GOPATH:-""}
9 9
 
10 10
 : ${PREFIX:="/usr/local/bin"}
11 11
 
12
-if [ -z "$TMP_GOPATH" ]; then
12
+if [[ -z "$TMP_GOPATH" ]]; then
13 13
 	export GOPATH="$(mktemp -d)"
14 14
 	RM_GOPATH=1
15 15
 else
... ...
@@ -21,10 +21,10 @@ dir="$(dirname $0)"
21 21
 bin=$1
22 22
 shift
23 23
 
24
-if [ ! -f "${dir}/${bin}.installer" ]; then
24
+if [[ ! -f "${dir}/${bin}.installer" ]]; then
25 25
 	echo "Could not find installer for \"$bin\""
26 26
 	exit 1
27 27
 fi
28 28
 
29
-. $dir/$bin.installer
30
-install_$bin "$@"
29
+. ${dir}/${bin}.installer
30
+install_${bin} "$@"
... ...
@@ -32,7 +32,7 @@ _install_proxy() {
32 32
 	git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
33 33
 	cd "$GOPATH/src/github.com/docker/libnetwork"
34 34
 	git checkout -q "$LIBNETWORK_COMMIT"
35
-	go build $BUILD_MODE -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
35
+	go build ${BUILD_MODE} -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
36 36
 }
37 37
 
38 38
 
... ...
@@ -25,6 +25,6 @@ install_runc() {
25 25
 		target="$1"
26 26
 	fi
27 27
 	make BUILDTAGS="$RUNC_BUILDTAGS" "$target"
28
-	mkdir -p ${PREFIX}
29
-	cp runc ${PREFIX}/runc
28
+	mkdir -p "${PREFIX}"
29
+	cp runc "${PREFIX}/runc"
30 30
 }
... ...
@@ -9,6 +9,6 @@ install_tini() {
9 9
 	git checkout -q "$TINI_COMMIT"
10 10
 	cmake .
11 11
 	make tini-static
12
-	mkdir -p ${PREFIX}
13
-	cp tini-static ${PREFIX}/docker-init
12
+	mkdir -p "${PREFIX}"
13
+	cp tini-static "${PREFIX}/docker-init"
14 14
 }
... ...
@@ -8,5 +8,5 @@ install_tomlv() {
8 8
 	echo "Install tomlv version $TOMLV_COMMIT"
9 9
 	git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
10 10
 	cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
11
-	go build -v -buildmode=pie -o ${PREFIX}/tomlv github.com/BurntSushi/toml/cmd/tomlv
11
+	go build -v -buildmode=pie -o "${PREFIX}/tomlv" "github.com/BurntSushi/toml/cmd/tomlv"
12 12
 }
... ...
@@ -7,5 +7,5 @@ install_vndr() {
7 7
 	git clone https://github.com/LK4D4/vndr.git "$GOPATH/src/github.com/LK4D4/vndr"
8 8
 	cd "$GOPATH/src/github.com/LK4D4/vndr"
9 9
 	git checkout -q "$VNDR_COMMIT"
10
-	go build -buildmode=pie -v -o ${PREFIX}/vndr .
10
+	go build -buildmode=pie -v -o "${PREFIX}/vndr" .
11 11
 }
... ...
@@ -31,17 +31,17 @@ export PKG_CONFIG=${PKG_CONFIG:-pkg-config}
31 31
 # We're a nice, sexy, little shell script, and people might try to run us;
32 32
 # but really, they shouldn't. We want to be in a container!
33 33
 inContainer="AssumeSoInitially"
34
-if [ "$(go env GOHOSTOS)" = 'windows' ]; then
35
-	if [ -z "$FROM_DOCKERFILE" ]; then
34
+if [[ "$(go env GOHOSTOS)" = 'windows' ]]; then
35
+	if [[ -z "$FROM_DOCKERFILE" ]]; then
36 36
 		unset inContainer
37 37
 	fi
38 38
 else
39
-	if [ "$PWD" != "/go/src/$DOCKER_PKG" ]; then
39
+	if [[ "$PWD" != "/go/src/$DOCKER_PKG" ]]; then
40 40
 		unset inContainer
41 41
 	fi
42 42
 fi
43 43
 
44
-if [ -z "$inContainer" ]; then
44
+if [[ -z "$inContainer" ]]; then
45 45
 	{
46 46
 		echo "# WARNING! I don't seem to be running in a Docker container."
47 47
 		echo "# The result of this command might be an incorrect build, and will not be"
... ...
@@ -67,11 +67,11 @@ DEFAULT_BUNDLES=(
67 67
 
68 68
 VERSION=${VERSION:-dev}
69 69
 ! BUILDTIME=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
70
-if [ "$DOCKER_GITCOMMIT" ]; then
70
+if [[ "$DOCKER_GITCOMMIT" ]]; then
71 71
 	GITCOMMIT="$DOCKER_GITCOMMIT"
72 72
 elif command -v git &> /dev/null && [ -e .git ] && git rev-parse &> /dev/null; then
73 73
 	GITCOMMIT=$(git rev-parse --short HEAD)
74
-	if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
74
+	if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
75 75
 		GITCOMMIT="$GITCOMMIT-unsupported"
76 76
 		echo "#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
77 77
 		echo "# GITCOMMIT = $GITCOMMIT"
... ...
@@ -90,14 +90,14 @@ else
90 90
 	exit 1
91 91
 fi
92 92
 
93
-if [ "$AUTO_GOPATH" ]; then
93
+if [[ "$AUTO_GOPATH" ]]; then
94 94
 	rm -rf .gopath
95 95
 	mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
96 96
 	ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
97 97
 	export GOPATH="${PWD}/.gopath"
98 98
 fi
99 99
 
100
-if [ ! "$GOPATH" ]; then
100
+if [[ ! "$GOPATH" ]]; then
101 101
 	echo >&2 'error: missing GOPATH; please see https://golang.org/doc/code.html#GOPATH'
102 102
 	echo >&2 '  alternatively, set AUTO_GOPATH=1'
103 103
 	exit 1
... ...
@@ -137,7 +137,7 @@ fi
137 137
 # Use these flags when compiling the tests and final binary
138 138
 
139 139
 IAMSTATIC='true'
140
-if [ -z "$DOCKER_DEBUG" ]; then
140
+if [[ -z "$DOCKER_DEBUG" ]]; then
141 141
 	LDFLAGS='-w'
142 142
 fi
143 143
 
... ...
@@ -148,12 +148,12 @@ EXTLDFLAGS_STATIC='-static'
148 148
 ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo )
149 149
 # see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
150 150
 
151
-BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
151
+BUILDFLAGS=( ${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}" )
152 152
 
153 153
 # Test timeout.
154
-if [ "${DOCKER_ENGINE_GOARCH}" == "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
154
+if [[ "${DOCKER_ENGINE_GOARCH}" == "arm64" ]] || [[ "${DOCKER_ENGINE_GOARCH}" == "arm" ]]; then
155 155
 	: ${TIMEOUT:=10m}
156
-elif [ "${DOCKER_ENGINE_GOARCH}" == "windows" ]; then
156
+elif [[ "${DOCKER_ENGINE_GOARCH}" == "windows" ]]; then
157 157
 	: ${TIMEOUT:=8m}
158 158
 else
159 159
 	: ${TIMEOUT:=5m}
... ...
@@ -164,7 +164,7 @@ LDFLAGS_STATIC_DOCKER="
164 164
 	-extldflags \"$EXTLDFLAGS_STATIC\"
165 165
 "
166 166
 
167
-if [ "$(uname -s)" = 'FreeBSD' ]; then
167
+if [[ "$(uname -s)" = 'FreeBSD' ]]; then
168 168
 	# Tell cgo the compiler is Clang, not GCC
169 169
 	# https://code.google.com/p/go/source/browse/src/cmd/cgo/gcc.go?spec=svne77e74371f2340ee08622ce602e9f7b15f29d8d3&r=e6794866ebeba2bf8818b9261b54e2eef1c9e588#752
170 170
 	export CC=clang
... ...
@@ -181,7 +181,7 @@ bundle() {
181 181
 }
182 182
 
183 183
 main() {
184
-	if [ -z "${KEEPBUNDLE-}" ]; then
184
+	if [[ -z "${KEEPBUNDLE-}" ]]; then
185 185
 		echo "Removing bundles/"
186 186
 		rm -rf "bundles/*"
187 187
 		echo
... ...
@@ -189,13 +189,13 @@ main() {
189 189
 	mkdir -p bundles
190 190
 
191 191
 	# Windows and symlinks don't get along well
192
-	if [ "$(go env GOHOSTOS)" != 'windows' ]; then
192
+	if [[ "$(go env GOHOSTOS)" != 'windows' ]]; then
193 193
 		rm -f bundles/latest
194 194
 		# preserve latest symlink for backward compatibility
195 195
 		ln -sf . bundles/latest
196 196
 	fi
197 197
 
198
-	if [ $# -lt 1 ]; then
198
+	if [[ $# -lt 1 ]]; then
199 199
 		bundles=(${DEFAULT_BUNDLES[@]})
200 200
 	else
201 201
 		bundles=($@)
... ...
@@ -3,7 +3,7 @@ set -e
3 3
 
4 4
 # a helper to provide ".exe" when it's appropriate
5 5
 binary_extension() {
6
-	if [ "$(go env GOOS)" = 'windows' ]; then
6
+	if [[ "$(go env GOOS)" = 'windows' ]]; then
7 7
 		echo -n '.exe'
8 8
 	fi
9 9
 }
... ...
@@ -17,7 +17,7 @@ BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
17 17
 source "${MAKEDIR}/.go-autogen"
18 18
 
19 19
 hash_files() {
20
-	while [ $# -gt 0 ]; do
20
+	while [[ $# -gt 0 ]]; do
21 21
 		f="$1"
22 22
 		shift
23 23
 		dir="$(dirname "$f")"
... ...
@@ -40,7 +40,7 @@ hash_files() {
40 40
 (
41 41
 export GOGC=${DOCKER_BUILD_GOGC:-1000}
42 42
 
43
-if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
43
+if [[ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]]; then
44 44
 	# must be cross-compiling!
45 45
 	case "$(go env GOOS)/$(go env GOARCH)" in
46 46
 		windows/amd64)
... ...
@@ -68,7 +68,7 @@ go build \
68 68
 		$LDFLAGS_STATIC_DOCKER
69 69
 		$DOCKER_LDFLAGS
70 70
 	" \
71
-	$GO_PACKAGE
71
+	${GO_PACKAGE}
72 72
 )
73 73
 
74 74
 echo "Created binary: $DEST/$BINARY_FULLNAME"
... ...
@@ -36,7 +36,7 @@ DOCKER_CLIENT_GOARCH=${DOCKER_CLIENT_GOARCH:=amd64}
36 36
 
37 37
 DOCKERFILE='Dockerfile'
38 38
 
39
-if [ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]; then
39
+if [[ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]]; then
40 40
 	DOCKERFILE='Dockerfile.windows'
41 41
 fi
42 42
 
... ...
@@ -16,7 +16,7 @@ if ! docker image inspect emptyfs > /dev/null; then
16 16
 		tar -cf layer.tar --files-from /dev/null
17 17
 	)
18 18
 	(
19
-		[ -n "$TESTDEBUG" ] && set -x
19
+		[[ -n "$TESTDEBUG" ]] && set -x
20 20
 		tar -cC "$dir" . | docker load
21 21
 	)
22 22
 	rm -rf "$dir"
... ...
@@ -43,7 +43,7 @@ const (
43 43
 DVEOF
44 44
 
45 45
 # Compile the Windows resources into the sources
46
-if [ "$(go env GOOS)" = "windows" ]; then
46
+if [[ "$(go env GOOS)" = "windows" ]]; then
47 47
 	mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
48 48
 	cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
49 49
 	cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
... ...
@@ -62,12 +62,12 @@ if [ "$(go env GOOS)" = "windows" ]; then
62 62
 
63 63
 	# Pass version and commit information into the resource compiler
64 64
 	defs=
65
-	[ ! -z $VERSION ]      && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
66
-	[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
67
-	[ ! -z $GITCOMMIT ]    && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
65
+	[[ ! -z $VERSION ]]      && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
66
+	[[ ! -z $VERSION_QUAD ]] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
67
+	[[ ! -z $GITCOMMIT ]]    && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
68 68
 
69 69
 	function makeres {
70
-		$WINDRES \
70
+		${WINDRES} \
71 71
 			-i hack/make/.resources-windows/$1 \
72 72
 			-o $3 \
73 73
 			-F $2 \
... ...
@@ -76,7 +76,7 @@ if [ "$(go env GOOS)" = "windows" ]; then
76 76
 			$defs
77 77
 	}
78 78
 
79
-	$WINDMC \
79
+	${WINDMC} \
80 80
 		hack/make/.resources-windows/event_messages.mc \
81 81
 		-h autogen/winresources/tmp \
82 82
 		-r autogen/winresources/tmp
... ...
@@ -2,6 +2,6 @@
2 2
 set -e
3 3
 
4 4
 source "$MAKEDIR/.detect-daemon-osarch"
5
-if [ "$DOCKER_ENGINE_GOOS" != "windows" ]; then
5
+if [[ "$DOCKER_ENGINE_GOOS" != "windows" ]]; then
6 6
 	bundle .ensure-emptyfs
7 7
 fi
... ...
@@ -7,7 +7,7 @@ export PATH="$base/binary-daemon:$base/dynbinary-daemon:$PATH"
7 7
 
8 8
 export TEST_CLIENT_BINARY=docker
9 9
 
10
-if [ -n "$DOCKER_CLI_PATH" ]; then
10
+if [[ -n "$DOCKER_CLI_PATH" ]]; then
11 11
 	export TEST_CLIENT_BINARY=/usr/local/cli/$(basename "$DOCKER_CLI_PATH")
12 12
 fi
13 13
 
... ...
@@ -19,11 +19,11 @@ fi
19 19
 
20 20
 # This is a temporary hack for split-binary mode. It can be removed once
21 21
 # https://github.com/docker/docker/pull/22134 is merged into docker master
22
-if [ "$(go env GOOS)" = 'windows' ]; then
22
+if [[ "$(go env GOOS)" = 'windows' ]]; then
23 23
        return
24 24
 fi
25 25
 
26
-if [ -z "$DOCKER_TEST_HOST" ]; then
26
+if [[ -z "$DOCKER_TEST_HOST" ]]; then
27 27
 	if docker version &> /dev/null; then
28 28
 		echo >&2 'skipping daemon start, since daemon appears to be already started'
29 29
 		return
... ...
@@ -43,7 +43,7 @@ export DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
43 43
 
44 44
 # example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
45 45
 storage_params=""
46
-if [ -n "$DOCKER_STORAGE_OPTS" ]; then
46
+if [[ -n "$DOCKER_STORAGE_OPTS" ]]; then
47 47
 	IFS=','
48 48
 	for i in ${DOCKER_STORAGE_OPTS}; do
49 49
 		storage_params="--storage-opt $i $storage_params"
... ...
@@ -53,24 +53,24 @@ fi
53 53
 
54 54
 # example usage: DOCKER_REMAP_ROOT=default
55 55
 extra_params=""
56
-if [ "$DOCKER_REMAP_ROOT" ]; then
56
+if [[ "$DOCKER_REMAP_ROOT" ]]; then
57 57
 	extra_params="--userns-remap $DOCKER_REMAP_ROOT"
58 58
 fi
59 59
 
60 60
 # example usage: DOCKER_EXPERIMENTAL=1
61
-if [  "$DOCKER_EXPERIMENTAL" ]; then
61
+if [[  "$DOCKER_EXPERIMENTAL" ]]; then
62 62
 	echo >&2 '# DOCKER_EXPERIMENTAL is set: starting daemon with experimental features enabled! '
63 63
 	extra_params="$extra_params --experimental"
64 64
 fi
65 65
 
66
-if [ -z "$DOCKER_TEST_HOST" ]; then
66
+if [[ -z "$DOCKER_TEST_HOST" ]]; then
67 67
 	# Start apparmor if it is enabled
68
-	if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
68
+	if [[ -e "/sys/module/apparmor/parameters/enabled" ]] && [[ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]]; then
69 69
 		# reset container variable so apparmor profile is applied to process
70 70
 		# see https://github.com/docker/libcontainer/blob/master/apparmor/apparmor.go#L16
71 71
 		export container=""
72 72
 		(
73
-			[ -n "$TESTDEBUG" ] && set -x
73
+			[[ -n "$TESTDEBUG" ]] && set -x
74 74
 			/etc/init.d/apparmor start
75 75
 		)
76 76
 	fi
... ...
@@ -79,15 +79,15 @@ if [ -z "$DOCKER_TEST_HOST" ]; then
79 79
 	export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock"
80 80
 	(
81 81
 		echo "Starting dockerd"
82
-		[ -n "$TESTDEBUG" ] && set -x
82
+		[[ -n "$TESTDEBUG" ]] && set -x
83 83
 		exec \
84 84
 			dockerd --debug \
85 85
 			--host "$DOCKER_HOST" \
86 86
 			--storage-driver "$DOCKER_GRAPHDRIVER" \
87 87
 			--pidfile "$DEST/docker.pid" \
88 88
 			--userland-proxy="$DOCKER_USERLANDPROXY" \
89
-			$storage_params \
90
-			$extra_params \
89
+			${storage_params} \
90
+			${extra_params} \
91 91
 				&> "$DEST/docker.log"
92 92
 	) &
93 93
 else
... ...
@@ -97,19 +97,19 @@ fi
97 97
 # give it a little time to come up so it's "ready"
98 98
 tries=60
99 99
 echo "INFO: Waiting for daemon to start..."
100
-while ! $TEST_CLIENT_BINARY version &> /dev/null; do
100
+while ! ${TEST_CLIENT_BINARY} version &> /dev/null; do
101 101
 	(( tries-- ))
102
-	if [ $tries -le 0 ]; then
102
+	if [[ $tries -le 0 ]]; then
103 103
 		printf "\n"
104
-		if [ -z "$DOCKER_HOST" ]; then
104
+		if [[ -z "$DOCKER_HOST" ]]; then
105 105
 			echo >&2 "error: daemon failed to start"
106 106
 			echo >&2 "  check $DEST/docker.log for details"
107 107
 		else
108 108
 			echo >&2 "error: daemon at $DOCKER_HOST fails to '$TEST_CLIENT_BINARY version':"
109
-			$TEST_CLIENT_BINARY version >&2 || true
109
+			${TEST_CLIENT_BINARY} version >&2 || true
110 110
 			# Additional Windows CI debugging as this is a common error as of
111 111
 			# January 2016
112
-			if [ "$(go env GOOS)" = 'windows' ]; then
112
+			if [[ "$(go env GOOS)" = 'windows' ]]; then
113 113
 				echo >&2 "Container log below:"
114 114
 				echo >&2 "---"
115 115
 				# Important - use the docker on the CI host, not the one built locally
... ...
@@ -1,10 +1,10 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
-if [ ! "$(go env GOOS)" = 'windows' ]; then
3
+if [[ ! "$(go env GOOS)" = 'windows' ]]; then
4 4
 	for pidFile in $(find "$DEST" -name docker.pid); do
5
-		pid=$([ -n "$TESTDEBUG" ] && set -x; cat "$pidFile")
5
+		pid=$([[ -n "$TESTDEBUG" ]] && set -x; cat "$pidFile")
6 6
 		(
7
-			[ -n "$TESTDEBUG" ] && set -x
7
+			[[ -n "$TESTDEBUG" ]] && set -x
8 8
 			kill "$pid"
9 9
 		)
10 10
 		if ! wait "$pid"; then
... ...
@@ -12,11 +12,11 @@ if [ ! "$(go env GOOS)" = 'windows' ]; then
12 12
 		fi
13 13
 	done
14 14
 
15
-	if [ -z "$DOCKER_TEST_HOST" ]; then
15
+	if [[ -z "$DOCKER_TEST_HOST" ]]; then
16 16
 		# Stop apparmor if it is enabled
17
-		if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
17
+		if [[ -e "/sys/module/apparmor/parameters/enabled" ]] && [[ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]]; then
18 18
 			(
19
-				[ -n "$TESTDEBUG" ] && set -x
19
+				[[ -n "$TESTDEBUG" ]] && set -x
20 20
 				/etc/init.d/apparmor stop
21 21
 			)
22 22
 		fi
... ...
@@ -5,7 +5,7 @@
5 5
 #
6 6
 #     TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration
7 7
 #
8
-if [ -z $MAKEDIR ]; then
8
+if [[ -z ${MAKEDIR} ]]; then
9 9
 	export MAKEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
10 10
 fi
11 11
 source "$MAKEDIR/.go-autogen"
... ...
@@ -26,11 +26,11 @@ run_test_integration() {
26 26
 
27 27
 run_test_integration_suites() {
28 28
 	local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
29
-	for dir in $integration_api_dirs; do
29
+	for dir in ${integration_api_dirs}; do
30 30
 		if ! (
31
-			cd $dir
31
+			cd ${dir}
32 32
 			echo "Running $PWD"
33
-			test_env ./test.main $flags
33
+			test_env ./test.main ${flags}
34 34
 		); then exit 1; fi
35 35
 	done
36 36
 }
... ...
@@ -45,12 +45,12 @@ run_test_integration_legacy_suites() {
45 45
 }
46 46
 
47 47
 build_test_suite_binaries() {
48
-	if [ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]; then
48
+	if [[ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]]; then
49 49
 		echo "Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set"
50 50
 		return
51 51
 	fi
52 52
 	build_test_suite_binary ./integration-cli "test.main"
53
-	for dir in $integration_api_dirs; do
53
+	for dir in ${integration_api_dirs}; do
54 54
 		build_test_suite_binary "$dir" "test.main"
55 55
 	done
56 56
 }
... ...
@@ -64,13 +64,13 @@ build_test_suite_binary() {
64 64
 }
65 65
 
66 66
 cleanup_test_suite_binaries() {
67
-	[ -n "$TESTDEBUG" ] && return
67
+	[[ -n "$TESTDEBUG" ]] && return
68 68
 	echo "Removing test suite binaries"
69 69
 	find integration* -name test.main | xargs -r rm
70 70
 }
71 71
 
72 72
 repeat() {
73
-	for i in $(seq 1 $TEST_REPEAT); do
73
+	for i in $(seq 1 ${TEST_REPEAT}); do
74 74
 		echo "Running integration-test (iteration $i)"
75 75
 		$@
76 76
 	done
... ...
@@ -80,7 +80,7 @@ repeat() {
80 80
 test_env() {
81 81
 	(
82 82
 		set -e
83
-		[ -n "$TESTDEBUG" ] && set -x
83
+		[[ -n "$TESTDEBUG" ]] && set -x
84 84
 		env -i \
85 85
 			DEST="$ABS_DEST" \
86 86
 			DOCKER_API_VERSION="$DOCKER_API_VERSION" \
... ...
@@ -107,15 +107,15 @@ test_env() {
107 107
    
108 108
 
109 109
 error_on_leaked_containerd_shims() {
110
-	if [ "$(go env GOOS)" == 'windows' ]; then
110
+	if [[ "$(go env GOOS)" == 'windows' ]]; then
111 111
 		return
112 112
 	fi
113 113
 
114 114
 	leftovers=$(ps -ax -o pid,cmd |
115 115
 	            awk '$2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }')
116
-	if [ -n "$leftovers" ]; then
116
+	if [[ -n "$leftovers" ]]; then
117 117
 		ps aux
118
-		kill -9 $leftovers 2> /dev/null
118
+		kill -9 ${leftovers} 2> /dev/null
119 119
 		echo "!!!! WARNING you have left over shim(s), Cleanup your test !!!!"
120 120
 		exit 1
121 121
 	fi
... ...
@@ -7,21 +7,21 @@ copy_binaries() {
7 7
 	# Add nested executables to bundle dir so we have complete set of
8 8
 	# them available, but only if the native OS/ARCH is the same as the
9 9
 	# OS/ARCH of the build target
10
-	if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
10
+	if [[ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]]; then
11 11
 		return
12 12
 	fi
13
-	if [ ! -x /usr/local/bin/runc ]; then
13
+	if [[ ! -x /usr/local/bin/runc ]]; then
14 14
 		return
15 15
 	fi
16 16
 	echo "Copying nested executables into $dir"
17 17
 	for file in containerd containerd-shim ctr runc docker-init docker-proxy; do
18 18
 		cp -f `which "$file"` "$dir/"
19
-		if [ "$hash" == "hash" ]; then
19
+		if [[ "$hash" == "hash" ]]; then
20 20
 			hash_files "$dir/$file"
21 21
 		fi
22 22
 	done
23 23
 }
24 24
 
25
-[ -z "$KEEPDEST" ] && rm -rf "$DEST"
25
+[[ -z "$KEEPDEST" ]] && rm -rf "$DEST"
26 26
 source "${MAKEDIR}/.binary"
27 27
 copy_binaries "$DEST" 'hash'
... ...
@@ -2,7 +2,7 @@
2 2
 set -e
3 3
 
4 4
 # if we have our linux/amd64 version compiled, let's symlink it in
5
-if [ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]; then
5
+if [[ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]]; then
6 6
 	arch=$(go env GOHOSTARCH)
7 7
 	mkdir -p "$DEST/linux/${arch}"
8 8
 	(
... ...
@@ -14,7 +14,7 @@ fi
14 14
 
15 15
 DOCKER_CROSSPLATFORMS=${DOCKER_CROSSPLATFORMS:-"linux/amd64 windows/amd64"}
16 16
 
17
-for platform in $DOCKER_CROSSPLATFORMS; do
17
+for platform in ${DOCKER_CROSSPLATFORMS}; do
18 18
 	(
19 19
 		export KEEPDEST=1
20 20
 		export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
... ...
@@ -1,6 +1,6 @@
1 1
 #!/usr/bin/env bash
2 2
 set -e
3 3
 
4
-if [ $platform == "windows/amd64" ]; then
4
+if [[ ${platform} == "windows/amd64" ]]; then
5 5
 	source "${MAKEDIR}/containerutility"
6 6
 fi
... ...
@@ -6,7 +6,7 @@ rm -rf "$DEST"
6 6
 install_binary() {
7 7
 	local file="$1"
8 8
 	local target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
9
-	if [ "$(go env GOOS)" == "linux" ]; then
9
+	if [[ "$(go env GOOS)" == "linux" ]]; then
10 10
 		echo "Installing $(basename $file) to ${target}"
11 11
 		mkdir -p "$target"
12 12
 		cp -f -L "$file" "$target"
... ...
@@ -13,7 +13,7 @@ DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
13 13
 
14 14
 # example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
15 15
 storage_params=""
16
-if [ -n "$DOCKER_STORAGE_OPTS" ]; then
16
+if [[ -n "$DOCKER_STORAGE_OPTS" ]]; then
17 17
 	IFS=','
18 18
 	for i in ${DOCKER_STORAGE_OPTS}; do
19 19
 		storage_params="--storage-opt $i $storage_params"
... ...
@@ -23,22 +23,22 @@ fi
23 23
 
24 24
 
25 25
 listen_port=2375
26
-if [ -n "$DOCKER_PORT" ]; then
26
+if [[ -n "$DOCKER_PORT" ]]; then
27 27
 	IFS=':' read -r -a ports <<< "$DOCKER_PORT"
28 28
 	listen_port="${ports[-1]}"
29 29
 fi
30 30
 
31 31
 extra_params="$DOCKERD_ARGS"
32
-if [ "$DOCKER_REMAP_ROOT" ]; then
32
+if [[ "$DOCKER_REMAP_ROOT" ]]; then
33 33
 	extra_params="$extra_params --userns-remap $DOCKER_REMAP_ROOT"
34 34
 fi
35 35
 
36 36
 args="--debug \
37 37
 	--host tcp://0.0.0.0:${listen_port} --host unix:///var/run/docker.sock \
38
-	--storage-driver "$DOCKER_GRAPHDRIVER" \
39
-	--userland-proxy="$DOCKER_USERLANDPROXY" \
38
+	--storage-driver "${DOCKER_GRAPHDRIVER}" \
39
+	--userland-proxy="${DOCKER_USERLANDPROXY}" \
40 40
 	$storage_params \
41 41
 	$extra_params"
42 42
 
43
-echo dockerd $args
44
-exec dockerd $args
43
+echo dockerd ${args}
44
+exec dockerd ${args}
... ...
@@ -8,7 +8,7 @@ source hack/make/.integration-test-helpers
8 8
 	bundle .integration-daemon-start
9 9
 
10 10
 	dockerPy='/docker-py'
11
-	[ -d "$dockerPy" ] || {
11
+	[[ -d "$dockerPy" ]] || {
12 12
 		dockerPy="$DEST/docker-py"
13 13
 		git clone https://github.com/docker/docker-py.git "$dockerPy"
14 14
 	}
... ...
@@ -8,7 +8,7 @@ source hack/make/.integration-test-helpers
8 8
 	bundle .integration-daemon-start
9 9
 	bundle .integration-daemon-setup
10 10
 
11
-	local testexit=0
11
+	testexit=0
12 12
 	( repeat run_test_integration ) || testexit=$?
13 13
 
14 14
 	# Always run cleanup, even if the subshell fails
... ...
@@ -16,6 +16,6 @@ source hack/make/.integration-test-helpers
16 16
 	cleanup_test_suite_binaries
17 17
 	error_on_leaked_containerd_shims
18 18
 
19
-	exit $testexit
19
+	exit ${testexit}
20 20
 
21 21
 ) 2>&1 | tee -a "$DEST/test.log"
... ...
@@ -2,7 +2,7 @@
2 2
 set -e -u -o pipefail
3 3
 
4 4
 ARCH=$(uname -m)
5
-if [ "$ARCH" == "x86_64" ]; then
5
+if [[ "$ARCH" == "x86_64" ]]; then
6 6
   ARCH="amd64"
7 7
 fi
8 8
 
... ...
@@ -45,7 +45,7 @@ run_test_integration_legacy_suites() {
45 45
 test_env() {
46 46
 	(
47 47
 		set -e +u
48
-		[ -n "$TESTDEBUG" ] && set -x
48
+		[[ -n "$TESTDEBUG" ]] && set -x
49 49
 		env -i \
50 50
 			DOCKER_API_VERSION="$DOCKER_API_VERSION" \
51 51
 			DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
... ...
@@ -24,7 +24,7 @@ for pkg in $pkg_list; do
24 24
         -cover \
25 25
         -coverprofile=profile.out \
26 26
         -covermode=atomic \
27
-        $TESTFLAGS \
27
+        ${TESTFLAGS} \
28 28
         "${pkg}"
29 29
 
30 30
     if test -f profile.out; then
... ...
@@ -2,7 +2,7 @@
2 2
 
3 3
 set -e -o pipefail
4 4
 
5
-if [ -z "$VALIDATE_UPSTREAM" ]; then
5
+if [[ -z "$VALIDATE_UPSTREAM" ]]; then
6 6
 	# this is kind of an expensive check, so let's not do this twice if we
7 7
 	# are running more than one validate bundlescript
8 8
 
... ...
@@ -18,12 +18,12 @@ if [ -z "$VALIDATE_UPSTREAM" ]; then
18 18
 	VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
19 19
 
20 20
 	validate_diff() {
21
-		if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
21
+		if [[ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]]; then
22 22
 			git diff "$VALIDATE_COMMIT_DIFF" "$@"
23 23
 		fi
24 24
 	}
25 25
 	validate_log() {
26
-		if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
26
+		if [[ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]]; then
27 27
 			git log "$VALIDATE_COMMIT_LOG" "$@"
28 28
 		fi
29 29
 	}
... ...
@@ -4,5 +4,5 @@
4 4
 
5 5
 export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6 6
 
7
-. $SCRIPTDIR/default
8
-. $SCRIPTDIR/vendor
7
+. ${SCRIPTDIR}/default
8
+. ${SCRIPTDIR}/vendor
... ...
@@ -2,7 +2,7 @@
2 2
 
3 3
 changelogFile=${1:-CHANGELOG.md}
4 4
 
5
-if [ ! -r "$changelogFile" ]; then
5
+if [[ ! -r "$changelogFile" ]]; then
6 6
   echo "Unable to read file $changelogFile" >&2
7 7
   exit 1
8 8
 fi
... ...
@@ -2,7 +2,7 @@
2 2
 
3 3
 changelogFile=${1:-CHANGELOG.md}
4 4
 
5
-if [ ! -r "$changelogFile" ]; then
5
+if [[ ! -r "$changelogFile" ]]; then
6 6
   echo "Unable to read file $changelogFile" >&2
7 7
   exit 1
8 8
 fi
... ...
@@ -21,13 +21,13 @@ check_dco() {
21 21
 	grep -qE "$dcoRegex"
22 22
 }
23 23
 
24
-if [ $adds -eq 0 -a $dels -eq 0 ]; then
24
+if [[ ${adds} -eq 0 && ${dels} -eq 0 ]]; then
25 25
 	echo '0 adds, 0 deletions; nothing to validate! :)'
26 26
 else
27 27
 	commits=( $(validate_log --format='format:%H%n') )
28 28
 	badCommits=()
29 29
 	for commit in "${commits[@]}"; do
30
-		if [ -z "$(git log -1 --format='format:' --name-status "$commit")" ]; then
30
+		if [[ -z "$(git log -1 --format='format:' --name-status "$commit")" ]]; then
31 31
 			# no content (ie, Merge commit, etc)
32 32
 			continue
33 33
 		fi
... ...
@@ -35,7 +35,7 @@ else
35 35
 			badCommits+=( "$commit" )
36 36
 		fi
37 37
 	done
38
-	if [ ${#badCommits[@]} -eq 0 ]; then
38
+	if [[ ${#badCommits[@]} -eq 0 ]]; then
39 39
 		echo "Congratulations!  All commits are properly signed with the DCO!"
40 40
 	else
41 41
 		{
... ...
@@ -4,14 +4,14 @@
4 4
 
5 5
 export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6 6
 
7
-. $SCRIPTDIR/dco
8
-. $SCRIPTDIR/default-seccomp
9
-. $SCRIPTDIR/gometalinter
10
-. $SCRIPTDIR/pkg-imports
11
-. $SCRIPTDIR/swagger
12
-. $SCRIPTDIR/swagger-gen
13
-. $SCRIPTDIR/test-imports
14
-. $SCRIPTDIR/toml
15
-. $SCRIPTDIR/changelog-well-formed
16
-. $SCRIPTDIR/changelog-date-descending
17
-. $SCRIPTDIR/deprecate-integration-cli
7
+. ${SCRIPTDIR}/dco
8
+. ${SCRIPTDIR}/default-seccomp
9
+. ${SCRIPTDIR}/gometalinter
10
+. ${SCRIPTDIR}/pkg-imports
11
+. ${SCRIPTDIR}/swagger
12
+. ${SCRIPTDIR}/swagger-gen
13
+. ${SCRIPTDIR}/test-imports
14
+. ${SCRIPTDIR}/toml
15
+. ${SCRIPTDIR}/changelog-well-formed
16
+. ${SCRIPTDIR}/changelog-date-descending
17
+. ${SCRIPTDIR}/deprecate-integration-cli
... ...
@@ -7,12 +7,12 @@ IFS=$'\n'
7 7
 files=( $(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true) )
8 8
 unset IFS
9 9
 
10
-if [ ${#files[@]} -gt 0 ]; then
10
+if [[ ${#files[@]} -gt 0 ]]; then
11 11
 	# We run 'go generate' and see if we have a diff afterwards
12 12
 	go generate ./profiles/seccomp/ >/dev/null
13 13
 	# Let see if the working directory is clean
14 14
 	diffs="$(git status --porcelain -- profiles/seccomp 2>/dev/null)"
15
-	if [ "$diffs" ]; then
15
+	if [[ "$diffs" ]]; then
16 16
 		{
17 17
 			echo 'The result of go generate ./profiles/seccomp/ differs'
18 18
 			echo
... ...
@@ -9,7 +9,7 @@ new_tests=$(
9 9
     grep -E '^\+func (.*) Test' || true
10 10
 )
11 11
 
12
-if [ -z "$new_tests" ]; then
12
+if [[ -z "$new_tests" ]]; then
13 13
 	echo 'Congratulations!  No new tests added to integration-cli.'
14 14
     exit
15 15
 fi
... ...
@@ -10,4 +10,4 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
10 10
 
11 11
 gometalinter \
12 12
 	${GOMETALINTER_OPTS} \
13
-	--config $SCRIPTDIR/gometalinter.json ./...
13
+	--config ${SCRIPTDIR}/gometalinter.json ./...
... ...
@@ -19,7 +19,7 @@ for f in "${files[@]}"; do
19 19
 	done
20 20
 done
21 21
 
22
-if [ ${#badFiles[@]} -eq 0 ]; then
22
+if [[ ${#badFiles[@]} -eq 0 ]]; then
23 23
 	echo 'Congratulations!  "./pkg/..." is safely isolated from internal code.'
24 24
 else
25 25
 	{
... ...
@@ -7,7 +7,7 @@ IFS=$'\n'
7 7
 files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/swagger.yaml' || true) )
8 8
 unset IFS
9 9
 
10
-if [ ${#files[@]} -gt 0 ]; then
10
+if [[ ${#files[@]} -gt 0 ]]; then
11 11
   yamllint -c ${SCRIPTDIR}/.swagger-yamllint api/swagger.yaml
12 12
   swagger validate api/swagger.yaml
13 13
 fi
... ...
@@ -7,11 +7,11 @@ IFS=$'\n'
7 7
 files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' 'api/swagger.yaml' || true) )
8 8
 unset IFS
9 9
 
10
-if [ ${#files[@]} -gt 0 ]; then
10
+if [[ ${#files[@]} -gt 0 ]]; then
11 11
 	${SCRIPTDIR}/../generate-swagger-api.sh 2> /dev/null
12 12
 	# Let see if the working directory is clean
13 13
 	diffs="$(git diff -- api/types/)"
14
-	if [ "$diffs" ]; then
14
+	if [[ "$diffs" ]]; then
15 15
 		{
16 16
 			echo 'The result of hack/generate-swagger-api.sh differs'
17 17
 			echo
... ...
@@ -11,20 +11,20 @@ unset IFS
11 11
 badFiles=()
12 12
 for f in "${files[@]}"; do
13 13
 	# skip check_test.go since it *does* use the testing package
14
-	if [ "$f" = "integration-cli/check_test.go" ]; then
14
+	if [[ "$f" = "integration-cli/check_test.go" ]]; then
15 15
 		continue
16 16
 	fi
17 17
 
18 18
 	# we use "git show" here to validate that what's committed doesn't contain golang built-in testing
19 19
 	if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
20
-		if [ "$(echo $f | grep '_test')" ]; then
20
+		if [[ "$(echo $f | grep '_test')" ]]; then
21 21
 			# allow testing.T for non- _test files
22 22
 			badFiles+=( "$f" )
23 23
 		fi
24 24
 	fi
25 25
 done
26 26
 
27
-if [ ${#badFiles[@]} -eq 0 ]; then
27
+if [[ ${#badFiles[@]} -eq 0 ]]; then
28 28
 	echo 'Congratulations!  No testing.T found.'
29 29
 else
30 30
 	{
... ...
@@ -15,7 +15,7 @@ for f in "${files[@]}"; do
15 15
 	fi
16 16
 done
17 17
 
18
-if [ ${#badFiles[@]} -eq 0 ]; then
18
+if [[ ${#badFiles[@]} -eq 0 ]]; then
19 19
 	echo 'Congratulations!  All toml source files changed here have valid syntax.'
20 20
 else
21 21
 	{
... ...
@@ -8,12 +8,12 @@ validate_vendor_diff(){
8 8
 	files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
9 9
 	unset IFS
10 10
 
11
-	if [ ${#files[@]} -gt 0 ]; then
11
+	if [[ ${#files[@]} -gt 0 ]]; then
12 12
 		# recreate vendor/
13 13
 		vndr
14 14
 		# check if any files have changed
15 15
 		diffs="$(git status --porcelain -- vendor 2>/dev/null)"
16
-		if [ "$diffs" ]; then
16
+		if [[ "$diffs" ]]; then
17 17
 			{
18 18
 				echo 'The result of vndr differs'
19 19
 				echo
... ...
@@ -38,7 +38,7 @@ validate_vendor_used() {
38 38
 	for f in $pkgs; do
39 39
 	if ls -d vendor/$f  > /dev/null 2>&1; then
40 40
 		found=$(find vendor/$f -iregex '.*LICENSE.*' -or -iregex '.*COPYRIGHT.*' -or -iregex '.*COPYING.*' | wc -l)
41
-		if [ $found -eq 0 ]; then
41
+		if [[ ${found} -eq 0 ]]; then
42 42
 		echo "WARNING: could not find copyright information for $f"
43 43
 		fi
44 44
 	else