The installer.sh and installer.ps1 scripts in cargo-dist are a hybrid of rustup's installer bootstrap scripts and this rust code.
In rustup the installer scripts just handle detecting target triple, unpacking the archive into a tempdir and then run the rustup binary to finish installing itself. Updating rustup at that point is rustup itself doing the fetch and unpack, and again running its new self.
This is honestly the ideal way for an installer to work, as it gives the cli dev all the room in the world to add custom install logic/output in a way that's a pain with shell. Plus, rust code is a lot easier to maintain/test/trust than random shell scripts. In an ideal world we could actually share code with rustup and mutually improve/maintain this updater logic.
There are three features here:
- a cargo-dist setting for "hey (power)shell installers, don't do any install-dir stuff, just run this binary with these arguments"
- an axoupdater setting for "hey just unpack the archive and then run this binary with these arguments"
- an axoupdater library API for "all the logic installer.sh and installer.ps1 do to setup PATH and whatnot" (i.e. rustup's self_update code)
The installer.sh and installer.ps1 scripts in cargo-dist are a hybrid of rustup's installer bootstrap scripts and this rust code.
In rustup the installer scripts just handle detecting target triple, unpacking the archive into a tempdir and then run the rustup binary to finish installing itself. Updating rustup at that point is rustup itself doing the fetch and unpack, and again running its new self.
This is honestly the ideal way for an installer to work, as it gives the cli dev all the room in the world to add custom install logic/output in a way that's a pain with shell. Plus, rust code is a lot easier to maintain/test/trust than random shell scripts. In an ideal world we could actually share code with rustup and mutually improve/maintain this updater logic.
There are three features here: