Skip to content

config: install files from the local checkout when there is one - #15

Open
presto8 wants to merge 1 commit into
mainfrom
feat/local-file-first
Open

presto8 wants to merge 1 commit into
mainfrom
feat/local-file-first

Conversation

@presto8

@presto8 presto8 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

get_prestobuntu_file always fetched from raw.githubusercontent.com, so
running 'bash setup' from a clone overwrote ~/.config/nvim/init.lua,
~/.gitconfig, tmux.conf and the rest with the versions published on
main -- not the ones sitting next to the script. Editing a config file
and re-running the installer silently discarded the edit, which makes
the README's 'inspect and verify the script' workflow misleading.

Prefer $PRESTOBUNTU_DIR/ when the script is running from a file,
and fall back to the download otherwise. Set PRESTOBUNTU_FORCE_DOWNLOAD=1
to keep the old always-fetch behaviour.

PRESTOBUNTU_DIR is deliberately left empty when the script is piped
into bash: BASH_SOURCE is empty in that case and 'dirname ""' yields
".", which would treat an unrelated current directory as a checkout
and install any same-named file found there. Verified the resolution
is correct both as a file and under 'cat setup | bash'.

Also makes $base local; it was leaking into the global namespace.


🤖 Generated with Claude Code

get_prestobuntu_file always fetched from raw.githubusercontent.com, so
running 'bash setup' from a clone overwrote ~/.config/nvim/init.lua,
~/.gitconfig, tmux.conf and the rest with the versions published on
main -- not the ones sitting next to the script. Editing a config file
and re-running the installer silently discarded the edit, which makes
the README's 'inspect and verify the script' workflow misleading.

Prefer $PRESTOBUNTU_DIR/<name> when the script is running from a file,
and fall back to the download otherwise. Set PRESTOBUNTU_FORCE_DOWNLOAD=1
to keep the old always-fetch behaviour.

PRESTOBUNTU_DIR is deliberately left empty when the script is piped
into bash: BASH_SOURCE is empty in that case and 'dirname ""' yields
".", which would treat an unrelated current directory as a checkout
and install any same-named file found there. Verified the resolution
is correct both as a file and under 'cat setup | bash'.

Also makes $base local; it was leaking into the global namespace.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped, matches the stated problem, and preserves the existing download fallback behavior with a clear opt-out flag.

Pull request overview

This PR updates the setup installer to prefer configuration files from a local prestobuntu checkout (when the script is executed from a file) instead of always downloading from raw.githubusercontent.com, preventing local edits from being silently overwritten.

Changes:

  • Detects the script’s on-disk directory via BASH_SOURCE and stores it in PRESTOBUNTU_DIR (left empty when running from stdin).
  • Updates get_prestobuntu_file to install from $PRESTOBUNTU_DIR/<name> when available, with PRESTOBUNTU_FORCE_DOWNLOAD=1 to force remote downloads.
  • Makes the GitHub raw URL base variable local to avoid leaking it globally.
File summaries
File Description
setup Prefer installing config files from a local checkout when available; add an env override to force downloads; scope URL base locally.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants