Skip to content

Commit b309aa0

Browse files
committed
fix(install): avoid linking bootstrap temp clones
1 parent 048bf36 commit b309aa0

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ exec_installer_from_ref() {
5353

5454
if has_payload_marker "$payload_script"; then
5555
verify_downloaded_script "$payload_script" "versioned installer"
56-
NEMOCLAW_INSTALL_REF="$ref" NEMOCLAW_INSTALL_TAG="$ref" NEMOCLAW_REPO_ROOT="$source_root" \
56+
NEMOCLAW_INSTALL_REF="$ref" NEMOCLAW_INSTALL_TAG="$ref" NEMOCLAW_BOOTSTRAP_PAYLOAD=1 \
5757
bash "$payload_script" "$@"
5858
return
5959
fi

scripts/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,10 @@ is_source_checkout() {
833833
[[ -f "$package_json" ]] || return 1
834834
grep -q '"name"[[:space:]]*:[[:space:]]*"nemoclaw"' "$package_json" 2>/dev/null || return 1
835835

836+
if [[ "${NEMOCLAW_BOOTSTRAP_PAYLOAD:-}" == "1" ]]; then
837+
return 1
838+
fi
839+
836840
if [[ -n "${NEMOCLAW_REPO_ROOT:-}" || -d "${repo_root}/.git" ]]; then
837841
return 0
838842
fi

test/install-preflight.test.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,29 @@ describe("installer pure helpers", () => {
13361336
expect(r.stdout.trim()).toBe("yes");
13371337
});
13381338

1339+
it("is_source_checkout: rejects bootstrap payload clones even when git metadata exists", () => {
1340+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-source-checkout-bootstrap-"));
1341+
fs.mkdirSync(path.join(tmp, ".git"));
1342+
fs.writeFileSync(
1343+
path.join(tmp, "package.json"),
1344+
JSON.stringify({ name: "nemoclaw", version: "0.1.0" }, null, 2),
1345+
);
1346+
const r = spawnSync(
1347+
"bash",
1348+
[
1349+
"-c",
1350+
`source "${INSTALLER}" 2>/dev/null; is_source_checkout "${tmp}" && echo yes || echo no`,
1351+
],
1352+
{
1353+
cwd: tmp,
1354+
encoding: "utf-8",
1355+
env: { HOME: tmp, PATH: TEST_SYSTEM_PATH, NEMOCLAW_BOOTSTRAP_PAYLOAD: "1" },
1356+
},
1357+
);
1358+
expect(r.status).toBe(0);
1359+
expect(r.stdout.trim()).toBe("no");
1360+
});
1361+
13391362
it("resolve_installer_version: falls back to package.json when git tags are unavailable", () => {
13401363
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-resolve-ver-pkg-"));
13411364
fs.mkdirSync(path.join(tmp, ".git"));
@@ -1822,7 +1845,8 @@ EOS
18221845
#!/usr/bin/env bash
18231846
set -euo pipefail
18241847
# NEMOCLAW_VERSIONED_INSTALLER_PAYLOAD=1
1825-
node "$NEMOCLAW_REPO_ROOT/bin/lib/usage-notice.js"
1848+
repo_root="\${NEMOCLAW_REPO_ROOT:-$(cd "$(dirname "\${BASH_SOURCE[0]}")/.." && pwd)}"
1849+
node "$repo_root/bin/lib/usage-notice.js"
18261850
EOS
18271851
chmod +x "$target/scripts/install.sh"
18281852
exit 0

0 commit comments

Comments
 (0)