Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow XDG base dir spec in install script #49

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

arockett
Copy link

@arockett arockett commented Mar 23, 2024

#370


  • Implement: modify install script to use $XDG_BIN_HOME as install dir and default to $HOME/.local/bin if $XDG_BIN_HOME doesn't exist
  • Implement: modify sst upgrade command to use the same logic for determining the install dir
  • Test: run install script with
    • $XDG_BIN_HOME set and already in $PATH
    • $XDG_BIN_HOME set and not in $PATH
    • $XDG_BIN_HOME not set
  • Test: verify sst upgrade works as expected
    • build sst executable and manually install
    • run sst upgrade and verify it uses the $XDG_BIN_HOME dir

@thdxr
Copy link
Contributor

thdxr commented Mar 26, 2024

hey we actually overhauled our install script - do you mind fixing conflicts? this is a good fix - we also need to update our sst upgrade command to respect it

@arockett
Copy link
Author

Ah yes, I found the place starting @ https://github.com/sst/ion/blob/dev/pkg/global/upgrade.go#L78 to align the sst upgrade command with this change. I'll have time next week Monday to get to this and I'll make sure to pull in the latest install script changes.

@arockett arockett force-pushed the refactor/align-install-with-xdg-spec branch 2 times, most recently from 20f9cb6 to 65624ba Compare April 2, 2024 00:53
@arockett
Copy link
Author

arockett commented Apr 2, 2024

Ok this is ready for another review.

I want to call your attention to some details which I added in the commit description about prior sst installs:

An existing install in the ~/.sst/bin dir is not removed during the `sst
upgrade` command nor is the $PATH modified by `sst upgrade`.

When there is an existing install of sst prior to this commit, the
safest upgrade path is to:
1. delete the ~/.sst dir
2. remove ~/.sst/bin from $PATH by editing the right shell cfg file
3. rerun the install script

The most unexpected situation arises when a user has

  • installed a version of sst prior to this commit
  • added ~/.sst/bin to their PATH
  • does not have $XDG_BIN_HOME on their $PATH, and
  • runs sst upgrade to get latest version instead of using the install script

In that situation, running sst upgrade will install the latest sst bin including this change at the old ~/.sst/bin location... still works, then next time sst upgrade is run it will install the latest sst to the new location which is not on the $PATH and print to the console "upgraded to version XXX" even though running sst version will still pick up the old one in the ~/.sst/bin dir.

Since it's early in the life of sst/ion I wasn't sure if you consider it important to handle this worst case situation more gracefully and want to ask your thoughts before adding extra complexity. If you're ok with just recommending a "clean install" for that situation then I think this PR is ready to merge.

If you think the worst case upgrade scenario needs a better solution, I could do something easy in the upgrade command like

  • delete ~/.sst dir if it exists
  • check that install bin dir is on the $PATH and if it isn't print a message to the console

Thoughts?

@arockett arockett force-pushed the refactor/align-install-with-xdg-spec branch from 65624ba to c6a4087 Compare April 12, 2024 16:46
@arockett arockett force-pushed the refactor/align-install-with-xdg-spec branch from c6a4087 to 9f822a0 Compare April 22, 2024 23:38
@arockett arockett force-pushed the refactor/align-install-with-xdg-spec branch 3 times, most recently from 8b21eff to 9112e6e Compare May 10, 2024 02:39
An existing install in the ~/.sst/bin dir is not removed during the `sst
upgrade` command nor is the $PATH modified by `sst upgrade`.

When there is an existing install of sst prior to this commit, the
safest upgrade path is to:
1. delete the ~/.sst dir
2. remove ~/.sst/bin from $PATH by editing the right shell cfg file
3. rerun the install script
@arockett arockett force-pushed the refactor/align-install-with-xdg-spec branch from 9112e6e to b1027d3 Compare May 14, 2024 00:41
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.

None yet

2 participants