Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6c1208e

Browse files
authored
feat: Clean up coder agent path inps listing (#2453)
This commit changes the `coder agent` path in `ps` listing from`/tmp/tmp.coderwWs87Y/coder agent` to `./coder agent`.The path is also updated to `/tmp/coder.wWs87Y`.There were two options considered for turning `./coder agent` into`coder agent`:1. Run `exec -a coder /path/to/coder agent`2. Run `PATH=/path/to:$PATH exec coder agent`Option 1 is not supported by `dash`, and thus discarded.Option 2 duplicates functionality in `coder agent` which _appends_ thepath, here we would want to _prepend_ it to ensure we're starting thedownloaded `coder` binary in case there is a binary with a conflictingname on the system.Fixes#2407
1 parent18b0eff commit6c1208e

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

‎provisionersdk/agent.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,35 @@ Start-Process -FilePath $env:TEMP\sshd.exe -ArgumentList "agent" -PassThru`
1818

1919
linuxScript=`#!/usr/bin/env sh
2020
set -eux pipefail
21-
BINARY_LOCATION=$(mktemp -d -t tmp.coderXXXXXX)/coder
21+
BINARY_DIR=$(mktemp -d -t coder.XXXXXX)
22+
BINARY_NAME=coder
2223
BINARY_URL=${ACCESS_URL}bin/coder-linux-${ARCH}
24+
cd $BINARY_DIR
2325
if command -v curl >/dev/null 2>&1; then
24-
curl -fsSL --compressed "${BINARY_URL}" -o "${BINARY_LOCATION}"
26+
curl -fsSL --compressed "${BINARY_URL}" -o "${BINARY_NAME}"
2527
elif command -v wget >/dev/null 2>&1; then
26-
wget -q "${BINARY_URL}" -O "${BINARY_LOCATION}"
28+
wget -q "${BINARY_URL}" -O "${BINARY_NAME}"
2729
elif command -v busybox >/dev/null 2>&1; then
28-
busybox wget -q "${BINARY_URL}" -O "${BINARY_LOCATION}"
30+
busybox wget -q "${BINARY_URL}" -O "${BINARY_NAME}"
2931
else
3032
echo "error: no download tool found, please install curl, wget or busybox wget"
3133
exit 1
3234
fi
33-
chmod +x $BINARY_LOCATION
35+
chmod +x $BINARY_NAME
3436
export CODER_AGENT_AUTH="${AUTH_TYPE}"
3537
export CODER_AGENT_URL="${ACCESS_URL}"
36-
exec$BINARY_LOCATION agent`
38+
exec./$BINARY_NAME agent`
3739

3840
darwinScript=`#!/usr/bin/env sh
3941
set -eux pipefail
40-
BINARY_LOCATION=$(mktemp -d -t tmp.coderXXXXXX)/coder
41-
curl -fsSL --compressed "${ACCESS_URL}bin/coder-darwin-${ARCH}" -o "${BINARY_LOCATION}"
42-
chmod +x $BINARY_LOCATION
42+
BINARY_DIR=$(mktemp -d -t coder.XXXXXX)
43+
BINARY_NAME=coder
44+
cd $BINARY_DIR
45+
curl -fsSL --compressed "${ACCESS_URL}bin/coder-darwin-${ARCH}" -o "${BINARY_NAME}"
46+
chmod +x $BINARY_NAME
4347
export CODER_AGENT_AUTH="${AUTH_TYPE}"
4448
export CODER_AGENT_URL="${ACCESS_URL}"
45-
exec$BINARY_LOCATION agent`
49+
exec./$BINARY_NAME agent`
4650

4751
// A mapping of operating-system ($GOOS) to architecture ($GOARCH)
4852
// to agent install and run script. ${DOWNLOAD_URL} is replaced

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp