Skip to content

Comments

Extend binary installer to support the new /stable endpoint#202

Open
Leonidas-from-XIV wants to merge 4 commits intoocaml-dune:mainfrom
Leonidas-from-XIV:installer-support
Open

Extend binary installer to support the new /stable endpoint#202
Leonidas-from-XIV wants to merge 4 commits intoocaml-dune:mainfrom
Leonidas-from-XIV:installer-support

Conversation

@Leonidas-from-XIV
Copy link
Contributor

This PR extends the binary install script with support for querying the /stable endpoint and extends the website to mention it. I thought it would be neat if the website mentioned the latest release so this is exactly what it does now.

I took the sh -s trick from dune-bin-install, however I am unsure how the call should look like. The way sh -s works is it sets argv, even including argv[0]. This means that we always have to pass some argument to sh -s to fill argv[0] before filling the rest of argv.

In the current state of this PR I just tell people to pass - as it doesn't really matter what argv[0] is, but arguably that's a bit ugly. dune-bin-install handles it by pretending argv[0] is a proper argument (instead of just the executable name) and parses the version information out of it, which allows it to avoid one argument to sh -s.

As I see it there are multiple ways of handling this:

  1. Keep it as is, require sh -s <RANDOM> <ACTUAL_ARGS> (this PR currently sets <RANDOM> to -)
  2. Copy dune-bin-install and interpret argv[0] as version (| sh -s 3.21.1)
  3. Do some switcheroo and start parsing command line arguments from argv[0] ($0 in shell) instead of the usual argv[1] ($1), that way we could do | sh -s --release 3.21.1

The latter two are a bit wonky because if someone downloads the script and then calls it (with ./install or so) then argv[0] will be set to ./install (or so), thus we have to handle the cases of "launch from shell" and "pipe into sh" quite differently.

Your insights and ideas are greatly appreciated.

Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
@Alizter
Copy link
Collaborator

Alizter commented Feb 20, 2026

Did you run the server locally and test the script?

@Leonidas-from-XIV
Copy link
Contributor Author

Yes, I ran the server and it displays the new line with the right stable version. I've also tested installation of stable and nightly versions on an alpine:3.23 container (both work).

@Leonidas-from-XIV
Copy link
Contributor Author

@Alizter Do you have any opinion on the sh -s behavior? Should we keep it at | sh -s - --release 3.19.0?

@Alizter
Copy link
Collaborator

Alizter commented Feb 20, 2026

I think - is best. We don't want to be too creative or cause surprises. We should make sure this command is copy-pastable from the website for the release versions anyway.

@Leonidas-from-XIV
Copy link
Contributor Author

I think - is best. We don't want to be too creative or cause surprises.

Perfect! In fact it could be anything else as well (e.g. --), it just needs to be there fill up argv[0].

We should make sure this command is copy-pastable from the website for the release versions anyway.

Yes, that's part of this PR. In lib/main.mlx I am generating the command to install a stable release.

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