[pkg-wine-party] Bug#733648: patch updated
I have updated the patch to make it compatible with kfreebsd_amd64, if
wine is built for that architecture too. I've also tidied it up.
Regards
diff -ur wine-1.6.1-8/debian/scripts/wine wine-1.6.1/debian/scripts/wine
--- wine-1.6.1-8/debian/scripts/wine 2013-12-30 04:29:20.000000000 +0100
+++ wine-1.6.1/debian/scripts/wine 2013-12-31 11:10:02.937957214 +0100
@@ -2,14 +2,65 @@
set -e
-wine=/usr/lib/i386-linux-gnu/wine/bin/wine32
-if [ "$(file -b -L "$1" | cut -d\ -f1)" = "PE32+" ]; then
- wine=/usr/lib/x86_64-linux-gnu/wine/bin/wine64
+WINE32=""
+WINE64=""
+
+#detect which wine binaries are present
+if test -x /usr/lib/i386-linux-gnu/wine/bin/wine32
+ then WINE32="/usr/lib/i386-linux-gnu/wine/bin/wine32"
+elif test -x /usr/lib/powerpc-linux-gnu/wine/bin/wine32
+ then WINE32="/usr/lib/powerpc-linux-gnu/wine/bin/wine32"
+elif test -x /usr/lib/i386-kfreebsd-gnu/wine/bin/wine32
+ then WINE32="/usr/lib/i386-kfreebsd-gnu/wine/bin/wine32"
+fi
+if test -x /usr/lib/x86_64-linux-gnu/wine/bin/wine64
+ then WINE64="/usr/lib/x86_64-linux-gnu/wine/bin/wine64"
+elif test -x /usr/lib/x86_64-kfreebsd-gnu/wine/bin/wine64
+ then WINE64="/usr/lib/x86_64-kfreebsd-gnu/wine/bin/wine64"
fi
-if [ -f $wine ]; then
- $wine "$@"
+#at least one of the two architectures should be present
+if test -z "$WINE32" -a -z "$WINE64"
+ then echo "Your installation of wine appears to be broken. Please assure you have met all dependencies.">&2
+ exit 127
+#if only 32 or 64 bit exist, use that
+elif test -n "$WINE32" -a -z "$WINE64"
+ then wine="$WINE32"
+elif test -z "$WINE32" -a -n "$WINE64"
+ then wine="$WINE64"
+#from here on, both WINE32 and WINE64 are valid
+#if WINEARCH is set, that overrides anything else
+elif test -n "$WINEARCH"
+ then if test "$WINEARCH" = "win32"
+ then wine="$WINE32"
+ elif test "$WINEARCH" = "win64"
+ then wine="$WINE64"
+ else echo "Variable WINEARCH is set to an invalid value.">&2
+ exit 126
+ fi
+#if wine is executed on a file, determine whether it's 32 or 64 bit
+elif test -f "$1"
+ then if [ "$(file -b -L "$1" | cut -d\ -f1)" = "PE32+" ]
+ then wine="$WINE64"
+ else wine="$WINE32"
+ fi
+#otherwise, try to guess from the profile
else
- echo "unable to find wine executable: the $(basename $wine) package probably needs to be installed."
- exit 1
+ #if no WINEPREFIX is given, use default
+ if test -z "$WINEPREFIX"
+ then WINEPREFIX="$HOME/.wine"
+ fi
+ #if WINEPREFIX already exists, use corresponding arch
+ if test -f "$WINEPREFIX/system.reg"
+ then WINEARCH=$(cat "$WINEPREFIX/system.reg"|grep "#arch"|sed -e s/'#arch='/''/)
+ if test "$WINEARCH" = "win64"
+ then wine="$WINE64"
+ else wine="$WINE32"
+ fi
+ #if PROFILE does not exist yet, use default profile for maximum compatibility
+ else wine="$WINE64"
+ fi
fi
+
+#actually run the program
+ $wine "$@"
Reply to: