Browse code

hack/make/binary-daemon: fix some linting issues

- Add quotes to prevent word splitting in `cp` statement (SC2046)
- Replace legacy back tics with `$()`
- Replace `which` with `command -v` (SC2230)
- Fix incorrect (`==`) comparison

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

Sebastiaan van Stijn authored on 2019/08/31 19:12:25
Showing 1 changed files
... ...
@@ -15,16 +15,16 @@ copy_binaries() {
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 rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh; do
18
-		cp -f `which "$file"` "$dir/"
19
-		if [ "$hash" == "hash" ]; then
18
+		cp -f "$(command -v "$file")" "$dir/"
19
+		if [ "$hash" = "hash" ]; then
20 20
 			hash_files "$dir/$file"
21 21
 		fi
22 22
 	done
23 23
 
24 24
 	# vpnkit is amd64 only
25
-	if which "vpnkit.$(uname -m)" 2>&1 >/dev/null; then
26
-		cp -f `which "vpnkit.$(uname -m)"` "$dir/vpnkit"
27
-		if [ "$hash" == "hash" ]; then
25
+	if command -v "vpnkit.$(uname -m)" 2>&1 >/dev/null; then
26
+		cp -f "$(command -v "vpnkit.$(uname -m)")" "$dir/vpnkit"
27
+		if [ "$hash" = "hash" ]; then
28 28
 			hash_files "$dir/vpnkit"
29 29
 		fi
30 30
 	fi