[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[pkg-wine-party] Bug#742561: Yet another patch for the wine script - wine64 support



Followup-For: Bug #742561
Package: wine-development
Version: 1.7.26-2

Hi,

based on Floris' patches here another patch:

Try wine64 if
- a 64-bit executable is given as argument
  (NOTE: there are 64-bit applications with 32-bit installers, so this
  won't help everytime), or
- if the WINEPREFIX is a 64-bit
  (NOTE: don't do this once WoW64 is implemented, see
  http://wiki.winehq.org/Wine64ForPackagers.), or
- if WINEARCH is set to win64.

In all other cases use wine (32-bit).

Add error message if wine64 is requested but not found.

Greets
jre
diff --git a/debian/scripts/wine b/debian/scripts/wine
index 388f3ae..67d0db9 100755
--- a/debian/scripts/wine
+++ b/debian/scripts/wine
@@ -8,16 +8,38 @@ bindir=/usr/lib/$name
 wine32=$bindir/wine
 wine64=$bindir/wine64
 
-if test -x $wine32; then
+# Set WINEPREFIX for later use.
+if test -z $WINEPREFIX; then WINEPREFIX="$HOME/.wine"; fi
+
+# Try wine64, if
+# - a 64-bit executable is given as argument
+#   (NOTE: there are 64-bit applications with 32-bit installers, so this won't help everytime), or
+# - if the WINEPREFIX is a 64-bit
+#   (NOTE: don't do this once WoW64 is implemented, see http://wiki.winehq.org/Wine64ForPackagers.), or
+# - if WINEARCH is set to win64.
+if test -e "$1" -a "$(file -b -L "$1" | cut -d\  -f1)" = "PE32+" || \
+test -f "$WINEPREFIX/system.reg" -a "$(grep "PROCESSOR_ARCHITECTURE" $WINEPREFIX/system.reg | cut -d= -f2)" = "\"AMD64\"" || \
+test "$WINEARCH" = "win64" ; then
+    if test -x $wine64; then
+	wine=$wine64
+    else
+        echo "error: unable to find wine64 executable."
+        if [ "$(dpkg --print-architecture)" = "amd64" ]; then
+            echo "as root, please execute \"apt-get install $(echo $name | sed s/wine/wine64/)\""
+        else
+            echo "you need $(echo $name | sed s/wine/wine64/). but this is only available on architecture amd64."
+        fi
+        exit 1
+    fi
+# Try 32-bit wine otherwise.
+elif test -x $wine32; then
     wine=$wine32
-elif test -x $wine64; then
-    wine=$wine64
+else
     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
-else
     echo "error: unable to find wine executable.  this shouldn't happen."
     exit 1
 fi

Reply to: