]> WPIA git - cassiopeia.git/blob - scripts/getLibDetectColl.sh
fix: use correct prepared statement for writing logs
[cassiopeia.git] / scripts / getLibDetectColl.sh
1 #!/bin/bash
2
3 DETECTCOLL='lib/collissiondetect'
4 DETECTCOLL_URL='https://marc-stevens.nl/research/software/download.php?file=libdetectcoll-0.2.zip'
5
6 # Download source archive ...
7 wget -q -O "$DETECTCOLL/source.zip" "$DETECTCOLL_URL" || exit 1
8
9 #echo > "$DETECTCOLL/source.zip"
10
11 # Check SHA-512 and Whirlpool digests ...
12 echo "Verification (SHA-512) ..."
13 [ "d72153f1592628e31201cde17ce97f17fc83aeb65a6db075dfe1f21686d28e8068987215996c5c36f067819d16896fc75f7d990bf26cdb1472d61bf1b1d3c96c" = "$(sha512sum "$DETECTCOLL/source.zip"|cut '-d ' -f1)" ] || exit 2
14
15 echo "Verification (Whirlpool) ..."
16 [ "eaa3570095f3b60173241d9990c8da4b5bae5ef5f85880015918707275cb1cd556e6176d72c651085f05c8a2560d46431c5236acd116a7a862e128b0e35f3e37" = "$(openssl whirlpool -hex -r "$DETECTCOLL/source.zip"|cut '-d ' -f1)" ] || exit 2
17
18 # Unzip the code ...
19 echo "Unzipping $DETECTCOLL/source.zip ..."
20 pushd "$DETECTCOLL"
21 unzip -a "source.zip"
22 mv libdetectcoll-*/ "libdetectcoll"
23 popd
24
25 # Sorting extracted files ...
26 echo "Moving things around $DETECTCOLL/source.zip ..."
27 pushd "$DETECTCOLL/libdetectcoll"
28 mv "tests" "../tests"
29
30 mkdir -p "../lib"
31 mv libdetectcoll.c ../lib/
32 mv libdetectcoll.h ../lib/
33
34 mkdir -p "../src"
35 mv main.c ../src/
36
37 mv README ../
38 mv LICENSE ../
39
40 mv Makefile ../
41 popd
42
43 echo "Cleaning up ..."
44 rm -r "$DETECTCOLL/libdetectcoll"