forked from fuzztruction/fuzztruction
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheck_env.sh
executable file
·46 lines (38 loc) · 1.4 KB
/
check_env.sh
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
#!/usr/bin/env bash
set -eu
text_red=$(tput setaf 1) # Red
text_green=$(tput setaf 2) # Green
text_bold=$(tput bold) # Bold
text_reset=$(tput sgr0) # Reset your text
function log_error {
echo "${text_bold}${text_red}${1}${text_reset}"
}
function log_success {
echo "${text_bold}${text_green}${1}${text_reset}"
}
function rebuild {
if [[ ! -z "${!PREBUILT_ENV_VAR_NAME:-}" ]]; then
log_error "[!] Environment checks failed, even though this is a prebuilt image."
exit 1
fi
log_success "[+] Building missing files: cd /home/user/fuzztruction/ && cargo build --workspace --all-targets"
cd /home/user/fuzztruction
if ! cargo build --workspace --all-targets; then
log_error "[!] Hmm... build failed... Wrong rustc version?"
exit 1
fi
log_success "[+] Build was successfull!"
log_success "[+] Please execute $0 again to refresh the ld cache"
exit 0
}
log_success "[+] Checking whether libgenerator_agent.so can be found by the linker."
sudo ldconfig
if ! ldconfig -N -v 2>/dev/null | grep -q "libgenerator_agent.so"; then
log_error "[!] Failed to find libgenerator_agent.so!"
rebuild
fi
if ! find ~/fuzztruction/generator -name fuzztruction-source-llvm-pass.so | grep -q .; then
log_error "[!] Failed to find fuzztruction-source-llvm-pass.so !"
rebuild
fi
log_success "[+] Your environment looks superb .. just like you do!"