Last active
October 31, 2025 11:05
-
-
Save Randy420Marsh/cffb164955eaca37e88ce90cc1bc7201 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Tomb_Raider_2013_Ubuntu_24.04.2_LTS_FIX.sh | |
| #Before you do any of this check | |
| #pkg-config --variable pc_path pkg-config | |
| #It should return long string something like: | |
| #/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig | |
| #And you should not need to do any of this | |
| #But just in case, first try to reinstall pkg-config to system defaults | |
| #and restart your pc | |
| #For ubuntu | |
| #sudo apt update | |
| #sudo apt install --reinstall pkg-config | |
| #----------------------------------------------------------- | |
| #This script tries to find the missing libraries and places them to game_dir/lib folder, | |
| #then it creates a launch.sh script where this library path is defined and then it | |
| #creates a desktop shortcut to launch the game. | |
| #Don't forget to set "Allow Launching" for the desktop shortcut. | |
| #Now the game should launch from the shortcut. | |
| #----------------------------------------------------------- | |
| #You should only change the game_dir to your game folder, rest of the script should stay the same. | |
| #Name the script to Tomb_Raider_2013_Ubuntu_24.04.2_LTS_FIX.sh and do | |
| #chmod +x Tomb_Raider_2013_Ubuntu_24.04.2_LTS_FIX.sh | |
| #then execute | |
| #./Tomb_Raider_2013_Ubuntu_24.04.2_LTS_FIX.sh | |
| #----------------------------------------------------------- | |
| #!/bin/bash | |
| # Define the game directory and executable | |
| game_dir="YOUR_STEAM_LIBRARY_LOCATION/steamapps/common/Tomb Raider" | |
| game_executable="$game_dir/bin/TombRaider" | |
| # Define the destination directory | |
| destination_dir="$game_dir/lib" | |
| # Define the source directories | |
| source_dirs=( | |
| "$game_dir/lib/i686" | |
| "$HOME/.local/share/Steam/ubuntu12_32/steam-runtime/lib/i386-linux-gnu" | |
| "$HOME/.local/share/Steam/ubuntu12_32/steam-runtime/usr/lib/i386-linux-gnu" | |
| "/usr/lib/i386-linux-gnu" | |
| ) | |
| # Define the libraries to find | |
| libraries=( | |
| "libcrypto.so.1.0.0" | |
| "libgconf-2.so.4" | |
| "libhcrypto.so.4" | |
| "libk5crypto.so.3" | |
| "libminimum_thread_stack_size_wrapper.so" | |
| "libroken.so.18" | |
| "libXdamage.so.1" | |
| "libasn1.so.8" | |
| "libcups.so.2" | |
| "libgio-2.0.so.0" | |
| "libheimbase.so.1" | |
| "libkeyutils.so.1" | |
| "libpango-1.0.so.0" | |
| "libssl.so.1.0.0" | |
| "libavahi-client.so.3" | |
| "libcurl.so.4" | |
| "libglib-2.0.so.0" | |
| "libheimntlm.so.0" | |
| "libkrb5.so.26" | |
| "libpangocairo-1.0.so.0" | |
| "libsteam_api.so" | |
| "libavahi-common.so.3" | |
| "libdbus-glib-1.so.2" | |
| "libgmodule-2.0.so.0" | |
| "libhx509.so.5" | |
| "libkrb5.so.3" | |
| "libpangoft2-1.0.so.0" | |
| "libtcmalloc_minimal.so" | |
| "libcairo.so.2" | |
| "libffi.so.6" | |
| "libgobject-2.0.so.0" | |
| "libicudata.so.51" | |
| "libkrb5support.so.0" | |
| "libpdf.so" | |
| "libwind.so.0" | |
| "libcef.so" | |
| "libffmpegsumo.so" | |
| "libgssapi_krb5.so.2" | |
| "libicui18n.so.51" | |
| "liblber-2.4.so.2" | |
| "libpixman-1.so.0" | |
| "libxcb-render.so.0" | |
| "libCoreFoundation.so.476" | |
| "libfmodex.so" | |
| "libgssapi.so.3" | |
| "libicuuc.so.51" | |
| "libldap_r-2.4.so.2" | |
| "libpng12.so.0" | |
| "libXcomposite.so.1" | |
| ) | |
| # Function to copy a library and handle errors | |
| copy_library() { | |
| local source_path="$1" | |
| local dest_path="$2" | |
| local lib_name="$3" | |
| if [ -f "$source_path" ]; then | |
| echo "Copying '$lib_name' from '$source_path' to '$dest_path'..." | |
| if cp -v "$source_path" "$dest_path"; then | |
| return 0 # Success | |
| else | |
| echo "Error: Failed to copy '$lib_name' from '$source_path'." | |
| return 1 # Failure | |
| fi | |
| else | |
| return 1 # Failure (file not found) | |
| fi | |
| } | |
| # Function to create the launch script | |
| create_launch_script() { | |
| local launch_script_path="$game_dir/launch.sh" | |
| local game_dir_for_script="$game_dir" # Use a more descriptive name | |
| cat > "$launch_script_path" <<EOL | |
| #!/bin/bash | |
| export LD_LIBRARY_PATH="$game_dir_for_script/lib:\$LD_LIBRARY_PATH" | |
| cd "$game_dir_for_script/bin" | |
| ./TombRaider | |
| EOL | |
| chmod +x "$launch_script_path" | |
| echo "$launch_script_path" # Print the path to standard output | |
| } | |
| # Function to create a desktop shortcut | |
| create_desktop_shortcut() { | |
| local shortcut_path="$HOME/Desktop/Tomb Raider 2013.desktop" | |
| local launch_script_path="$1" #take the launch script as argument | |
| cat > "$shortcut_path" <<EOL | |
| [Desktop Entry] | |
| Name=Tomb Raider 2013 | |
| Comment=Launch Tomb Raider with custom library path | |
| Exec="$launch_script_path" | |
| Icon=steam_icon_203160 | |
| Terminal=false | |
| Type=Application | |
| Categories=Game; | |
| EOL | |
| chmod +x "$shortcut_path" | |
| echo "Desktop shortcut created at $shortcut_path" | |
| } | |
| # Check for missing libraries at the start | |
| echo "--- Checking for Missing Libraries ---" | |
| missing_output=$(ldd "$game_executable" | grep "not found") | |
| if [ -z "$missing_output" ]; then | |
| echo "All required libraries found." | |
| launch_script_path=$(create_launch_script) # Create the launch script | |
| create_desktop_shortcut "$launch_script_path" # Create shortcut, pass script path | |
| exit 0 | |
| else | |
| echo "Missing libraries found. Proceeding to copy." | |
| echo "$missing_output" | |
| fi | |
| # Ensure the destination directory exists | |
| mkdir -p "$destination_dir" | |
| # Find and copy libraries from source directories | |
| echo "" | |
| echo "--- Copying Libraries from Source Directories ---" | |
| for library in "${libraries[@]}"; do | |
| copied=false | |
| for source_dir in "${source_dirs[@]}"; do | |
| source_path="$source_dir/$library" | |
| if copy_library "$source_path" "$destination_dir" "$library"; then | |
| copied=true | |
| break # Stop searching if found | |
| fi | |
| done | |
| if [ ! "$copied" ]; then | |
| echo "Warning: '$library' not found in any of the specified source directories." | |
| fi | |
| done | |
| # Copy from i686 to lib, overwriting existing files | |
| echo "" | |
| echo "--- Final Copy from i686 (Overwrite Existing) ---" | |
| i686_source_dir="$game_dir/lib/i686" | |
| if [ -d "$i686_source_dir" ]; then | |
| for library in "${libraries[@]}"; do # iterate only over the libraries we are interested in. | |
| i686_path="$i686_source_dir/$library" | |
| if [ -f "$i686_path" ]; then | |
| echo "Copying '$library' from i686 (overwriting)..." | |
| cp -v "$i686_path" "$destination_dir/$library" | |
| fi | |
| done | |
| else | |
| echo "Warning: i686 source directory '$i686_source_dir' does not exist." | |
| fi | |
| # Check for missing libraries at the end | |
| echo "" | |
| echo "--- Checking for Missing Libraries After Copying ---" | |
| missing_output=$(ldd "$game_executable" | grep "not found") | |
| if [ -z "$missing_output" ]; then | |
| echo "All required libraries found after copying." | |
| launch_script_path=$(create_launch_script) # Create the launch script | |
| create_desktop_shortcut "$launch_script_path" # Create shortcut, pass script path | |
| else | |
| echo "Still missing libraries after copying:" | |
| echo "$missing_output" | |
| fi | |
| echo "Finished processing libraries." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment