-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmkreference.sh
More file actions
executable file
·43 lines (36 loc) · 836 Bytes
/
mkreference.sh
File metadata and controls
executable file
·43 lines (36 loc) · 836 Bytes
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
#!/bin/bash
# builder for the reference output archive, given a folder it tries to
# build every source folder with testbuild.sh and if succesful compres
# it into an archive.
REFERENCEDIR="referenceoutput/"
REFERENCETAR="referenceoutput.tar.gz"
function printUsage() {
echo "mkreference.sh SOURCE_DIR"
exit 1
}
if [ $# -lt 1 ] ;
then
echo "No Source folder"
printUsage
fi
if [ ! -d "$1" ]
then
echo "Non existent source folder"
printUsage
fi
if [ -d "$REFERENCEDIR" ]
then
rm -r "$REFERENCEDIR"
fi
cp -r "$1" "$REFERENCEDIR"
for TARGET in $(find "$REFERENCEDIR" -mindepth 1 -maxdepth 1 -type d)
do
./testbuild.sh "$TARGET"
if [ $? -ne 0 ]
then
echo "compiling failed for $TARGET"
rm -r "$REFERENCEDOR"
exit 1
fi
done
tar -z -cf "$REFERENCETAR" "$REFERENCEDIR"