e76b1b8
#!/bin/sh
e76b1b8
HAVE_32=false
e76b1b8
HAVE_64=false
e76b1b8
e76b1b8
if [ -x "/usr/bin/wine32" ]; then
e76b1b8
HAVE_32=true
e76b1b8
fi
e76b1b8
e76b1b8
if [ -x "/usr/bin/wine64" ]; then
e76b1b8
HAVE_64=true
e76b1b8
fi
e76b1b8
e76b1b8
if [ -f "${1}" ]; then
e76b1b8
    archtype=`file "${1}" | cut -d':' -f2 | cut -d' ' -f2`
e76b1b8
e76b1b8
    if [ ${archtype} = 'PE32+' ]; then # 64bit
e76b1b8
	if $HAVE_64; then
e76b1b8
	    exec "/usr/bin/wine64" "${@}";
e76b1b8
	elif [ `uname -m` = 'x86_64' ]; then
e76b1b8
	    echo "Your are trying to run a 64bit application. Please install the 64bit version of wine."
e76b1b8
	    echo "You can achieve this by running 'su -c \"yum install \\\"wine(x86-64)\\\"\"'"
e76b1b8
	else
e76b1b8
	    echo "Your are trying to run a 64bit application on a 32bit installation of Fedora. You need a 64bit version of Fedora to run this application."
e76b1b8
	fi
e76b1b8
    else
e76b1b8
	if $HAVE_32; then
e76b1b8
	    exec "/usr/bin/wine32" "${@}"
e76b1b8
	else
e76b1b8
	    echo "Your are trying to run a 32bit application. Please install the 32bit version of wine."
e76b1b8
	    echo "You can achieve this by running 'su -c \"yum install \\\"wine(x86-32)\\\"\"'"
e76b1b8
	fi
e76b1b8
    fi
e76b1b8
else
e76b1b8
    if $HAVE_64; then
e76b1b8
	exec "/usr/bin/wine64" "${@}";
e76b1b8
    else
e76b1b8
	exec "/usr/bin/wine32" "${@}";
e76b1b8
    fi
e76b1b8
fi