forked from MISP/misp-packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_vbox.sh
executable file
·42 lines (37 loc) · 1.36 KB
/
build_vbox.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
#!/usr/bin/env bash
GOT_PACKER=$(which packer > /dev/null 2>&1; echo $?)
if [[ "$GOT_PACKER" == "0" ]]; then
echo "Packer detected, version: $(packer -v)"
PACKER_RUN=$(which packer)
else
echo "No packer binary detected, please make sure you installed it from: https://www.packer.io/downloads.html"
exit 1
fi
# SHAsums to be computed
SHA_SUMS="1 256 384 512"
checkInstaller () {
for sum in $(echo ${SHA_SUMS}); do
/usr/bin/wget -q -O scripts/INSTALL.sh.sha${sum} https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh.sha${sum}
INSTsum=$(shasum -a ${sum} scripts/INSTALL.sh | cut -f1 -d\ )
chsum=$(cat scripts/INSTALL.sh.sha${sum} | cut -f1 -d\ )
if [[ "$chsum" == "$INSTsum" ]]; then
echo "sha${sum} matches"
else
echo "sha${sum}: ${chsum} does not match the installer sum of: ${INSTsum}"
echo "Deleting installer, please run again."
rm scripts/INSTALL.sh
exit 1
fi
done
}
# Fetch and check installer
if [[ -f "scripts/INSTALL.sh" ]]; then
echo "Checking checksums"
checkInstaller
else
/usr/bin/wget -q -O scripts/INSTALL.sh https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh
checkInstaller
fi
# Fetching latest MISP LICENSE
[[ ! -f /tmp/LICENSE-misp ]] && wget -q -O /tmp/LICENSE-misp https://raw.githubusercontent.com/MISP/MISP/2.4/LICENSE
packer build -only=virtualbox-iso misp.json