fix(installer): manage PATH via sentinel block, self-heal legacy markers#23
Merged
Conversation
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>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Unix installer (
install.sh) appended a bare# dcdmarker plus anexport PATH=...line to the shell rc, deduping only bygrep-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# dcdmarkers.Fix
New
persist_path()writes a single sentinel-delimited block:Before writing it:
# dcdmarkers and old export lines (so existing messy rc files self-heal on the next install),Verification
sh -n install.shpasses.# dcdmarkers + an old export, ranpersist_path5× → every run converged to exactly 1 begin / 1 end / 0 bare markers / 1 export, with all user lines preserved.Ships live via
get.devicecloud.dev(servesinstall.shraw fromdev, ~5 min cache) once merged.