MrMEEE / ironhide

Optimus Support for Linux Through VirtualGL - PPA version also available: https://launchpad.net/~mj-casalogic/+archive/ironhide
http://www.martin-juhl.dk
88 stars 0 forks source link

optirun script not properly detecting 32/64 bit binaries #214

Open de2Zotjes opened 12 years ago

de2Zotjes commented 12 years ago

The optirun script does not find the actual file being run when one does not provide an absolute path. And even when providing an absolute path, if it is a symlink the script does not follow the symlink.

de2Zotjes commented 12 years ago

below is a diff to enable proper handling of path binaries and symlinks:

--- optirun 2011-11-30 23:07:16.836578521 +0100 +++ /usr/bin/optirun 2011-12-27 09:29:07.138437811 +0100 @@ -107,13 +107,23 @@ fi

for arg in $@; do +if [[ -e $arg ]]; then

-if [[ $(echo $(which $arg) | grep wine) -eq 0 ]]; then +if [[ $(echo $command | grep wine) -eq 0 ]]; then

-if [[ $(file $(which $arg) | grep 64-bit |wc -l) -ne 0 ]];then +if [[ $(file $command | grep 64-bit |wc -l) -ne 0 ]];then VGL_DRIVER=/usr/lib/nvidia-current break -elif [[ $(file $(which $arg) | grep 32-bit |wc -l) -ne 0 ]];then +elif [[ $(file $command | grep 32-bit |wc -l) -ne 0 ]];then VGL_DRIVER=/usr/lib32/nvidia-current break fi

icb410 commented 12 years ago

Also see issue #236 (https://github.com/MrMEEE/ironhide/issues/236 ). I wrote a slightly different solution to fix the same problem. It uses readlink to get the absolute path of symlinks. It also fixes a bug for detecting whether wine is being executed.