Please review attached patch. -- SY, Konstantin Demin
description: debian/scripts/wine: support relative WINEPREFIX, remove '-e' from hashbang, formatting author: Konstantin Demin <rockdri...@gmail.com>
diff --git a/debian/scripts/wine b/debian/scripts/wine index 0850dff..6950525 100755 --- a/debian/scripts/wine +++ b/debian/scripts/wine @@ -1,44 +1,63 @@ -#!/bin/sh -e - -name=$(basename $0) -bindir=/usr/lib/$name - -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)" != "i386" ]; 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 +#!/bin/sh +name=$(basename "$0") +bindir=/usr/lib/${name} + +wine32=${bindir}/wine +wine64=${bindir}/wine64 + +if [ -x "${wine32}" -a "${WINEARCH}" != "win64" ]; then + wine=${wine32} +elif [ -x "${wine64}" ]; then + wine=${wine64} + dpkg_native=$(dpkg --print-architecture) + dpkg_foreign=$(dpkg --print-foreign-architectures) + + if [ "${dpkg_native}" = "amd64" -a "${dpkg_foreign}" != "i386" ]; then + cat 1>&2 <<-EOF + it looks like multiarch needs to be enabled. + as root, please execute: + » dpkg --add-architecture i386 + » apt-get update + » apt-get install $(echo "${name}" | sed -e 's/wine/wine32/') + EOF + fi else - echo "error: unable to find wine executable. this shouldn't happen." - exit 1 + cat 1>&2 <<-EOF + error: unable to find wine executable. this shouldn't happen. + EOF + exit 1 fi -if test -z $WINEPREFIX; then - if "$wine" = "$wine64"; then - wineprefix=$HOME/.wine64 - else - wineprefix=$HOME/.wine -else - wineprefix=$WINEPREFIX +if [ -z "${WINELOADER}" ]; +then wineloader=${wine} +else wineloader=${WINELOADER} fi -if test -z $WINELOADER; then - wineloader=$wine -else - wineloader=$WINELOADER +if [ -z "${WINEDEBUG}" ]; +then winedebug=-all +else winedebug=${WINEDEBUG} fi -if test -z $WINEDEBUG; then - winedebug=-all +if [ -z "${WINEPREFIX}" ]; then + if [ "${wine}" = "${wine64}" ]; + then wineprefix=${HOME}/.wine64 + else wineprefix=${HOME}/.wine + fi else - winedebug=$WINEDEBUG + wineprefix=${WINEPREFIX} +fi + +wineprefix_normal=$(readlink -f "${wineprefix}") +if [ -z "${wineprefix_normal}" ]; then + cat 1>&2 <<-EOF + wine prefix not found and/or cannot be created. + check path again: + » ${wineprefix} + EOF + exit 1 fi -WINEPREFIX=$wineprefix WINELOADER=$wineloader WINEDEBUG=$winedebug $wine "$@" +export WINEPREFIX=${wineprefix_normal} +export WINELOADER=${wineloader} +export WINEDEBUG=${winedebug} +exec "${wine}" "$@"