Skip to content

Instantly share code, notes, and snippets.

@foriequal0
Created September 4, 2021 17:48
Show Gist options
  • Save foriequal0/ab39be70dbf6a20bd6e99a8a95940e88 to your computer and use it in GitHub Desktop.
Save foriequal0/ab39be70dbf6a20bd6e99a8a95940e88 to your computer and use it in GitHub Desktop.
#!/bin/bash
# PlayOnLinux Function
# Date : see changelog
# Last revision : see changelog
# Author : Unknown
# Only For : http://www.playonlinux.com
# CHANGELOG:
# [Unknown] (?)
# Initial script.
# [GNU_Raziel] (2011-08-28 21:00)
# Update
# [Dadu042] (2020-10-12 14-00)
# Attempt to make it easier to understand.
# [Dadu042] (2020-10-12 14-30)
#  Attempt to add Gecko v2.47 for Wine v1.9.13 to v3.x.x .
#  Note: the current default Gecko version is still v1.3.0 (2011 ?).
# Check if Gecko is already installed (otherwise do exit this script).
unset GECKO_EXIST
GECKO_EXIST=`find $WINEPREFIX -name "xul.dll"`
if [ ! -n "$GECKO_EXIST" ]; then
# Load the HTML rendering Engine (Gecko)
WINDIR="$WINEPREFIX/drive_c/windows/"
# Matching Gecko versions: https://wiki.winehq.org/Gecko#Installing
case `wine --version` in
wine-0*|wine-1.0*|wine-1.1|wine-1.1.?|wine-1.1.11)
GECKO_DIR="$WINDIR"
GECKO_VERSION=0.1.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-0.1.0.cab"
GECKO_SHA1SUM=c16f1072dc6b0ced20935662138dcf019a38cd56
;;
wine-1.1.1[234]*)
GECKO_DIR="$WINDIR"
GECKO_VERSION=0.9.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-0.9.0.cab"
GECKO_SHA1SUM=5cf410ff7fdd3f9d625f481f9d409968728d3d09
;;
wine-1.1.1[56789]*|wine-1.1.2[0123456]*)
GECKO_DIR="$WINDIR"
GECKO_VERSION=0.9.1
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-0.9.1.cab"
GECKO_SHA1SUM=9a49fc691740596517e381b47096a4bdf19a87d8
;;
esac
# x86_64 gecko package for wine64
if [ -e "$WINDIR/syswow64" ]; then
case `wine --version` in
wine-1.1.2[789]*|wine-1.2*|wine-1.3|wine-1.3.1)
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=1.0.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.0.0-x86.cab"
GECKO_SHA1SUM=afa22c52bca4ca77dcb9edb3c9936eb23793de01
;;
wine-1.3.[23456789]|wine-1.3.1[012345])
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=1.1.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.1.0-x86.cab"
GECKO_SHA1SUM=1b6c637207b6f032ae8a52841db9659433482714
;;
wine-1.3.1[6789]|wine-1.3.2[012345])
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=1.2.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.2.0-x86.msi"
GECKO_SHA1SUM=6964d1877668ab7da07a60f6dcf23fb0e261a808
;;
wine-1.9.1[3456789]|wine-2|wine-3)
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=2.47
GECKO_URL="http://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi"
GECKO_SHA1SUM=f9a937e9a46d47fda701d257e60601f22e7a4510
;;
wine-5)
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=2.47.1
GECKO_URL="http://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86.msi"
GECKO_SHA1SUM=d0f6a8974cc59f8e24b467d5eef1eaccd4138919
wine-6)
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=2.47.2
GECKO_URL="http://dl.winehq.org/wine/wine-gecko/2.47.2/wine-gecko-2.47.2-x86.msi"
GECKO_SHA1SUM=c910f3f1aa776c194924634e07817a9e0f55b6f8
*)
GECKO_DIR="$WINDIR/syswow64"
GECKO_VERSION=1.3
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.3-x86.msi"
GECKO_SHA1SUM=acc6a5bc15ebb3574e00f8ef4f23912239658b41
;;
esac
else
case `wine --version` in
wine-1.1.2[789]*|wine-1.2*|wine-1.3|wine-1.3.1)
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=1.0.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.0.0-x86.cab"
GECKO_SHA1SUM=afa22c52bca4ca77dcb9edb3c9936eb23793de01
;;
wine-1.3.[23456789]|wine-1.3.1[012345])
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=1.1.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.1.0-x86.cab"
GECKO_SHA1SUM=1b6c637207b6f032ae8a52841db9659433482714
;;
wine-1.3.1[6789]|wine-1.3.2[012345])
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=1.2.0
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.2.0-x86.msi"
GECKO_SHA1SUM=6964d1877668ab7da07a60f6dcf23fb0e261a808
;;
wine-1.9.1[3456789]|wine-2|wine-3)
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=2.47
GECKO_URL="http://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi"
GECKO_SHA1SUM=f9a937e9a46d47fda701d257e60601f22e7a4510
;;
wine-5)
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=2.47.1
GECKO_URL="http://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86.msi"
GECKO_SHA1SUM=d0f6a8974cc59f8e24b467d5eef1eaccd4138919
wine-6)
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=2.47.2
GECKO_URL="http://dl.winehq.org/wine/wine-gecko/2.47.2/wine-gecko-2.47.2-x86.msi"
GECKO_SHA1SUM=c910f3f1aa776c194924634e07817a9e0f55b6f8
*)
GECKO_DIR="$WINDIR/system32"
GECKO_VERSION=1.3
GECKO_URL="http://downloads.sourceforge.net/wine/wine_gecko-1.3-x86.msi"
GECKO_SHA1SUM=acc6a5bc15ebb3574e00f8ef4f23912239658b41
;;
esac
fi
GECKO_INSTALLER="${GECKO_URL##*/}"
if test ! -f "$POL_USER_ROOT/ressources/$GECKO_INSTALLER"
then
POL_Download_Resource "$GECKO_URL" "Gecko"
fi
# Extract files
GECKO_EXT="${GECKO_URL##*.}"
if [ "$GECKO_EXT" == "cab" ]; then
mkdir -p "$GECKO_DIR/gecko/$GECKO_VERSION"
cd "$GECKO_DIR/gecko/$GECKO_VERSION"
cabextract "$POL_USER_ROOT/ressources/$GECKO_INSTALLER"
cd "$olddir"
else
POL_Wine msiexec /i "$POL_USER_ROOT/ressources/$GECKO_INSTALLER"
cd "$olddir"
fi
cat > "$POL_USER_ROOT/tmp/geckopath.reg" <<_EOF_
REGEDIT4
[HKEY_LOCAL_MACHINE\\Software\\Wine\\MSHTML\\$GECKO_VERSION]
_EOF_
printf '"GeckoPath"="' >>"$POL_USER_ROOT/tmp/geckopath.reg"
case $GECKO_VERSION in
0.*)
printf 'c:\\windows\\gecko\\'$GECKO_VERSION'\\wine_gecko\\"' |
sed "s/\\\\/\\\\\\\\/g" >> "$POL_USER_ROOT/tmp/geckopath.reg"
;;
*)
# x86 gecko path for wine64
if [ -e "$WINDIR/syswow64" ]; then
printf 'c:\\windows\\syswow64\\gecko\\'$GECKO_VERSION'\\wine_gecko\\"' |
sed "s/\\\\/\\\\\\\\/g" >> "$POL_USER_ROOT/tmp/geckopath.reg"
else
printf 'c:\\windows\\system32\\gecko\\'$GECKO_VERSION'\\wine_gecko\\"' |
sed "s/\\\\/\\\\\\\\/g" >> "$POL_USER_ROOT/tmp/geckopath.reg"
fi
;;
esac
# Set installation path
POL_Wine regedit "$POL_USER_ROOT/tmp/geckopath.reg"
# Register the dll, since it was disabled before
POL_Wine regsvr32 mshtml
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment