#!/bin/bash -e

name=$(basename $0)
bindir=/opt/$name/bin

wine32=$bindir/wine
wine64=$bindir/wine64

if test -x $wine32 -a "$WINEARCH" != "win64"; then
    wine=$wine32
elif test -x $wine64; then
    wine=$wine64
    if [ "$(dpkg --print-architecture)" = "amd64" -a "$(dpkg --print-foreign-architectures | grep -cx "i386")" -ne 1 ]; then
        echo "it looks like multiarch needs to be enabled.  as root, please"
        echo "execute \"dpkg --add-architecture i386 && apt-get update &&"
        echo "apt-get install $(echo $name | sed s/wine/wine32/)\""
    fi
else
    echo "error: unable to find wine executable.  this shouldn't happen."
    exit 1
fi

if test -z "$WINEPREFIX"; then
    if test "$wine" = "$wine64"; then
        wineprefix=$HOME/.wine64
    else
        wineprefix=$HOME/.wine
    fi
else
    wineprefix=$WINEPREFIX
fi

if test -z "$WINELOADER"; then
    wineloader=$wine
else
    wineloader=$WINELOADER
fi

if test -z "$WINEDEBUG"; then
    winedebug=-all
else
    winedebug=$WINEDEBUG
fi
#!/bin/bash
Get_Dist_Name()
{
    if grep -Eqii "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
        DISTRO='Deepin'
    elif grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release; then
        DISTRO='UniontechOS'
    elif grep -Eqi "UOS" /etc/issue || grep -Eq "UOS" /etc/*-release; then
        DISTRO='UniontechOS'
    else
         DISTRO='OtherOS'
        fi
}


Get_Dist_Name
if [ -z ${WINEPREFIX} ];then
WINEPREFIX=$HOME/.wine
fi
if [ "$DISTRO" != "Deepin" ] && [ "$DISTRO" != "UniontechOS" ];then
export BOX86_EMU_CMD=/opt/spark-box86/box86
fi
# ARM 需要指定模拟器参数
if [ -f "/opt/deepinemu/tools/init_emu.sh" ];then
    source "/opt/deepinemu/tools/init_emu.sh"
fi


LD_LIBRARY_PATH=/opt/deepin-wine/additional-libs:$LD_LIBRARY_PATH WINEPREFIX=$wineprefix WINELOADER=$wineloader WINEDEBUG=$winedebug $EMU_CMD $EMU_ARGS $wine "$@"
