forked from gruppe-adler/TvT_GameOfGuns.Altis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
94 lines (73 loc) · 1.79 KB
/
build.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
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
#!/bin/bash
# change this to your local cpbo path, in case cpbo.exe is not in the current dir
cpbo_path="$1"
missionname="TvT_GameOfGuns"
islands=(
Altis
Beketov
Chernarus
Desert_Island
fata
mbg_celle2
Porto
Sara_dbe1
Stratis
SugarLake
Takistan
Tanoa
taviana
utes
Zargabad
)
### AS AS USER, DONT EDIT BELOW THIS LINE ###
if [[ ! -f $cpbo_path ]]; then
cpbo_path="./cpbo.exe"
fi
if [[ ! -f $cpbo_path ]]; then
echo "warning: cpbo path not found, will not build pbo files!"
exit 1
fi
head=`git reflog --decorate -1 --no-color`
# if possible, use current tag...
#version=`echo $head | grep -o -E 'tag: \w+' | sed -e 's/tag: //'`
version=`echo $head | sed -re 's/^.*tag: ([0-9a-z\.\-]+).*$/\1/'`
if [[ "$head" == "$version" ]]; then
# ...if not, use commit hash
# version=`echo $head | grep --color=never -o -E '^[0-9a-f]+'`
version=`echo $head | sed -re 's/^([0-9a-f]+).*$/\1/g'`
fi
echo "current version: $version"
if [[ $version == "" ]]; then
echo "cant find tag OR commit hash. are you sure we're having a .git directory here?"
exit 2
fi
cwd=`pwd`
builddir="$cwd/../tmp-build"
mkdir -p "$builddir"
tmpdir="$builddir/tmpdir"
cp -r ./ "$tmpdir"
rm "$tmpdir/build.sh"
rm "$tmpdir/cpbo.exe"
rm "$tmpdir/README.md"
rm -fr "$tmpdir/.git"
rm "$tmpdir/.gitattributes"
rm "$tmpdir/.gitignore"
rm "$tmpdir/addUniformHelper.sqf"
rm "$tmpdir/addWeaponsHelper.sqf"
echo "building PBO...";
$cpbo_path -y -p "$tmpdir" > /dev/null
echo "done (probably)"
pbofilename="${tmpdir}.pbo"
if [[ ! -f "$pbofilename" ]]; then
echo "örks"
exit 2
fi
echo "copying pbo for different islands..."
for island in "${islands[@]}"; do
cp "$pbofilename" "${builddir}/${missionname}_${version}.${island}.pbo"
done
echo "done. clean up..."
rm -r "$tmpdir"
rm "$pbofilename"
echo "plz see $builddir for pbo files"
sleep 2