fix: resolve bun binary for v02 device-pod boot

This commit is contained in:
Codex
2026-05-29 22:51:11 +08:00
parent d1ffc007e4
commit 200aa99f1f
2 changed files with 16 additions and 1 deletions
+15 -1
View File
@@ -8,4 +8,18 @@ export HWLAB_REVISION="${HWLAB_BOOT_COMMIT}"
export HWLAB_IMAGE="${HWLAB_ENVIRONMENT_IMAGE:-${HWLAB_IMAGE:-}}"
export HWLAB_IMAGE_DIGEST="${HWLAB_ENVIRONMENT_DIGEST:-${HWLAB_IMAGE_DIGEST:-unknown}}"
exec bun cmd/hwlab-device-pod/main.ts
bun_bin="${HWLAB_BUN_COMMAND:-}"
if [ -z "$bun_bin" ]; then
if command -v bun >/dev/null 2>&1; then
bun_bin="$(command -v bun)"
elif [ -x /usr/local/bin/bun ]; then
bun_bin="/usr/local/bin/bun"
elif [ -x ./node_modules/.bin/bun ]; then
bun_bin="./node_modules/.bin/bun"
else
echo "hwlab-device-pod boot failed: bun not found" >&2
exit 127
fi
fi
exec "$bun_bin" cmd/hwlab-device-pod/main.ts
@@ -12,6 +12,7 @@ if (!/^[a-f0-9]{40}$/u.test(bootCommit)) fail("HWLAB_BOOT_COMMIT must be a full
if (path.isAbsolute(bootSh) || bootSh.split("/").includes("..")) fail("HWLAB_BOOT_SH must be repo-relative");
const readUrl = process.env.HWLAB_BOOT_READ_URL || mirrorReadUrl(bootRepo);
process.env.HWLAB_BUN_COMMAND ||= process.execPath;
mkdirSync(path.dirname(checkoutDir), { recursive: true });
rmSync(checkoutDir, { recursive: true, force: true });
run("git", ["clone", "--no-checkout", readUrl, checkoutDir], "/");