#!/bin/sh
set -e
bindir=/usr/lib/$(basename $0)
wine32=$bindir/wine
wine64=$bindir/wine64
if test ! -x $wine32 -a ! -x $wine64; then
echo "error: unable to find wine executable. this shouldn't happen."
exit 1
fi
if test -x $wine32; then
wine=$wine32
echo "32-bit Wine is possible"
fi
if test -x $wine64; then
wine=$wine64
echo "64-bit Wine is possible"
if [ "$(dpkg --print-architecture)" = "amd64" -a "$(dpkg
--print-foreign-architectures)" != "i386" ]; then
echo "it looks like multiarch needs to be enabled. as root,
please"
echo "execute \"dpkg --add-architecture i386 && apt-get install
wine32\""
fi
fi
if test -x $wine32 -a -x $wine64; then
if test "$WINEARCH" = "win64"; then
echo "Running a 64-bit Wine"
wine=$wine64
else
echo "Running a 32-bit Wine"
echo "Use WINEARCH=win64 $(basename $0) for a 64-bit wineserver"
wine=$wine32
fi
fi
if test -z $WINELOADER; then
wineloader=$wine
else
wineloader=$WINELOADER
fi
if test -z $WINEDEBUG; then
winedebug=-all
else
winedebug=$WINEDEBUG
fi
WINELOADER=$wineloader WINEDEBUG=$winedebug $wine "$@"