-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·59 lines (46 loc) · 1.34 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·59 lines (46 loc) · 1.34 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
#!/bin/bash
# setup.sh - Install dependencies for KEIP
# Supports Debian/Ubuntu (apt)
set -e
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${GREEN}[*] KEIP Setup Script${NC}"
# Check for Root
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}[!] Error: Must run as root${NC}"
exit 1
fi
# Update Apt
echo -e "${GREEN}[*] Updating package lists...${NC}"
apt-get update
# Install Kernel Headers & Tools
KERNEL_VERSION=$(uname -r)
echo -e "${GREEN}[*] Installing dependencies...${NC}"
apt-get install -y \
clang \
llvm \
libelf-dev \
libbpf-dev \
linux-headers-$(uname -r) \
bpftool \
python3-pip \
libcap2-bin \
python3-bpfcc
# Set up Python Virtual Environment
echo -e "${GREEN}[*] Configuring Python environment...${NC}"
apt-get install -y python3-venv
if [ ! -d "keip-env" ]; then
python3 -m venv keip-env
echo -e "${GREEN}[+] Virtual environment 'keip-env' created.${NC}"
fi
# Activate and install deps
source keip-env/bin/activate
pip install --upgrade pip setuptools wheel
# Fix ownership: setup.sh runs as root, but the venv should be owned by the actual user
if [ -n "$SUDO_USER" ]; then
echo -e "${GREEN}[*] Fixing venv ownership for user '$SUDO_USER'...${NC}"
chown -R "$SUDO_USER:$SUDO_USER" keip-env
fi
echo -e "${GREEN}[+] Setup complete${NC}"
echo -e "Run: ${GREEN}sudo ./run_keip.sh${NC}"