Skip to content

Commit

Permalink
Merge pull request #303 from brson/rustup-init
Browse files Browse the repository at this point in the history
Rustup init
  • Loading branch information
brson committed Apr 16, 2016
2 parents 2c4a188 + ce3f464 commit 1a40065
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ path = "src/rustup/lib.rs"
test = false # no unit tests

[[bin]]
name = "rustup-setup"
name = "rustup-init"
path = "src/rustup-cli/main.rs"
test = false # no unit tests
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,34 +379,34 @@ documentation for [multirust] and [multirust-dist].
The primary installation method, as described at
[www.rustup.rs](https://www.rustup.rs), differs by platform:

* On Windows, download and run the [rustup-setup.exe for the
* On Windows, download and run the [rustup-init.exe for the
`i686-pc-windows-gnu` target][setup]. Although this build of
`rustup` installs compilers targeting the GNU ABI by default,
compilers targetting the MSVC ABI can be installed with e.g. `rustup
update stable-msvc`.
* On Unix, run `curl https://sh.rustup.rs -sSf | sh` in your
shell. This downloads and runs the correct version of
`rustup-setup` for your platform.
`rustup-init` for your platform.

[setup]: https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-setup.exe
[setup]: https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe

If you prefer you can directly download `rustup-setup` for the
If you prefer you can directly download `rustup-init` for the
platform of your choice:

- [aarch64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-setup)
- [arm-unknown-linux-gnueabi](https://static.rust-lang.org/rustup/dist/arm-unknown-linux/rustup-setup)
- [arm-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/arm-unknown-linux-gnueabihf/rustup-setup)
- [armv7-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-setup)
- [i686-apple-darwin](https://static.rust-lang.org/rustup/dist/i686-apple-darwin/rustup-setup)
- [i686-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-setup.exe)
- [i686-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-setup.exe)<sup>[](#vs2015)</sup>
- [i686-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/i686-unknown-linux-gnu/rustup-setup)
- [x86_64-apple-darwin](https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-setup)
- [x86_64-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-setup.exe)
- [x86_64-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-setup.exe)<sup>[](#vs2015)</sup>
- [x86_64-unknown-freebsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-freebsd/rustup-setup)
- [x86_64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-setup)
- [x86_64-unknown-netbsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-netbsd/rustup-setup)
- [aarch64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init)
- [arm-unknown-linux-gnueabi](https://static.rust-lang.org/rustup/dist/arm-unknown-linux/rustup-init)
- [arm-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/arm-unknown-linux-gnueabihf/rustup-init)
- [armv7-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init)
- [i686-apple-darwin](https://static.rust-lang.org/rustup/dist/i686-apple-darwin/rustup-init)
- [i686-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe)
- [i686-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-init.exe)<sup>[](#vs2015)</sup>
- [i686-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/i686-unknown-linux-gnu/rustup-init)
- [x86_64-apple-darwin](https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-init)
- [x86_64-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe)
- [x86_64-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe)<sup>[](#vs2015)</sup>
- [x86_64-unknown-freebsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-freebsd/rustup-init)
- [x86_64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init)
- [x86_64-unknown-netbsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-netbsd/rustup-init)

<a name="vs2015">†</a>
MSVC builds of `rustup` additionally require an [installation of
Expand Down
8 changes: 6 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ after_test:
- powershell -File ci/prepare-deploy-appveyor.ps1

artifacts:
- path: dist\$(TARGET)\rustup-init.exe
name: rustup-init
- path: dist\$(TARGET)\rustup-init.exe.sha256
name: rustup-init-sha
- path: dist\$(TARGET)\rustup-setup.exe
name: rustup-setup
- path: dist\$(TARGET)\rustup-setup.exe.sha256
Expand All @@ -68,7 +72,7 @@ deploy:
bucket: dev-static-rust-lang-org
set_public: true
region: us-west-1
artifact: rustup-setup,rustup-setup-sha
artifact: rustup-init,rustup-init-sha,rustup-setup,rustup-setup-sha
folder: rustup
on:
branch: master
Expand All @@ -81,7 +85,7 @@ deploy:
bucket: static-rust-lang-org
set_public: true
region: us-west-1
artifact: rustup-setup,rustup-setup-sha
artifact: rustup-init,rustup-init-sha,rustup-setup,rustup-setup-sha
folder: rustup
on:
branch: stable
5 changes: 5 additions & 0 deletions ci/prepare-deploy-appveyor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ if ($env:APPVEYOR_REPO_BRANCH -eq "auto") {
exit 0
}

# Copy rustup-init to rustup-setup for backwards compatibility
cp target\release\rustup-init.exe target\release\rustup-setup.exe

# Generate hashes
Get-FileHash .\target\release\* | ForEach-Object {[io.file]::WriteAllText($_.Path + ".sha256", $_.Hash.ToLower() + "`n")}

# Prepare bins for upload
$dest = "dist\$env:TARGET"
md -Force "$dest"
cp target\release\rustup-init.exe "$dest/"
cp target\release\rustup-init.exe.sha256 "$dest/"
cp target\release\rustup-setup.exe "$dest/"
cp target\release\rustup-setup.exe.sha256 "$dest/"

Expand Down
7 changes: 6 additions & 1 deletion ci/prepare-deploy-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ if [[ "$TARGET" == "x86_64-unknown-linux-gnu" && "$TRAVIS_BRANCH" == "stable" ]]
#git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages;
fi;

# Copy rustup-init to rustup-setup for backwards compatibility
cp target/$TARGET/release/rustup-init target/$TARGET/release/rustup-setup

# Generate hashes
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
find "target/$TARGET/release/" -maxdepth 1 -type f -exec sh -c 'shasum -a 256 -b "{}" > "{}.sha256"' \;;
Expand All @@ -36,14 +39,16 @@ dest="deploy"
# Prepare bins for upload
bindest="$dest/dist/$TARGET"
mkdir -p "$bindest/"
cp target/$TARGET/release/rustup-init "$bindest/"
cp target/$TARGET/release/rustup-init.sha256 "$bindest/"
cp target/$TARGET/release/rustup-setup "$bindest/"
cp target/$TARGET/release/rustup-setup.sha256 "$bindest/"

if [ "$TARGET" != "x86_64-unknown-linux-gnu" ]; then
exit 0
fi

cp rustup-setup.sh "$dest/"
cp rustup-init.sh "$dest/"

# Prepare website for upload
cp -R www "$dest/www"
4 changes: 2 additions & 2 deletions rustup-setup.sh → rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ main() {
;;
esac

local _url="$RUSTUP_UPDATE_ROOT/$_arch/rustup-setup$_ext"
local _url="$RUSTUP_UPDATE_ROOT/$_arch/rustup-init$_ext"

local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t rustup)"
local _file="$_dir/rustup-setup$_ext"
local _file="$_dir/rustup-init$_ext"

printf "\33[1minfo:\33[0m downloading installer\n"

Expand Down
3 changes: 2 additions & 1 deletion src/rustup-cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ fn run_multirust() -> Result<()> {
multirust_mode::main()
}
Some(n) if n.starts_with("multirust-setup")||
n.starts_with("rustup-setup") => {
n.starts_with("rustup-setup") ||
n.starts_with("rustup-init") => {
// NB: The above check is only for the prefix of the file
// name. Browsers rename duplicates to
// e.g. multirust-setup(2), and this allows all variations
Expand Down
6 changes: 3 additions & 3 deletions src/rustup-cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ pub fn update() -> Result<()> {
pub fn prepare_update() -> Result<Option<PathBuf>> {
let ref cargo_home = try!(utils::cargo_home());
let ref multirust_path = cargo_home.join(&format!("bin/multirust{}", EXE_SUFFIX));
let ref setup_path = cargo_home.join(&format!("bin/rustup-setup{}", EXE_SUFFIX));
let ref setup_path = cargo_home.join(&format!("bin/rustup-init{}", EXE_SUFFIX));

if !multirust_path.exists() {
return Err(Error::NotSelfInstalled(cargo_home.clone()));
Expand All @@ -898,7 +898,7 @@ pub fn prepare_update() -> Result<Option<PathBuf>> {
}));

// Get download URL
let url = format!("{}/{}/rustup-setup{}", update_root, triple, EXE_SUFFIX);
let url = format!("{}/{}/rustup-init{}", update_root, triple, EXE_SUFFIX);

// Calculate own hash
let mut hasher = Hasher::new(Type::SHA256);
Expand Down Expand Up @@ -1009,7 +1009,7 @@ pub fn self_replace() -> Result<()> {

pub fn cleanup_self_updater() -> Result<()> {
let cargo_home = try!(utils::cargo_home());
let ref setup = cargo_home.join(&format!("bin/rustup-setup{}", EXE_SUFFIX));
let ref setup = cargo_home.join(&format!("bin/rustup-init{}", EXE_SUFFIX));

if setup.exists() {
try!(utils::remove_file("setup", setup));
Expand Down
4 changes: 2 additions & 2 deletions src/rustup-mock/src/clitools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ pub fn setup(s: Scenario, f: &Fn(&Config)) {

let current_exe_path = env::current_exe().map(PathBuf::from).unwrap();
let exe_dir = current_exe_path.parent().unwrap();
let ref build_path = exe_dir.join(format!("rustup-setup{}", EXE_SUFFIX));
let ref build_path = exe_dir.join(format!("rustup-init{}", EXE_SUFFIX));

let ref rustup_path = config.exedir.join(format!("rustup{}", EXE_SUFFIX));
let setup_path = config.exedir.join(format!("rustup-setup{}", EXE_SUFFIX));
let setup_path = config.exedir.join(format!("rustup-init{}", EXE_SUFFIX));
let multirust_setup_path = config.exedir.join(format!("multirust-setup{}", EXE_SUFFIX));
let rustc_path = config.exedir.join(format!("rustc{}", EXE_SUFFIX));
let cargo_path = config.exedir.join(format!("cargo{}", EXE_SUFFIX));
Expand Down
Loading

0 comments on commit 1a40065

Please sign in to comment.