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