#!/bin/sh

set -e

wine=/usr/bin/wine32
if [ "$(file -b -L "$1" | cut -d\  -f1)" = "PE32+" -o "$WINEARCH" = "win64" ]; then
    wine=/usr/bin/wine64
fi

if [ -f $wine ]; then
    $wine "$@"
else
    echo "unable to find wine executable: the $(basename $wine) package probably needs to be installed."
    exit 1
fi
