Skip to content

fix(installer): manage PATH via sentinel block, self-heal legacy markers#23

Merged
riglar merged 1 commit into
devfrom
fix/installer-marker-dedup
Jun 22, 2026
Merged

fix(installer): manage PATH via sentinel block, self-heal legacy markers#23
riglar merged 1 commit into
devfrom
fix/installer-marker-dedup

Conversation

@riglar

@riglar riglar commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

The Unix installer (install.sh) appended a bare # dcd marker plus an export PATH=... line to the shell rc, deduping only by grep-ing for the install dir. The marker and the dedup key were managed separately, so whenever the export was removed/edited while the marker stayed (manual edits, relocations, partial cleanups), the next run orphaned or duplicated # dcd markers.

Fix

New persist_path() writes a single sentinel-delimited block:

# >>> dcd installer >>>
export PATH="$HOME/.dcd/bin:$PATH"
# <<< dcd installer <<<

Before writing it:

  • strips any prior sentinel block,
  • strips legacy bare # dcd markers and old export lines (so existing messy rc files self-heal on the next install),
  • trims trailing blank lines (no growing gap per run),
  • rewrites the rc in place (truncate + write) to preserve its inode/permissions.

Verification

  • sh -n install.sh passes.
  • Idempotency harness: seeded a fake rc with real user content + 3 orphan # dcd markers + an old export, ran persist_path → every run converged to exactly 1 begin / 1 end / 0 bare markers / 1 export, with all user lines preserved.
  • First-time install behavior unchanged.

Ships live via get.devicecloud.dev (serves install.sh raw from dev, ~5 min cache) once merged.

The Unix installer appended a bare "# dcd" marker plus an export line to the
shell rc, and deduped only by grep-ing for the install dir. The marker and the
dedup key were managed separately, so any time the export was removed or edited
while the marker stayed (manual edits, relocations, partial cleanups) the next
run orphaned or duplicated "# dcd" markers.

Replace that with persist_path(): write a single sentinel-delimited block
(# >>> dcd installer >>> ... # <<< dcd installer <<<) and, before writing,
strip any prior block AND legacy bare "# dcd" markers + export lines, then trim
trailing blank lines. Re-runs now converge to exactly one block and existing
orphaned markers are cleaned up on the next install. The rc is rewritten in
place (truncate + write) so its inode and permissions are preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@riglar
riglar merged commit 9aa26c1 into dev Jun 22, 2026
3 checks passed
@riglar
riglar deleted the fix/installer-marker-dedup branch June 24, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant