ironhide icon indicating copy to clipboard operation
ironhide copied to clipboard

optirun script not properly detecting 32/64 bit binaries

Open de2Zotjes opened this issue 13 years ago • 2 comments

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 avatar Dec 28 '11 12:12 de2Zotjes

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

  • command=$arg +else
  • command=$(which $arg) +fi

+while [[ -L $command ]];do

  • command=$(stat --format %N /etc/alternatives/java|sed -e "s/.*-> `([^']+)'$/\1/") +done

-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

de2Zotjes avatar Dec 28 '11 12:12 de2Zotjes

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.

icb410 avatar Mar 01 '12 16:03 icb410