-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
34 lines (30 loc) · 1.17 KB
/
publish.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
# /bin/bash
workdir=$(dirname "$0")
pushd $workdir
rm -rf _publish
# dotnet clean src # IDE goes haywire because of codegen
dotnet publish src/SwApiNet.Exports -o _publish || exit 1
rfg_path='/c/Program Files (x86)/Steam/steamapps/common/Red Faction Guerrilla Re-MARS-tered'
dll="$rfg_path/sw_api.dll"
original="$rfg_path/sw_api_original.dll"
gog_dll_hash='67f9f8e976157ebf6e8ea2fc93681a102f513fefd11998273eeb8da743cbe71f'
original_hash=$(sha256sum "$original" 2>/dev/null | cut -d' ' -f1)
if [ -z "${original_hash}" ]; then
# original.dll does not exist, create it
dll_hash=$(sha256sum "$dll" 2>/dev/null | cut -d' ' -f1)
if [ $dll_hash != $gog_dll_hash ]; then
echo "Your sw_api.dll is not expected version! use the one from GOG"
exit 1
fi
cp "$dll" "$original"
echo "Created $original"
fi
original_hash=$(sha256sum "$original" 2>/dev/null | cut -d' ' -f1)
if [ $original_hash != $gog_dll_hash ]; then
echo "Your sw_api_original.dll is not expected version! use the one from GOG"
exit 1
fi
rm "$rfg_path/sw_api.dll"
find "$rfg_path" -maxdepth 1 -type f -name 'SwApiNet.*' -delete
cp _publish/* "$rfg_path"
echo "Copied build to $rfg_path"