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
feat(install): make install script posix compliant #2228
Conversation
I don't really see the value of removing |
Agreed. I removed them because I didn't think dash supported it (default shell in Ubuntu), but will verify. That being said, they are only global in process and the install script is invoked; not evaluated. |
3fbec6a
to
eeb6dd6
Compare
I just realised that modern versions of curl will fail with binary files when not used with a pipe or |
I guess it is time to close #1315 |
@vladimyr Maybe. I recently duplicated a lot of your changes from there so merge conflicts are likely significant. But if you still want to get any of the other changes from that PR merged please rebase it. @dmccaffery Would you please port over |
b3ef498
to
ccef166
Compare
@davidkna I made the requested changes and also added a new GitHub Actions workflow for testing the install across a wide array of environments, including Windows WSL. This is isolated on the last commit in case you do not want to incorporate it. Let me know if there is anything else you need! Link to latest "Installation" workflow: https://github.com/starship/starship/actions/runs/599593982 |
I think it might be better to move the testing changes to a separate PR so this can be merged quickly. |
Agreed. I'll pull the testing out and open a separate PR. |
ccef166
to
a3ce5bf
Compare
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@dmccaffery Thank you for your contributions, and thanks @davidkna for reviewing! |
@dmccaffery No worries I didn't post my comment to criticize but to spare you some time dealing with conversion. I hope it was helpful and you found useful stuff over there 🤞
@davidkna Let's put it this way. I'm in no way emotionally attached to my code but what is the point of duplicating? You could simply continue on top of it or at least copy it completely. Doing neither leads to the omission of important stuff like:
discussed in detail here: #1315 (comment) But yeah, you gave me an interesting option:
🤐 ... Let's get back to the technical track... @davidkna said:
Finally, regardless of all that thanks both of you for your contribution and for moving things forward! 👍 |
FWIW Once the new ShellCheck build gets released we could disable |
To further strengthen my argument about
Switching quickly to
But Android (11) ships with
Apart from the fact it reveals I'm using a bit older Android OS/device 🙃, this is still a fairly modern |
I wasn't aware of your PR.
For the use here (locals in functions) it looks like the implementation differences don't matter at all. The only issue is standard ksh which doesn't support |
Ah, too bad you missed it. However, one way or another installer is finally (almost) POSIX compliant 🎉
It seems we have a consensus here. |
... sure, but imma smack you. 😈 |
As of writing this comment Starship's install instructions (https://github.com/starship/starship/blob/4925764/docs/README.md#install-latest-version) suggest the following: curl -fsSL https://starship.rs/install.sh | bash First, this needs to get changed to (at least): curl -fsSL https://starship.rs/install.sh | sh in order to advertise reaching POSIX compliance to the end-users.
IMHO there are 4 likely types of workflows users may follow to install Starship using the installer script:
So, only in 1 out 4 possible workflows shebang actually comes into the play. In all other workflows, it serves as a mere indicator of POSIX compliance so the user knows which shell to pick/invoke. In the former case, loader decides which shell will get invoked by parsing the shebang which brings me to my point about @dmccaffery's shebang choice https://github.com/starship/starship/blob/4925764/install/install.sh#L1: #!/usr/bin/env sh IMO it is somewhat superfluous. There is hardly any advantage in using
Honestly, I never saw anyone suggesting the use of So, long story short, I'm proposing the following:
|
Description
command
variable tofetch_cmd
as it overloads a posix builtincomplete
function tocompleted
as it overloads the bash builtin for completionMotivation and Context
Bash should not be necessary to run the install script on systems that would otherwise not require it. Ubuntu uses dash by default and I use zsh, so no reason to install bash before installing starship. :)
Closes #2226
Screenshots (if appropriate):
How Has This Been Tested?
Ran install scripts on macOS natively, as well as the following docker containers for linux distributions (not the same as native, but as close as I can get with ease):
Checklist: