diff --git a/install_deb.sh b/install_deb.sh index 0561494a..1ec42579 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -2,19 +2,25 @@ # Installs dependencies, builds Silverfish, and places it into your path # Be sure to validate the Rust and LLVM install scripts we invoke below! +sudo="sudo" +if [[ $(whoami) == "root" ]]; then + sudo="" +fi + # Exit if not executing script from project root because we use relative paths # We want to match without case because the URL of the git repo is case insensitive, but the resulting # directory is case sensitive. Thus, we can end up with either "aWsm" or "awsm." shopt -s nocasematch -if [[ $(git remote get-url origin) != *"/aWsm.git" || $(git rev-parse --show-toplevel) != $(pwd) ]]; then +if [[ $(git remote get-url origin) != *"/awsm"* || $(git rev-parse --show-toplevel) != $(pwd) ]]; then echo "Install script must be run from project root." exit 1 fi shopt -u nocasematch # Install Build Dependencies -sudo apt install build-essential --yes -sudo apt install cmake --yes +$sudo apt install build-essential --yes +$sudo apt install cmake --yes +$sudo apt install lsb-release wget software-properties-common --yes # Initialize Wasmception submodule # Check to see if ./wasmception directory exists and is not empty. @@ -38,13 +44,13 @@ source "$HOME/.cargo/env" export PATH="$HOME/.cargo/bin:$PATH" # Install LLVM build dependencies -LLVM_VERSION=9 -sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" bash $LLVM_VERSION -sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100 -sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION 100 -sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-$LLVM_VERSION 100 -sudo apt install libc++-dev libc++abi-dev --yes +LLVM_VERSION=11 +$sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" bash $LLVM_VERSION +$sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100 +$sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION 100 +$sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-$LLVM_VERSION 100 +$sudo apt install libc++-dev libc++abi-dev --yes # Build and install Silverfish cargo build --release -sudo cp -t /usr/bin ./target/release/silverfish +$sudo cp -t /usr/bin ./target/release/silverfish