Add specific toolchain for Rust and Electrs build

This commit is contained in:
Taylor Helsper 2021-11-23 20:49:36 -06:00
parent ad77c3b528
commit dbc601dcc7

View File

@ -21,7 +21,23 @@ APP="$1"
# Custom re-install steps
if [ "$APP" = "rust" ] || [ "$APP" = "cargo" ]; then
wget https://sh.rustup.rs -O /tmp/setup_rust.sh
/bin/bash /tmp/setup_rust.sh -y
/bin/bash /tmp/setup_rust.sh -y --default-toolchain none
sync
if [ -f $HOME/.cargo/env ]; then
# Remove old toolchains
source $HOME/.cargo/env
TOOLCHAINS=$(rustup toolchain list)
for toolchain in $TOOLCHAINS; do
if [[ "$toolchain" == *"linux"* ]] && [[ "$toolchain" != *"${RUST_VERSION}"* ]]; then
rustup toolchain remove $toolchain || true
fi
done
# Install and use desired version
rustup install $RUST_VERSION
rustup default $RUST_VERSION
rustc --version
fi
elif [ "$APP" = "electrs" ]; then
mkdir -p /home/admin/download
cd /home/admin/download
@ -37,7 +53,7 @@ elif [ "$APP" = "electrs" ]; then
mv electrs-* electrs
cd electrs
cargo build --release
cargo +$RUST_VERSION build --release
sudo install -g root -o root target/release/electrs /usr/bin/electrs
cd ~
else