-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
102 lines (76 loc) · 2.38 KB
/
install.sh
File metadata and controls
102 lines (76 loc) · 2.38 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
#!/usr/bin/env bash
set -Eeuo pipefail
#######################################
# Utilities
#######################################
log() {
echo -e "[ApolloSimFuzz] $*"
}
error() {
echo -e "[ApolloSimFuzz][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
#######################################
# Conda environment setup
#######################################
env_name="apollosimfuzz-${apollo_version}"
# Initialize conda
if ! command -v conda &> /dev/null; then
error "Conda not found. Please install Anaconda/Miniconda first."
fi
eval "$(conda shell.bash hook)"
if conda info --envs | awk '{print $1}' | grep -qx "${env_name}"; then
log "Conda environment '${env_name}' already exists. Skipping creation."
else
log "Creating conda environment '${env_name}'..."
conda create -n "${env_name}" python=3.7 -y
fi
log "Activating conda environment '${env_name}'..."
conda activate "${env_name}"
#######################################
# Python dependencies
#######################################
if [[ ! -f requirements.txt ]]; then
error "requirements.txt not found"
fi
log "Installing Python dependencies..."
python -m pip install -r requirements.txt
#######################################
# TrafficSandbox setup - create docker images
#######################################
if [[ ! -d TrafficSandbox ]]; then
error "TrafficSandbox directory not found"
fi
if [[ ! -f TrafficSandbox/build.sh ]]; then
error "TrafficSandbox/build.sh not found"
fi
log "Installing TrafficSandbox..."
(
cd TrafficSandbox || exit 1
bash build.sh
)
#######################################
# Done
#######################################
log "Installation completed successfully."
log "Can use conda environment: ${env_name}"