#!/bin/bash
# Set up the appropriate rustc toolchain
-cd $(dirname $0)
+cd "$(dirname "$0")" || exit
-cargo install rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed"
-RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
-rustup-toolchain-install-master -f -n master $RUSTC_HASH
+if ! command -v rustup-toolchain-install-master > /dev/null; then
+ cargo install \
+ --git https://github.com/kennytm/rustup-toolchain-install-master \
+ --bin rustup-toolchain-install-master \
+ --debug
+fi
+
+rustup-toolchain-install-master -f -n master -c rustc-dev
rustup override set master