-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
108 lines (80 loc) · 2.53 KB
/
install.sh
File metadata and controls
108 lines (80 loc) · 2.53 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
set -Eeuo pipefail
PROJECT_NAME="ApolloSimFuzz"
#######################################
# Utilities
#######################################
log() {
echo -e "[${PROJECT_NAME}] $*"
}
error() {
echo -e "[${PROJECT_NAME}][ERROR] $*" >&2
exit 1
}
trap 'error "Command failed at line $LINENO"' ERR
#######################################
# Load Apollo version
#######################################
if [[ ! -f VERSION ]]; then
error "VERSION file not found"
fi
apollo_version="$(cat VERSION)"
log "Current Apollo version: ${apollo_version}"
apollo_tag="v${apollo_version}.0"
apollo_repo="https://github.com/ApolloAuto/apollo.git"
#######################################
# Clone Apollo (if not exists)
#######################################
if [[ -d apollo ]]; then
log "Apollo repository already exists. Skipping clone."
else
log "Cloning Apollo (${apollo_tag})..."
git clone -b "${apollo_tag}" "${apollo_repo}" apollo
fi
#######################################
# Apply Apollo patches
#######################################
if [[ ! -d apollo_bridge/patches ]]; then
error "apollo_bridge/patches directory not found"
fi
log "Applying Apollo patches..."
cp apollo_bridge/patches/dev_start_ctn.sh apollo/docker/scripts/dev_start_ctn.sh
log " Copied dev_start_ctn.sh -> apollo/docker/scripts/"
cp apollo_bridge/patches/WORKSPACE apollo/WORKSPACE
log " Replaced apollo/WORKSPACE"
log "Patches applied."
#######################################
# uv environment setup & dependencies
#######################################
python_version="3.8"
if ! command -v uv &> /dev/null; then
error "uv not found. Please install it first: curl -LsSf https://astral.sh/uv/install.sh | sh"
fi
log "Ensuring Python ${python_version} is available..."
uv python install "${python_version}"
log "Syncing project dependencies (uv sync)..."
uv sync --python "${python_version}"
#######################################
# TrafficSandbox Docker image
#######################################
if [[ ! -d TrafficSandbox ]]; then
error "TrafficSandbox directory not found"
fi
if [[ ! -f TrafficSandbox/build.sh ]]; then
error "TrafficSandbox/build.sh not found"
fi
log "Building TrafficSandbox Docker image..."
(
cd TrafficSandbox || exit 1
bash build.sh
)
#######################################
# Done
#######################################
log "Installation completed."
log ""
log "Run commands with:"
log " uv run python start_fuzzer.py ..."
log ""
log "Or activate the environment manually:"
log " source .venv/bin/activate"