Skip to content

Commit 8f7dbee

Browse files
bpmctben@coder.com
and
ben@coder.com
authored
fix: flaky install.sh upgrade on OSX (zsh killed) (coder#2309)
* remove binary exists * fix lint and format errors Co-authored-by: ben@coder.com <benpotter@bens-mbp.lan>
1 parent 55e538e commit 8f7dbee

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

install.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ echo_latest_version() {
8585

8686
echo_standalone_postinstall() {
8787
cath <<EOF
88-
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME
88+
89+
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME
8990
9091
EOF
9192

@@ -391,7 +392,16 @@ install_standalone() {
391392
"$sh_c" unzip -d "$CACHE_DIR" -o "$CACHE_DIR/coder_${VERSION}_${OS}_${ARCH}.zip"
392393
fi
393394

394-
"$sh_c" cp "$CACHE_DIR/coder" "$STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME"
395+
COPY_LOCATION="$STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME"
396+
397+
# Remove the file if it already exists to
398+
# avoid https://github.com/coder/coder/issues/2086
399+
if [ -f "$COPY_LOCATION" ]; then
400+
"$sh_c" rm "$COPY_LOCATION"
401+
fi
402+
403+
# Copy the binary to the correct location.
404+
"$sh_c" cp "$CACHE_DIR/coder" "$COPY_LOCATION"
395405

396406
echo_standalone_postinstall
397407
}

0 commit comments

Comments
 (0)