Compare commits

...

7 commits

3 changed files with 15 additions and 11 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1,8 +1,11 @@
#!/usr/bin/env bash
# exit on any error to avoid showing everything was successfull even though it wasnt
# Exit on any error to avoid showing everything was successfull even though it wasnt
set -eou pipefail
# We want to move hidden files too
shopt -s dotglob
# Patching user variables
OSCHOICE="linux"
AM2RZIP=""
@ -111,10 +114,13 @@ patch_am2r ()
# When attempting to link to newer versions, an error is raised at runtime claiming it cannot find
# the outdated version of OpenSSL, even though it has been patched to link to the newer version.
# After replacing it with libcurl, versioning is ignored, and the binary starts just fine.
echo "Patching insecure OpenSSL dependency with libcurl..."
patchelf "$GAMEDIR/runner" \
--replace-needed "libcrypto.so.1.0.0" "libcurl.so" \
--replace-needed "libssl.so.1.0.0" "libcurl.so"
# Currently, patchelf has a bug where this does not work correctly
# So it will stay commented out until it does
#echo "Patching insecure OpenSSL dependency with libcurl..."
#patchelf "$GAMEDIR/runner" \
# --replace-needed "libcrypto.so.1.0.0" "libcurl.so" \
# --replace-needed "libssl.so.1.0.0" "libcurl.so"
# An environment variable needs to be set on Mesa to avoid a race related to multithreaded shader compilation.
# To do this, we move the original executable to a hidden file, and create a bash script with the needed variable in place of the original.
@ -124,8 +130,8 @@ patch_am2r ()
#!/usr/bin/env bash
# This environment variable fixes Mesa support. If another driver is used this should not do anything.
# See https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4181 for more information.
radeonsi_sync_compile="true" exec "$(dirname "${BASH_SOURCE[0]}")/.runner-unwrapped" "$@"
' > "$GAMEDIR/runner"
radeonsi_sync_compile="true" exec "$(dirname "$(readlink -f "$0")")/.runner-unwrapped" "$@"
' > "$GAMEDIR/runner"
chmod +x "$GAMEDIR/runner" "$GAMEDIR/.runner-unwrapped"
@ -160,10 +166,10 @@ radeonsi_sync_compile="true" exec "$(dirname "${BASH_SOURCE[0]}")/.runner-unwrap
cp "$SCRIPT_DIR/DesktopTemplate" "$desktopPath"
# Replace with proper path
sed -i "s#\[REPLACE\]#$GAMEDIR#" "$desktopPath"
sed -i "s#\[REPLACE\]#$output#" "$desktopPath"
if [ "$SYSTEMWIDE" = true ]; then
sed -i "s#Icon=$GAMEDIR/icon.png#Icon=am2r#" "$desktopPath"
sed -i "s#Icon=$output/icon.png#Icon=am2r#" "$desktopPath"
fi
if [ "$APPIMAGE" = false ]; then
@ -240,9 +246,7 @@ radeonsi_sync_compile="true" exec "$(dirname "${BASH_SOURCE[0]}")/.runner-unwrap
# Put everything from temp directory into the proper output directory
# Moving does *not* work, as mv doesn't allow to overwrite existing directories
mkdir -p $output
# This does not copy hidden files.
cp -rf $GAMEDIR/* $output
cp -rf $GAMEDIR/.runner-unwrapped $output
echo ""
echo "The operation was completed successfully. See you next mission!"