Repository navigation
fix(install): replace the flashduty already on PATH by default - #233
Merged
Merged
Conversation
Without FLASHDUTY_INSTALL_DIR the installer always targeted /usr/local/bin. When the active flashduty lives elsewhere (for example ~/.local/bin from the installer's own non-interactive fallback, or ~/go/bin), an upgrade installed a second copy that the earlier PATH entry kept shadowing, so `flashduty version` still reported the old release. `flashduty update` from releases before v1.5.11 hits the same path, since those releases do not pass the running binary's location to the installer. - Default the install directory to that of the flashduty found on PATH, falling back to /usr/local/bin for fresh installs. - After installing, warn when the shell still resolves a different copy. Directories are compared, so dash's "<dir>//flashduty" output for a trailing-slash PATH entry does not raise a false warning. - Refuse to run when FLASHDUTY_MANAGED_BY_RUNNER=1, matching `flashduty update`: flashduty-runner ships and verifies its own copy.
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.
Problem
Without
FLASHDUTY_INSTALL_DIR,install.shalways installs to/usr/local/bin. If theflashdutythe shell runs lives elsewhere (~/.local/binfrom the installer's own non-interactive fallback,~/go/binfromgo install, …), an upgrade drops a second copy into/usr/local/binthat the earlier PATH entry keeps shadowing:flashduty updatein v1.5.11+ passes the running binary's location, but releases up to v1.5.10 do not, and they fetch the latestinstall.shfrom the CDN — so fixing the installer also repairs their nextupdate. Re-running the documentedcurl … | shhits the same problem on any version.Change
flashduty($INSTALLED_NAME) found on PATH; fresh installs still use/usr/local/bin. ExplicitFLASHDUTY_INSTALL_DIRis unchanged.<dir>//flashdutyoutput for trailing-slash PATH entries doesn't false-alarm.FLASHDUTY_MANAGED_BY_RUNNER=1, matchingflashduty update: flashduty-runner ships its own copy.Tests
New cases in
tests/install_sh_sudo_test.sh: replaces the copy on PATH (with a trailing-slash PATH entry), warns when a non-writable copy on PATH shadows the fallback install, refuses under the runner flag. All three fail against the previousinstall.shand pass now./bin/sh= dash): shellcheck + full test script pass.FLASHDUTY_INSTALL_DIR→ replaced in place,flashduty versionreports 1.5.22, nothing written to/usr/local/binor~/.local/bin; withFLASHDUTY_MANAGED_BY_RUNNER=1→ exits 1 before downloading.Rollout note
The
install-scriptsworkflow mirrorsinstall.shto the CDN on merge to main, and the CDN caches it, so the cache forflashduty-cli/install.shneeds a refresh after merge. Windowsinstall.ps1is unchanged.