Skip to content

Commit 59fe49d

Browse files
committed
chore: Match on HTTP git and handle when root
1 parent 36d25ff commit 59fe49d

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

install_deb.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@
22
# Installs dependencies, builds Silverfish, and places it into your path
33
# Be sure to validate the Rust and LLVM install scripts we invoke below!
44

5+
sudo="sudo"
6+
if [[ $(whoami) == "root" ]]; then
7+
sudo=""
8+
fi
9+
510
# Exit if not executing script from project root because we use relative paths
611
# We want to match without case because the URL of the git repo is case insensitive, but the resulting
712
# directory is case sensitive. Thus, we can end up with either "aWsm" or "awsm."
813
shopt -s nocasematch
9-
if [[ $(git remote get-url origin) != *"/aWsm.git" || $(git rev-parse --show-toplevel) != $(pwd) ]]; then
14+
if [[ $(git remote get-url origin) != *"/awsm"* || $(git rev-parse --show-toplevel) != $(pwd) ]]; then
1015
echo "Install script must be run from project root."
1116
exit 1
1217
fi
1318
shopt -u nocasematch
1419

1520
# Install Build Dependencies
16-
sudo apt install build-essential --yes
17-
sudo apt install cmake --yes
21+
$sudo apt install build-essential --yes
22+
$sudo apt install cmake --yes
23+
$sudo apt install lsb-release wget software-properties-common --yes
1824

1925
# Initialize Wasmception submodule
2026
# Check to see if ./wasmception directory exists and is not empty.
@@ -38,13 +44,13 @@ source "$HOME/.cargo/env"
3844
export PATH="$HOME/.cargo/bin:$PATH"
3945

4046
# Install LLVM build dependencies
41-
LLVM_VERSION=9
42-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" bash $LLVM_VERSION
43-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100
44-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION 100
45-
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-$LLVM_VERSION 100
46-
sudo apt install libc++-dev libc++abi-dev --yes
47+
LLVM_VERSION=11
48+
$sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" bash $LLVM_VERSION
49+
$sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100
50+
$sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION 100
51+
$sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-$LLVM_VERSION 100
52+
$sudo apt install libc++-dev libc++abi-dev --yes
4753

4854
# Build and install Silverfish
4955
cargo build --release
50-
sudo cp -t /usr/bin ./target/release/silverfish
56+
$sudo cp -t /usr/bin ./target/release/silverfish

0 commit comments

Comments
 (0)