-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsetup.sh
executable file
·35 lines (29 loc) · 1.53 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Install Rust toolchain and other dependencies.
# WARNING: using this script might mess up your existing rust installation
# Change $INSTALL_HOME if you would like Rust to be installed somewhere else.
# Sample usage:
# INSTALL_HOME=~/large ./setup.sh
echo "Setting up Rust build environemnt for RedLeaf"
USR_HOME=`printenv HOME`
INSTALL_HOME=${INSTALL_HOME:-$USR_HOME} # Default install path is $HOME.
CARGO_HOME=$INSTALL_HOME/.cargo
RUSTUP_HOME=$INSTALL_HOME/.rustup
RUST_HOME=$CARGO_HOME/bin
# Install Rust and Cargo dependencies
echo -e "Cargo home: $CARGO_HOME\nRustup home: $RUSTUP_HOME"
curl https://sh.rustup.rs -sSf | CARGO_HOME=$CARGO_HOME RUSTUP_HOME=$RUSTUP_HOME bash -s -- --default-toolchain nightly -y
$RUST_HOME/rustup component add llvm-tools-preview rust-src
$RUST_HOME/cargo install stack-sizes cargo-expand
# # Setup CARGO_HOME and RUSTUP_HOME if using custom installation home
if [ $USR_HOME != $INSTALL_HOME ] && [ $(grep -q "CARGO_HOME\|RUSTUP_HOME" ~/.profile) ]
then
echo -e "\nAdding CARGO_HOME and RUSTUP_HOME to ~/.profile\n"
echo -e "\nexport CARGO_HOME=$CARGO_HOME\nexport RUSTUP_HOME=$RUSTUP_HOME" | tee -a ~/.profile
echo ""
fi
# Install apt dependencies: Qemu, nasm, Grub, Xorriso
sudo apt-get update
sudo apt-get install qemu nasm grub-pc-bin xorriso numactl clang -y
echo "To get started you need Cargo's bin directory ($CARGO_HOME/bin) in your PATH environment variable. Next time you log in this will be done automatically."
echo "To configure your current shell run 'source $CARGO_HOME/env'"