├── README.md ├── config ├── extra-environment.sh ├── game-chooser.sh ├── game-settings.sh └── steam-check.sh ├── gamelaunchscript.template.sh └── sysreport.sh /README.md: -------------------------------------------------------------------------------- 1 | Feral Linux Scripts 2 | ====== 3 | 4 | This repository allows public access to the latest versions of some of the scripts used by Feral Interactive games on Linux. 5 | 6 | Issues 7 | ------ 8 | 9 | We spend a good deal of time trying to make sure our games will work on a wide variety of Linux distributions, but some issues may still occur. Feel free to use the Issues tracker in this repository to report any problems that we can fix by making adjustments to these scripts or, alternatively, submit a pull request. 10 | 11 | Any other general issues with Feral games should, as always, be reported directly to support@feralinteractive.com. 12 | 13 | Scripts 14 | ------ 15 | 16 | ### sysreport.sh 17 | 18 | This is a fairly simple zero dependency (except bash) system report script that gathers information about the local system, installed games and game preferences. It outputs a file in HTML syntax. 19 | 20 | Our games use this script when "Generate Report" is clicked on the SUPPORT tab of the options window. 21 | 22 | Usage looks like: 23 | 24 | ```bash 25 | ./sysreport.sh "/path/to/game/install" "/path/to/outputfile.html" 26 | ``` 27 | 28 | ### gamelaunchscript.template.sh 29 | 30 | This is the template we use for our game launch scripts. It allows us to fix up the environment as needed to assist with running our games on a wide variety of Linux distributions. 31 | 32 | It requires a configuration script 33 | 34 | * config/game-settings.sh - To set up some game specific configuration variables 35 | 36 | And optionally uses a set of other helper scripts that may be different per game 37 | 38 | * config/steam-check.sh - Used to check if the game is launched in the steam runtime 39 | * config/game-chooser.sh - Allows choosing which game binary to launch in some cases 40 | * config/extra-environment.sh - Used to set any extra environment variables 41 | 42 | License 43 | ------ 44 | 45 | All scripts here, unless otherwise stated, are licensed under the MIT license as shown below 46 | 47 | > The MIT License (MIT) 48 | > 49 | > Copyright (c) 2017 Feral Interactive Limited 50 | > 51 | > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 52 | > 53 | > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 54 | > 55 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 56 | -------------------------------------------------------------------------------- /config/extra-environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export MESA_NO_ERROR=1 3 | 4 | 5 | -------------------------------------------------------------------------------- /config/game-chooser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Allow us to overload the game being launched with an environment variable 3 | if [ ! -z "${FERAL_SCRIPT_LAUNCH_GAME}" ]; then 4 | FERAL_GAME_NAME="${FERAL_SCRIPT_LAUNCH_GAME}" 5 | else 6 | # Make sure the items in the list exist 7 | CHOICES=() 8 | for GAME in ${FERAL_LAUNCHER_GAMES[@]}; do 9 | if [ -x "${GAMEROOT}/bin/$GAME" ]; then 10 | CHOICES+=($GAME) 11 | fi 12 | done 13 | 14 | if [ ${#CHOICES[@]} -eq 1 ]; then 15 | FERAL_GAME_NAME="${CHOICES}" 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /config/game-settings.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FERAL_GAME_NAME="" # Short form name (game binary name) 4 | FERAL_GAME_NAME_FULL="" # Long form name 5 | FERAL_GAME_STEAMID="" # Then steam ID 6 | FERAL_LIB_PATH="" # Path to game libraries 7 | FERAL_ARCH_SHORT="" # Short form architecture name (64/32) 8 | FERAL_ARCH_FULL="" # Long form architecture name (x86_64/i386) 9 | FERAL_PREFERENCES_DIR="" # Preferences directory name 10 | FERAL_LAUNCHER_GAMES=() # List of project binary names 11 | 12 | -------------------------------------------------------------------------------- /config/steam-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -z ${STEAM_RUNTIME} ]; then 3 | echo "WARNING: ${FERAL_GAME_NAME_FULL} not launched within the steam runtime" 4 | echo " This is likely incorrect and is not officially supported" 5 | echo " Launching steam in 3 seconds with steam://rungameid/${FERAL_GAME_STEAMID}" 6 | sleep 3 7 | steam "steam://rungameid/${FERAL_GAME_STEAMID}" 8 | exit 9 | elif [ ${STEAM_RUNTIME} == 0 ]; then 10 | echo "WARNING: ${FERAL_GAME_NAME_FULL} launched with STEAM_RUNTIME=0" 11 | echo " We recommend using the steam runtime if possible" 12 | fi 13 | -------------------------------------------------------------------------------- /gamelaunchscript.template.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ==================================================================== 3 | # The MIT License (MIT) 4 | # 5 | # Copyright (c) 2017 Feral Interactive Limited 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | # 9 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | # 13 | # ==================================================================== 14 | # Generic Feral Launcher script 15 | # Version 2.9.1 16 | 17 | # If you have useful edits made for unsupported distros then please 18 | # visit 19 | 20 | # Extra note: Steam's STEAM_RUNTIME_PREFER_HOST_LIBRARIES can now be 21 | # used to control which libraries it'll use 22 | # See http://store.steampowered.com/news/26953/ 23 | # ==================================================================== 24 | 25 | # 'Magic' to get the game root 26 | GAMEROOT="$(sh -c "cd \"${0%/*}\" && echo \"\$PWD\"")" 27 | FERAL_CONFIG="${GAMEROOT}/config" 28 | 29 | # Pull in game specific variables 30 | # This is required - we'll fail without it 31 | # shellcheck source=config/game-settings.sh 32 | . "${FERAL_CONFIG}/game-settings.sh" 33 | 34 | # The game's preferences directory 35 | if [ -z "${FERAL_PREFERENCES_DIR}" ]; then FERAL_PREFERENCES_DIR="feral-interactive/${FERAL_GAME_NAME_FULL}"; fi 36 | GAMEPREFS="$HOME/.local/share/${FERAL_PREFERENCES_DIR}" 37 | 38 | # ==================================================================== 39 | # Helper functions 40 | 41 | # Show a message box. 42 | ShowMessage() 43 | { 44 | MESSAGE_TITLE="$1" 45 | MESSAGE_BODY="$2" 46 | 47 | echo "=== ${MESSAGE_TITLE}" 48 | echo "${MESSAGE_BODY}" 49 | 50 | MESSAGE_BINARY="${GAMEROOT}/bin/FeralLinuxMessage" 51 | if [ -x "${MESSAGE_BINARY}" ]; then 52 | MESSAGE_BUTTON="OK" 53 | MESSAGE_ICON="${GAMEROOT}/share/icons/GameIcon_16x16x32.png" 54 | MESSAGE_FONT="${GAMEROOT}/share/NotoSans-Regular.ttf" 55 | MESSAGE_DEVICES="${GAMEROOT}/share/inputdevices.json" 56 | 57 | ORIG_LD_PRELOAD="${LD_PRELOAD}" 58 | if ! grep -q steamos /etc/os-release; then 59 | unset LD_PRELOAD 60 | fi 61 | 62 | "${MESSAGE_BINARY}" "${MESSAGE_TITLE}" "${MESSAGE_ICON}" "${MESSAGE_BODY}" "${MESSAGE_FONT}" "${MESSAGE_DEVICES}" 1 2 1 "${MESSAGE_BUTTON}" 63 | 64 | export LD_PRELOAD="${ORIG_LD_PRELOAD}" 65 | fi 66 | } 67 | 68 | # ==================================================================== 69 | # Options 70 | 71 | # Check for arguments 72 | # Note: some of these can be set at a system level to override for 73 | # all Feral games 74 | while [ $# -gt 0 ]; do 75 | arg=$1 76 | case ${arg} in 77 | --fresh-prefs) FERAL_FRESH_PREFERENCES=1 && shift ;; 78 | --system-asound) FERAL_SYSTEM_ASOUND=1 && shift ;; 79 | --clear-system-gl-caches) FERAL_CLEAR_SYSTEM_GL_CACHES=1 && shift ;; 80 | --log-to-file) FERAL_LOG_TO_FILE=1 && shift ;; 81 | --run-from-steam) FERAL_RUN_FROM_STEAM=1 && shift ;; 82 | --renderdoc) FERAL_USE_RENDERDOC=1 && shift ;; 83 | --version) FERAL_GET_VERSION=1 && shift ;; 84 | *) break ;; 85 | esac 86 | done 87 | 88 | # Always do this first 89 | if [ "${FERAL_LOG_TO_FILE}" = 1 ]; then 90 | LOGFILE="${GAMEPREFS}/${FERAL_GAME_NAME}_log.txt" 91 | echo "Logging all output to \"${LOGFILE}\"..." 92 | exec 1>> "${LOGFILE}" 2>&1 93 | echo "===" 94 | echo "log for $(date)" 95 | echo "===" 96 | fi 97 | 98 | # Automatically backup old preferences and start fresh on launch 99 | if [ "${FERAL_FRESH_PREFERENCES}" = 1 ]; then 100 | mv "${GAMEPREFS}" "${GAMEPREFS}-$(date +%Y%m%d%H%M%S).bak" 101 | fi 102 | 103 | # Show a version panel on start 104 | if [ "${FERAL_GET_VERSION}" = 1 ]; then 105 | unset LD_PRELOAD 106 | unset LD_LIBRARY_PATH 107 | if [ -x /usr/bin/zenity ]; then 108 | /usr/bin/zenity --text-info --title "${FERAL_GAME_NAME_FULL} - Version Information" --filename "${GAMEROOT}/share/FeralInfo.json" 109 | else 110 | xterm -T "${FERAL_GAME_NAME_FULL} - Version Information" -e "cat '${GAMEROOT}/share/FeralInfo.json'; echo -n 'Press ENTER to continue: '; read input" 111 | fi 112 | exit 113 | fi 114 | 115 | 116 | # ==================================================================== 117 | # Ensure we pass the steam check, before we inherit the enviroment below 118 | if [ "${FERAL_RUN_FROM_STEAM}" = 1 ]; then 119 | STEAM_RUNTIME=1 120 | fi 121 | 122 | # ==================================================================== 123 | # Our games are compiled targeting the steam runtime and are not 124 | # expected to work perfectly when run outside of it 125 | # However on some distributions (Arch Linux/openSUSE etc.) users have 126 | # had better luck using their own libs 127 | # Remove the steam-check.sh file if testing that 128 | # shellcheck source=config/steam-check.sh 129 | test -f "${FERAL_CONFIG}/steam-check.sh" && . "${FERAL_CONFIG}/steam-check.sh" 130 | 131 | # ==================================================================== 132 | # Set the steam appid if not set 133 | if [ "${SteamAppId}" != "${FERAL_GAME_STEAMID}" ]; then 134 | SteamAppId="${FERAL_GAME_STEAMID}" 135 | GameAppId="${FERAL_GAME_STEAMID}" 136 | SteamGameId="${FERAL_GAME_STEAMID}" 137 | export SteamAppId 138 | export GameAppId 139 | export SteamGameId 140 | fi 141 | 142 | # ==================================================================== 143 | # Inherit the steam-runtime from a script if asked 144 | # Requires a script that can set up the steam-runtime at bin/feralrunfromsteam 145 | if [ "${FERAL_RUN_FROM_STEAM}" = 1 ]; then 146 | source "${GAMEROOT}/bin/feralrunfromsteam" 147 | fi 148 | 149 | # ==================================================================== 150 | # Enviroment Modifiers 151 | 152 | # Store the current LD_PRELOAD 153 | SYSTEM_LD_PRELOAD="${LD_PRELOAD}" 154 | LD_PRELOAD_ADDITIONS= 155 | 156 | # Unset LD_PRELOAD temporarily 157 | # This avoids a chunk of confusing 32/64 errors from the steam overlay 158 | # It also allows us to call the system openssl and curl here 159 | # If your distribution needed an LD_PRELOAD addition then it should be 160 | # fine to comment this out 161 | unset LD_PRELOAD 162 | 163 | # LC_ALL has caused users many issues in the past and generally is just 164 | # used for debugging 165 | # Uncomment this line if LC_ALL was needed (sometimes on openSUSE) 166 | unset LC_ALL 167 | 168 | # Sometimes locale specific behaviours can cause issues - try setting 169 | # the locale to C as a "safe" option 170 | # LANG=C 171 | # export LANG 172 | # LC_ALL=C 173 | # export LC_ALL 174 | 175 | # Try and set up SSL paths for all distros, due to steam runtime bug #52 176 | # The value is used by our version of libcurl 177 | # Users on unsupported distros might want to check if this is correct 178 | HAS_CURL="$(sh -c "command -v curl-config")" 179 | if [ -n "${HAS_CURL}" ]; then 180 | SSL_CERT_FILE="$(curl-config --ca)" 181 | export SSL_CERT_FILE 182 | fi 183 | 184 | # Otherwise try with guess work 185 | if [ -z "$SSL_CERT_FILE" ]; then 186 | if [ -e /etc/ssl/certs/ca-certificates.crt ]; then 187 | SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" 188 | export SSL_CERT_FILE 189 | elif [ -e /etc/pki/tls/certs/ca-bundle.crt ]; then 190 | SSL_CERT_FILE="/etc/pki/tls/certs/ca-bundle.crt" 191 | export SSL_CERT_FILE 192 | elif [ -e /var/lib/ca-certificates/ca-bundle.pem ]; then 193 | SSL_CERT_FILE="/var/lib/ca-certificates/ca-bundle.pem" 194 | export SSL_CERT_FILE 195 | fi 196 | fi 197 | HAS_OPENSSL="$(sh -c "command -v openssl")" 198 | if [ -n "${HAS_OPENSSL}" ]; then 199 | SSL_CERT_DIR="$(sh -c "openssl version -d | sed -E 's/.*\\\"(.*)\\\"/\1/'")/certs" 200 | export SSL_CERT_DIR 201 | fi 202 | 203 | # Use a directory in our preferences for the Nvidia driver shader cache if not specified 204 | # We need to move this as our games go over the internal MB limit for the driver 205 | # cache when not placed in a custom location with __GL_SHADER_DISK_CACHE_PATH 206 | if [ -z "$__GL_SHADER_DISK_CACHE_PATH" ]; then 207 | export __GL_SHADER_DISK_CACHE_PATH="${GAMEPREFS}/driver-gl-shader-cache" 208 | # Avoid steam runtime libraries for mkdir 209 | OLD_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" 210 | unset LD_LIBRARY_PATH 211 | mkdir -p "${__GL_SHADER_DISK_CACHE_PATH}" 212 | export LD_LIBRARY_PATH="${OLD_LD_LIBRARY_PATH}" 213 | fi 214 | 215 | # We also want to clear the caches if requested by the game 216 | # which can't do this during the normal execution as it is unsafe 217 | # To do this, the game will add a temp file for us to catch 218 | __FRL_TMP_FILE_CLEAR_GL_CACHES=/tmp/frl_clear_gl_caches 219 | if [ -f "${__FRL_TMP_FILE_CLEAR_GL_CACHES}" ]; then 220 | rm "${__FRL_TMP_FILE_CLEAR_GL_CACHES}" 221 | FERAL_CLEAR_SYSTEM_GL_CACHES=1 222 | fi 223 | 224 | # Clean out and remake the driver cache directory if requested 225 | # We need to do this before running the game as the driver won't react well 226 | # to the cache being pulled out from under it 227 | if [ "${FERAL_CLEAR_SYSTEM_GL_CACHES}" = 1 ]; then 228 | 229 | # Avoid steam runtime libraries for rm and mkdir 230 | OLD_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" 231 | unset LD_LIBRARY_PATH 232 | 233 | # Clear the Nvidia cache locations 234 | # https://us.download.nvidia.com/XFree86/Linux-x86/384.59/README/openglenvvariables.html 235 | if [ ! -z "${__GL_SHADER_DISK_CACHE_PATH}" ]; then 236 | __NV_CACHE="${__GL_SHADER_DISK_CACHE_PATH}" 237 | elif [ ! -z "${XDG_CACHE_HOME}" ]; then 238 | __NV_CACHE="${XDG_CACHE_HOME}/.nv/GLCache" 239 | else 240 | __NV_CACHE="${HOME}/.nv/GLCache" 241 | fi 242 | if [ -d "${__NV_CACHE}" ]; then 243 | echo "Clearing NVIDIA cache at \"${__NV_CACHE}\"" 244 | rm -r "${__NV_CACHE}" 245 | mkdir -p "${__NV_CACHE}" 246 | fi 247 | 248 | # Clear Mesa GLSL cache, using directory search in src/util/disk_cache.c as of 2017-10-12. 249 | # Note the directory name was renamed from "mesa" to "mesa_shader_cache" on 2017-08-24. 250 | if [ ! -z "${MESA_GLSL_CACHE_DIR}" ]; then 251 | __MESA_CACHE="${MESA_GLSL_CACHE_DIR}/mesa_shader_cache" 252 | if [ ! -d "${__MESA_CACHE}" ]; then 253 | __MESA_CACHE="${MESA_GLSL_CACHE_DIR}/mesa" 254 | fi 255 | elif [ ! -z "${XDG_CACHE_HOME}" ]; then 256 | __MESA_CACHE="${XDG_CACHE_HOME}/mesa_shader_cache" 257 | if [ ! -d "${__MESA_CACHE}" ]; then 258 | __MESA_CACHE="${XDG_CACHE_HOME}/mesa" 259 | fi 260 | else 261 | __MESA_CACHE="${HOME}/.cache/mesa_shader_cache" 262 | if [ ! -d "${__MESA_CACHE}" ]; then 263 | __MESA_CACHE="${HOME}/.cache/mesa" 264 | fi 265 | fi 266 | if [ -d "${__MESA_CACHE}" ]; then 267 | echo "Clearing Mesa cache at \"${__MESA_CACHE}\"" 268 | rm -r "${__MESA_CACHE}" 269 | mkdir -p "${__MESA_CACHE}" 270 | fi 271 | 272 | # Clear AMD Closed cache, using location as of 17.30 273 | __GPUPRO_CACHE="${HOME}/.AMD/GLCache" 274 | if [ -d "${__GPUPRO_CACHE}" ]; then 275 | echo "Clearing AMD GPUPRO cache at \"${__GPUPRO_CACHE}\"" 276 | rm -r "${__GPUPRO_CACHE}" 277 | mkdir -p "${__GPUPRO_CACHE}" 278 | fi 279 | 280 | export LD_LIBRARY_PATH="${OLD_LD_LIBRARY_PATH}" 281 | fi 282 | 283 | # Brute force fix for some small thread sizes in external libraries 284 | if [ -e "${GAMEROOT}/${FERAL_LIB_PATH}/libminimum_thread_stack_size_wrapper.so" ]; then 285 | LD_PRELOAD_ADDITIONS="../${FERAL_LIB_PATH}/libminimum_thread_stack_size_wrapper.so:${LD_PRELOAD_ADDITIONS}" 286 | fi 287 | 288 | # Use the system asound if requested 289 | # This can help with sound issues on some distros including Arch Linux 290 | # Now most likely only needed if STEAM_RUNTIME_PREFER_HOST_LIBRARIES is set to 0 291 | if [ "${FERAL_SYSTEM_ASOUND}" = 1 ]; then 292 | LIBASOUND_DYLIB="libasound.so.2" 293 | if [ -e "/usr/lib/${FERAL_ARCH_FULL}-linux-gnu/${LIBASOUND_DYLIB}" ]; then 294 | LIBASOUND_LIBDIR="/usr/lib/${FERAL_ARCH_FULL}-linux-gnu" 295 | elif [ -e "/usr/lib${FERAL_ARCH_SHORT}/${LIBASOUND_DYLIB}" ]; then 296 | LIBASOUND_LIBDIR="/usr/lib${FERAL_ARCH_SHORT}" 297 | elif [ -e "/usr/lib/${LIBASOUND_DYLIB}" ]; then 298 | LIBASOUND_LIBDIR="/usr/lib" 299 | fi 300 | LD_PRELOAD_ADDITIONS="${LIBASOUND_LIBDIR}/${LIBASOUND_DYLIB}:${LD_PRELOAD_ADDITIONS}" 301 | fi 302 | 303 | # Set up Vulkan renderdoc if asked 304 | if [ "${FERAL_USE_RENDERDOC}" = 1 ]; then 305 | export VK_INSTANCE_LAYERS="${VK_INSTANCE_LAYERS}:VK_LAYER_RENDERDOC_Capture" 306 | export ENABLE_VULKAN_RENDERDOC_CAPTURE=1 307 | fi 308 | 309 | # Sometimes games may need an extra set of variables 310 | # Let's pull those in 311 | # shellcheck source=config/extra-environment.sh 312 | test -f "${FERAL_CONFIG}/extra-environment.sh" && . "${FERAL_CONFIG}/extra-environment.sh" 313 | 314 | # Add our additionals and the old preload back 315 | LD_PRELOAD="${LD_PRELOAD_ADDITIONS}:${SYSTEM_LD_PRELOAD}" 316 | export LD_PRELOAD 317 | 318 | # ==================================================================== 319 | # Source in the game chooser if it exists 320 | # shellcheck source=config/game-chooser.sh 321 | test -f "${FERAL_CONFIG}/game-chooser.sh" && . "${FERAL_CONFIG}/game-chooser.sh" 322 | 323 | # ==================================================================== 324 | # Try and detect some common problems and show useful messages 325 | # First check the dynamic linker 326 | GAME_LDD_LOGFILE=/tmp/${FERAL_GAME_NAME}_ldd_log 327 | if command -v ldd > /dev/null; then 328 | ldd "${GAMEROOT}/bin/${FERAL_GAME_NAME}" > "${GAME_LDD_LOGFILE}.txt" 329 | grep "not found" "${GAME_LDD_LOGFILE}.txt" > "${GAME_LDD_LOGFILE}_missing.txt" 330 | if [ -s "${GAME_LDD_LOGFILE}_missing.txt" ]; then 331 | echo "=== ERROR - You're missing vital libraries to run ${FERAL_GAME_NAME_FULL}" 332 | echo "=== Either use the steam runtime or install these using your package manager" 333 | cat "${GAME_LDD_LOGFILE}_missing.txt" && echo "===" 334 | rm "${GAME_LDD_LOGFILE}_missing.txt" 335 | fi 336 | rm "${GAME_LDD_LOGFILE}.txt" 337 | fi 338 | 339 | # Identify whether we have an NVIDIA driver installation that can cause the 340 | # game to crash. This happens when the non-GLVND version of the GL driver is 341 | # installed, but the Vulkan ICD path points to the GLVND version. This 342 | # happens due to a bug in NVIDIA's installer, which made its way into the 343 | # Debian driver packages. 344 | # 345 | # For more details, see: 346 | # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864477 347 | 348 | DRIVER_MESSAGE_TITLE="Driver installation issue" 349 | DRIVER_MESSAGE_BODY="Your NVIDIA driver installation has an issue which may cause the game to crash. 350 | 351 | If this happens, you will need to install the GLVND version of the driver. On Debian/SteamOS, this can be done by 352 | installing the libgl1-nvidia-glvnd-glx package. Using NVIDIA's installer, the GLVND version should be installed by default. 353 | 354 | For more details, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864477" 355 | 356 | # ldconfig may be in sbin which may not be in the default PATH. We don't 357 | # actually need root just to print its cache. 358 | ORIG_PATH="${PATH}" 359 | export PATH="/sbin:/usr/sbin:${PATH}" 360 | 361 | # Find out what libGL we will be using. 362 | LIBGL_PATH=$(ldconfig -p | grep libGL.so.1 | head -n 1 | sed "s/.*=> //g") 363 | LIBGL_TARGET=$(readlink -f "${LIBGL_PATH}") 364 | 365 | export PATH=$ORIG_PATH 366 | 367 | # Check if it looks like a non-GLVND NVIDIA libGL based on the version number. 368 | # For non-GLVND the file name looks like e.g. libGL.so.375.66 369 | if echo "${LIBGL_TARGET}" | grep -q "\.so\.[0-9][0-9][0-9]\.[0-9][0-9]"; then 370 | # It's a non-GLVND installation. Check the Vulkan ICD path. 371 | if [ -e /etc/vulkan/icd.d/nvidia_icd.json ]; then 372 | VULKAN_ICD_JSON=/etc/vulkan/icd.d/nvidia_icd.json 373 | elif [ -e /usr/share/vulkan/icd.d/nvidia_icd.json ]; then 374 | VULKAN_ICD_JSON=/usr/share/vulkan/icd.d/nvidia_icd.json 375 | fi 376 | 377 | if [ -n "${VULKAN_ICD_JSON}" ]; then 378 | # If it points to libGLX_nvidia.so.0 then this will probably cause a 379 | # crash. 380 | if grep -q "libGLX_nvidia.so.0" "${VULKAN_ICD_JSON}"; then 381 | ShowMessage "${DRIVER_MESSAGE_TITLE}" "${DRIVER_MESSAGE_BODY}" 382 | fi 383 | fi 384 | fi 385 | 386 | # Workaround for Ubuntu NVIDIA driver packaging issue: 387 | # https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-384/+bug/1726809 388 | # 389 | # Run a tool to determine whether we can enumerate available Vulkan devices. If 390 | # not, check if the Vulkan ICD configuration looks to be affected, and if so, 391 | # try again with an overridden config with a workaround applied. 392 | # 393 | # Don't do anything if the user is manually overriding the Vulkan ICD path. 394 | if [ -z "${VK_ICD_FILENAMES}" ]; then 395 | CHECK_VULKAN_BINARY="${GAMEROOT}/bin/CheckVulkanDriver" 396 | if ! "${CHECK_VULKAN_BINARY}"; then 397 | if [ -e /etc/vulkan/icd.d/nvidia_icd.json ]; then 398 | VULKAN_ICD_JSON=/etc/vulkan/icd.d/nvidia_icd.json 399 | elif [ -e /usr/share/vulkan/icd.d/nvidia_icd.json ]; then 400 | VULKAN_ICD_JSON=/usr/share/vulkan/icd.d/nvidia_icd.json 401 | fi 402 | 403 | if [ -n "${VULKAN_ICD_JSON}" ]; then 404 | if grep -q "libGL.so.1" "${VULKAN_ICD_JSON}"; then 405 | # Try substituting in the GLVND library path to see if this 406 | # works instead. 407 | export VK_ICD_FILENAMES="$(mktemp --tmpdir nvidia_icd.XXXXXX.json)" 408 | sed 's/libGL\.so\.1/libGLX_nvidia.so.0/' "${VULKAN_ICD_JSON}" > "${VK_ICD_FILENAMES}" 409 | if ! "${CHECK_VULKAN_BINARY}"; then 410 | # Still doesn't work, revert back to default. 411 | unset VK_ICD_FILENAMES 412 | fi 413 | fi 414 | fi 415 | fi 416 | fi 417 | 418 | # ==================================================================== 419 | # Run the game 420 | cd "${GAMEROOT}/bin" 421 | 422 | # Use the signalwrapper if it exists 423 | if [ -e "signalwrapper" ]; then 424 | GAME_SIGNAL_WRAPPER="./signalwrapper" 425 | fi 426 | 427 | # Launch the game with all the arguments 428 | ${GAME_LAUNCH_PREFIX} ${GAME_SIGNAL_WRAPPER} "${GAMEROOT}/bin/${FERAL_GAME_NAME}" "$@" 429 | RESULT=$? 430 | 431 | # ==================================================================== 432 | exit "${RESULT}" 433 | -------------------------------------------------------------------------------- /sysreport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ============================================================= 3 | # The MIT License (MIT) 4 | # 5 | # Copyright (c) 2017 Feral Interactive Limited 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | # 9 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | # 13 | # ============================================================= 14 | # sysreport.sh - Script to gather data about the current system 15 | # 16 | # USAGE: $ sysreport.sh 17 | # 18 | # This will gather a selection of info: 19 | ## hardware details 20 | ## system software info 21 | ## drivers 22 | ## environment 23 | ## running programs 24 | ## installed game files 25 | ## feral preference files 26 | ## crash dumps 27 | # 28 | # If you're unhappy sharing any of this information then feel 29 | # free to remove it from the output when sending the file over 30 | # ============================================================= 31 | 32 | # Force C locale to avoid some odd issues 33 | export LC_ALL_OLD=$LC_ALL 34 | export LC_ALL=C 35 | 36 | # Escape the steam runtime library path 37 | export SAVED_LD_LIBRARY_PATH=$LD_LIBRARY_PATH 38 | unset LD_LIBRARY_PATH 39 | 40 | INSTALLDIR="$1" 41 | OUTFILE="$( cd "$( dirname "$2" )" || exit; pwd )/$( basename "$2" )" 42 | SKIP_CLOSE=$3 43 | 44 | 45 | # Attempt to find the feral preferences directory 46 | FERAL_PREFS="$XDG_DATA_HOME/feral-interactive" 47 | if [ ! -d "$FERAL_PREFS" ]; then 48 | FERAL_PREFS="$HOME/.local/share/feral-interactive" 49 | fi 50 | 51 | # -------------------------------------------------------------------------------- 52 | # Helper functions 53 | output_text() { 54 | echo "$1" 55 | echo "

$1

" >> "$OUTFILE" 56 | } 57 | 58 | # -------------------------------------------------------------------------------- 59 | # Verify inputs 60 | if [ ! -n "$OUTFILE" ] || [ ! -n "$INSTALLDIR" ]; then 61 | echo "USAGE: \$ $0 " 62 | exit 1 63 | fi 64 | if [ ! -d "$INSTALLDIR" ]; then 65 | echo "$INSTALLDIR not found, game install missing?" 66 | exit 1 67 | fi 68 | 69 | # Check we can write to the output 70 | echo "-" > "$OUTFILE" 71 | WRITE_ERROR=$? 72 | if [ $WRITE_ERROR != 0 ] ; then 73 | exit $WRITE_ERROR 74 | fi 75 | 76 | # -------------------------------------------------------------------------------- 77 | TEXT_AREA="" >> "$OUTFILE" 152 | done 153 | 154 | 155 | # -------------------------------------------------------------------------------- 156 | # Graphics info utilities 157 | # -------------------------------------------------------------------------------- 158 | # "glxinfo -l" - Detailed opengl information 159 | # "vulkaninfo" - Detailed vulkan information 160 | # "nvidia-smi" - Current GPU stats on nvidia 161 | # "fglrxinfo" - Current GPU stats on amd 162 | echo "

Graphics Information

" >> "$OUTFILE" 163 | set -- "glxinfo -l" \ 164 | "vulkaninfo" \ 165 | "nvidia-smi" \ 166 | "fglrxinfo" 167 | for CMD do 168 | output_text "$CMD" 169 | echo "${TEXT_AREA}" >> "$OUTFILE" 170 | $CMD 2>&1 | tail -n 10000 | tee -a "$OUTFILE" | 171 | if [ "$(wc -l)" = "10000" ]; then 172 | echo "...truncated to first 10000 lines..." >> "$OUTFILE" 173 | fi 174 | echo "" >> "$OUTFILE" 175 | done 176 | 177 | 178 | # -------------------------------------------------------------------------------- 179 | # System configuration files 180 | # -------------------------------------------------------------------------------- 181 | # "/etc/*-release" - Info on system release version 182 | # "/etc/X11/default-display-manager" - X11 display manager info 183 | # "/proc/meminfo" - Info on current RAM 184 | # "/proc/cpuinfo" - Info on current CPU 185 | # "/etc/sysconfig/displaymanager" - Display manger config 186 | # "/etc/sysconfig/desktop" - WM config 187 | # "/proc/bus/input/devices" - input devices (controllers + m/k) 188 | echo "

System Files

" >> "$OUTFILE" 189 | RELEASE_FILES=(/etc/*-release) 190 | set -- "${RELEASE_FILES[@]}" \ 191 | "/etc/X11/default-display-manager" \ 192 | "/proc/meminfo" \ 193 | "/proc/cpuinfo" \ 194 | "/etc/sysconfig/displaymanager" \ 195 | "/etc/sysconfig/desktop" \ 196 | "/proc/bus/input/devices" 197 | for FILE do 198 | if [ -e "$FILE" ] ; then 199 | output_text "$FILE" 200 | echo "${TEXT_AREA}" >> "$OUTFILE" 201 | head "$FILE" -n 500 | tee -a "$OUTFILE" | 202 | if [ "$(wc -l)" = "500" ]; 203 | then echo "...truncated..." >> "$OUTFILE"; 204 | fi 205 | echo "" >> "$OUTFILE" 206 | else 207 | output_text "$FILE not found" 208 | fi 209 | done 210 | 211 | 212 | # -------------------------------------------------------------------------------- 213 | # System info utilities - game environment 214 | # -------------------------------------------------------------------------------- 215 | # "ldd -v" - Check which libraries are likely loaded by binaries 216 | cd "$INSTALLDIR" || exit 217 | for BINARYFILE in bin/* lib/* 218 | do 219 | output_text "ldd -v $BINARYFILE" 220 | echo "${TEXT_AREA}" >> "$OUTFILE" 221 | env LD_LIBRARY_PATH="${SAVED_LD_LIBRARY_PATH}" ldd -v "$BINARYFILE" 2>&1 | tail -n 1000 | tee -a "$OUTFILE" | 222 | if [ "$(wc -l)" = "1000" ]; then 223 | echo "...truncated to last 1000 lines..." >> "$OUTFILE" 224 | fi 225 | echo "" >> "$OUTFILE" 226 | done 227 | 228 | 229 | 230 | # -------------------------------------------------------------------------------- 231 | # "ls -lRh" - full information on current installed game files 232 | echo "

Installed Files

" >> "$OUTFILE" 233 | cd "$INSTALLDIR" || exit 234 | output_text "ls -lRh in '$INSTALLDIR'" 235 | # shellcheck disable=SC2129 236 | echo "${TEXT_AREA}" >> "$OUTFILE" 237 | ls -lRh >> "$OUTFILE" 2>&1 238 | echo "" >> "$OUTFILE" 239 | 240 | # "$INSTALLDIR/*.sh" - Launch script(s) 241 | # "$INSTALLDIR/share/*.json" - Configuration JSON files 242 | # "$INSTALLDIR/share/*.xml" - Configuration XML files 243 | # "$INSTALLDIR/share/*.txt" - Configuration TXT files 244 | cd "$INSTALLDIR" || exit 245 | for FILE in *.sh share/*.json share/*.xml share/*.txt 246 | do 247 | output_text "'$FILE' in '$INSTALLDIR'" 248 | echo "${TEXT_AREA}" >> "$OUTFILE" 249 | head "$FILE" -n 500 | tee -a "$OUTFILE" | 250 | if [ "$(wc -l)" = "500" ]; 251 | then echo "...truncated..." >> "$OUTFILE" 252 | fi 253 | echo "" >> "$OUTFILE" 254 | done 255 | 256 | # -------------------------------------------------------------------------------- 257 | # "$FERAL_PREFS/*/preferences" - Preferences files 258 | echo "

Preferences

" >> "$OUTFILE" 259 | cd "$FERAL_PREFS" || exit 260 | for FILE in */preferences 261 | do 262 | output_text "'$FILE' in '$FERAL_PREFS'" 263 | echo "${TEXT_AREA}" >> "$OUTFILE" 264 | head "$FILE" -n 500 | tee -a "$OUTFILE" | 265 | if [ "$(wc -l)" = "500" ]; 266 | then echo "...truncated..." >> "$OUTFILE" 267 | fi 268 | echo "" >> "$OUTFILE" 269 | done 270 | 271 | 272 | # -------------------------------------------------------------------------------- 273 | # "$FERAL_PREFS/*/crashes" - Crash dumps 274 | echo "

Crashes

" >> "$OUTFILE" 275 | cd "$FERAL_PREFS" || exit 276 | for FILE in */crashes/*.dmp */crashes/archived/*.dmp 277 | do 278 | # Ignore old crash logs. They can make the report too big to email 279 | # easily if there are too many of them, and they may no longer be 280 | # relevant given software updates. 281 | [[ $(date +%s -r "$FILE") -lt $(date +%s --date="2 weeks ago") ]] && continue 282 | 283 | output_text "'$FILE' in '$FERAL_PREFS'" 284 | echo "> "$OUTFILE" 285 | echo "href=\"data:application/x-dmp; charset=binary;base64," >> "$OUTFILE" 286 | base64 -w1024 "$FILE" >> "$OUTFILE" 287 | echo "\">" >> "$OUTFILE" 288 | date -I'minutes' -r "$FILE" >> "$OUTFILE" 289 | basename "$FILE" .dmp >> "$OUTFILE" 290 | echo "
" >> "$OUTFILE" 291 | done 292 | 293 | # -------------------------------------------------------------------------------- 294 | # Attempt to clean out any login commands that contain passwords 295 | sed -i -E 's/-login \w+ \w+/-login /g' "$OUTFILE" 296 | 297 | # Insert the close tags 298 | if [ "$SKIP_CLOSE" == "1" ]; then 299 | exit 0 300 | fi 301 | 302 | echo " 303 | " >> "$OUTFILE" 304 | --------------------------------------------------------------------------------