daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 800 in 300 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #
  3. # Script to launch the Steam Link app on Raspberry Pi
  4.  
  5. TOP=$(cd "$(dirname "$0")" && pwd)
  6.  
  7. function show_message()
  8. {
  9.     style=$1
  10.     shift
  11.     if ! zenity "$style" --no-wrap --text="$*" 2>/dev/null; then
  12.         case "$style" in
  13.         --error)
  14.             title=$"Error"
  15.             ;;
  16.         --warning)
  17.             title=$"Warning"
  18.             ;;
  19.         *)
  20.             title=$"Note"
  21.             ;;
  22.         esac
  23.  
  24.         # Save the prompt in a temporary file because it can have newlines in it
  25.         tmpfile="$(mktemp || echo "/tmp/steam_message.txt")"
  26.         echo -e "$*" >"$tmpfile"
  27.         if [ "$DISPLAY" = "" ]; then
  28.             cat $tmpfile; echo -n 'Press enter to continue: '; read input
  29.         else
  30.             xterm -T "$title" -e "cat $tmpfile; echo -n 'Press enter to continue: '; read input"
  31.         fi
  32.         rm -f "$tmpfile"
  33.     fi
  34. }
  35.  
  36. # Install any additional dependencies, as needed
  37. if [ -z "${STEAMSCRIPT:-}" ]; then
  38.     STEAMSCRIPT=/usr/bin/steamlink
  39. fi
  40. STEAMDEPS="$(dirname $STEAMSCRIPT)/steamlinkdeps"
  41. if [ -f "$STEAMDEPS" -a -f "$TOP/steamlinkdeps.txt" ]; then
  42.     "$STEAMDEPS" "$TOP/steamlinkdeps.txt"
  43. fi
  44.  
  45. # Set up the temporary directory
  46. export TMPDIR="$TOP/.tmp"
  47. rm -rf "$TMPDIR"
  48. mkdir -p "$TMPDIR"
  49.  
  50. # Restore the display when we're done
  51. cleanup()
  52. {
  53.     screenblank -k
  54. }
  55. trap cleanup 2 3 15
  56.  
  57. # Run the shell application and launch streaming
  58. QT_VERSION=5.12.0
  59. export PATH="$TOP/bin:$PATH"
  60. export QTDIR="$TOP/Qt-$QT_VERSION"
  61. export QT_PLUGIN_PATH="$QTDIR/plugins"
  62. #export QT_QPA_PLATFORM="eglfs"
  63. #export QT_QPA_PLATFORM_PLUGIN_PATH="$QT_PLUGIN_PATH/platforms"
  64. #export LD_LIBRARY_PATH="$TOP/lib:$QTDIR/lib:$LD_LIBRARY_PATH"
  65. export LD_LIBRARY_PATH="$QTDIR/lib:$TOP/lib:$LD_LIBRARY_PATH"
  66. #export SDL_GAMECONTROLLERCONFIG_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/Valve Corporation/SteamLink/controller_map.txt"
  67. export SDL_GAMECONTROLLERCONFIG_FILE="$TOP/.local/share/Valve Corporation/SteamLinkcontroller_map.txt"
  68.  
  69. QPLATFORM="eglfs"
  70. export QT_QPA_EGLFS_FORCE888=1
  71.  
  72. while true; do
  73.         shell -platform "$QPLATFORM" "$@"
  74.  
  75.     # See if the shell wanted to launch anything
  76.     cmdline_file="$TMPDIR/launch_cmdline.txt"
  77.     if [ -f "$cmdline_file" ]; then
  78.         cmd=`cat "$cmdline_file"`
  79.         eval $cmd
  80.         rm -f "$cmdline_file"
  81.     else
  82.         # We're all done...
  83.         break
  84.     fi
  85. done
  86. cleanup
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top