Skip to content

Commit 0d9eb65

Browse files
koobsghuntley
authored andcommitted
Fix variable assignments and usage
I was in ports Makefile not bash mode.
1 parent 68b2c76 commit 0d9eb65

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

scripts/build_go.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ set -euo pipefail
2727
# shellcheck source=scripts/lib.sh
2828
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2929

30-
# Allow specifying go command via environment
31-
GOCMD?=go
30+
#Allow specifying go command via environment
31+
GOCMD="${GOCMD:-go}"
3232

3333
# Allow specifying/overriding GETOPT via environment
34-
GETOPT?=getopt
34+
GETOPT="${GETOPT:-getopt}"
3535

3636
version=""
3737
os="${GOOS:-linux}"
@@ -41,7 +41,7 @@ sign_darwin="${CODER_SIGN_DARWIN:-0}"
4141
output_path=""
4242
agpl="${CODER_BUILD_AGPL:-0}"
4343

44-
args="$($(GETOPT) -o "" -l version:,os:,arch:,output:,slim,agpl,sign-darwin -- "$@")"
44+
args="$(${GETOPT} -o "" -l version:,os:,arch:,output:,slim,agpl,sign-darwin -- "$@")"
4545
eval set -- "$args"
4646
while true; do
4747
case "$1" in
@@ -93,7 +93,7 @@ if [[ "$version" == "" ]]; then
9393
fi
9494

9595
# Check dependencies
96-
dependencies go
96+
dependencies ${GOCMD}
9797
if [[ "$sign_darwin" == 1 ]]; then
9898
dependencies rcodesign
9999
requiredenvs AC_CERTIFICATE_FILE AC_CERTIFICATE_PASSWORD_FILE
@@ -132,7 +132,7 @@ cmd_path="./enterprise/cmd/coder"
132132
if [[ "$agpl" == 1 ]]; then
133133
cmd_path="./cmd/coder"
134134
fi
135-
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" GOARM="$arm_version" $(GOCMD) build \
135+
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" GOARM="$arm_version" ${GOCMD} build \
136136
"${build_args[@]}" \
137137
"$cmd_path" 1>&2
138138

scripts/lib.sh

100644100755
+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
3434
PROJECT_ROOT="$(cd "$SCRIPT_DIR" && realpath "$(git rev-parse --show-toplevel)")"
3535

3636
# Allow specifying/overriding make command via environment
37-
MAKECMD?=make
37+
MAKECMD="${MAKECMD:-make}"
3838

3939
# Allow specifying/overriding GETOPT via environment
40-
GETOPT?=getopt
40+
GETOPT="${GETOPT:-getopt}"
4141

4242
# pushd is a silent alternative to the real pushd shell command.
4343
pushd() {
@@ -155,7 +155,7 @@ if [[ "${CODER_LIBSH_NO_CHECK_DEPENDENCIES:-}" != *t* ]]; then
155155
fi
156156

157157
# BSD getopt (which is installed by default on Macs) is not supported.
158-
if [[ "$($(GETOPT) --version)" == *--* ]]; then
158+
if [[ "$(${GETOPT} --version)" == *--* ]]; then
159159
libsh_bad_dependencies=1
160160
log "ERROR: You need GNU getopt to run the scripts in the Coder repo."
161161
if isdarwin; then
@@ -176,7 +176,7 @@ if [[ "${CODER_LIBSH_NO_CHECK_DEPENDENCIES:-}" != *t* ]]; then
176176
# We have to disable pipefail temporarily to avoid ERRPIPE errors when
177177
# piping into `head -n1`.
178178
set +o pipefail
179-
make_version="$($(MAKECMD) --version 2>/dev/null | head -n1 | grep -oE '([[:digit:]]+\.){1,2}[[:digit:]]+')"
179+
make_version="$(${MAKECMD} --version 2>/dev/null | head -n1 | grep -oE '([[:digit:]]+\.){1,2}[[:digit:]]+')"
180180
set -o pipefail
181181
if [[ ${make_version//.*/} -lt 4 ]]; then
182182
libsh_bad_dependencies=1

0 commit comments

Comments
 (0)