-
Notifications
You must be signed in to change notification settings - Fork 3
/
package_anticheat.sh
executable file
·98 lines (88 loc) · 2.51 KB
/
package_anticheat.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
95
96
97
98
#!/bin/bash
productId="36e0587a4c3544e8b635f7f55e7ccbfe"
function createHashCatalogue() {
local binDir=$1
local configFile=$2
# clean up hash catalogue
rm -rf "$binDir/EasyAntiCheat/Certificates"
pushd integritytool || exit
echo ./anticheat_integritytool -productid "$productId" -target_game_dir "../$binDir" "$configFile"
./anticheat_integritytool -productid "$productId" -target_game_dir "../$binDir" "$configFile"
popd || exit
}
function pack() {
local platform=$1
local target="$platform"
shift
if [[ "0" != "$#" ]]; then
target=$1
fi
# set version in source
cp src/p1xbraten/version.cpp src/p1xbraten/version.cpp.orig
local version=$(git describe)
sed -i "s/<git-dev>/$version/" src/p1xbraten/version.cpp
# make binaries
make "$target" || exit
# restore git-dev version
rm src/p1xbraten/version.cpp
mv src/p1xbraten/version.cpp.orig src/p1xbraten/version.cpp
# create hash catalogue
local binDir="bin_unix"
local configFile="linux.cfg"
case "$platform" in
windows)
binDir="bin64"
configFile="windows.cfg"
;;
macos)
binDir="bin_macos"
configFile="macos.cfg"
;;
esac
createHashCatalogue $binDir $configFile
# zip up files
local files=(
"bin_unix"
"p1xbraten.sh"
"anticheat.sh"
)
case "$platform" in
windows)
rm -f dist/p1xbraten_setup*
cp src/windows/p1xbraten.nsi src/windows/p1xbraten.nsi.orig
sed -i "s/<git-dev>/$version/" src/windows/p1xbraten.nsi
makensis src/windows/p1xbraten.nsi
mv p1xbraten_setup_* dist/
rm src/windows/p1xbraten.nsi
mv src/windows/p1xbraten.nsi.orig src/windows/p1xbraten.nsi
;; # break
macos)
files=(
"sauerbraten.app/Contents/MacOS"
"sauerbraten.app/Contents/Libraries"
)
;& # fallthrough
*) # macos & linux
mkdir -p dist
rm -rf dist/p1xbraten_"$platform"_*.zip
zip -r dist/p1xbraten_"$platform"_"$version".zip "${files[@]}"
;;
esac
}
platform=$1
case "$platform" in
linux)
pack "$platform" "debian"
;;
windows | macos)
pack "$platform"
;;
all)
pack "linux" "debian"
pack "windows"
pack "macos"
;;
*)
echo "unknown platform $platform"
;;
esac