diff --git a/deploy/runtime/boot/hwlab-device-pod.sh b/deploy/runtime/boot/hwlab-device-pod.sh index 7eb37bf0..3cd6f15d 100644 --- a/deploy/runtime/boot/hwlab-device-pod.sh +++ b/deploy/runtime/boot/hwlab-device-pod.sh @@ -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 diff --git a/deploy/runtime/launcher/hwlab-env-reuse-launcher.ts b/deploy/runtime/launcher/hwlab-env-reuse-launcher.ts index 36b28689..04ffc123 100644 --- a/deploy/runtime/launcher/hwlab-env-reuse-launcher.ts +++ b/deploy/runtime/launcher/hwlab-env-reuse-launcher.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], "/");