Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·65 lines (45 loc) · 1.8 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·65 lines (45 loc) · 1.8 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -e
echo "========== Installing system dependencies =========="
# libpcap development headers
sudo apt update || echo "apt update failed, continuing..."
sudo apt install -y libpcap-dev curl build-essential pkg-config || echo "apt install failed, continuing..."
echo "========== Installing Rust (rustup) =========="
if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
else
echo "Rustup already installed, skipping."
fi
echo "========== Installing Rust toolchains =========="
rustup install stable
rustup toolchain install nightly --component rust-src
rustup default stable
echo "========== Installing bpf-linker =========="
ARCH="$(uname -m)"
OS="$(uname -s)"
if [[ "$OS" == "Linux" && "$ARCH" == "x86_64" ]]; then
cargo install cargo-binstall --locked
cargo binstall -y bpf-linker || echo "bpf-linker already installed"
else
echo "Non-x86_64 or non-Linux detected."
echo "Installing llvm and bpf-linker without default features."
# macOS or other architectures
if command -v brew >/dev/null 2>&1; then
brew install llvm
else
echo "Homebrew not found. Please install llvm manually."
fi
cargo install --no-default-features bpf-linker || echo "bpf-linker already installed"
fi
echo "========== Ubuntu 20.04 specific linux-tools (optional) =========="
VMLINUX_DIR="/usr/lib/linux-tools/5.8.0-63-generic"
if [[ -d "$VMLINUX_DIR" ]]; then
export PATH="$VMLINUX_DIR:$PATH"
echo "Added $VMLINUX_DIR to PATH"
else
echo "linux-tools-5.8.0-63-generic not found."
echo "If you are on Ubuntu 20.04, you may need:"
echo " sudo apt install linux-tools-5.8.0-63-generic && export PATH=/usr/lib/linux-tools/5.8.0-63-generic:$PATH"
fi
echo "========== Setup completed =========="