Skip to content

Instantly share code, notes, and snippets.

@zeehio
Forked from zipizap/hl2_optirun_start.sh
Created November 3, 2012 23:25
Show Gist options
  • Save zeehio/4009270 to your computer and use it in GitHub Desktop.
Save zeehio/4009270 to your computer and use it in GitHub Desktop.
optirun and wine (on Ubuntu precise 12.04 64-bit)
#!/bin/bash
# This is a short script to load applications using bumblebee and wine
# on systems such as Ubuntu precise 12.04 64 bit using the discrete card.
# Usage example (the -opengl would be a parameter of the program "Frozen Throne.exe"):
# optiwine.sh "Frozen Throne.exe" -opengl
# Extra information:
# If you want to load programs with the integrated intel card instead, you may run them this way:
# LD_LIBRARY_PATH="/usr/lib/i386-linux-gnu/mesa/" wine "Frozen Throne.exe" -opengl
function msg {
# Description:
# This function echoes-with-colors the arguments passed in
# Usage:
# msg 'whatever you want to print :)'
echo -e '\033[33m\033[44m'$@'\033[0m'
}
if [ "$1" == "RECALLED_WITH_OPTIRUN" ]; then
#we are being run with optirun :)
msg "$0 starting"
shift
LD_LIBRARY_PATH="/usr/lib32/nvidia-current/" wine "$@"
#wait while all wine programs are running, until they terminate
wineserver -w
msg "wineserver has terminated"
msg "$0 terminating"
exit 0
else
#This scripts needs to be called through optirun.
#In order to garantee it, we re-execute using optirun
exec optirun $0 RECALLED_WITH_OPTIRUN "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment