#! /bin/sh# ie6wine: install IE6 SP1 in wine using local IE6 SP1 installation files.# Tested only in wine 0.9.48.# 2007. Artem S. Tashkinov. No license apply to this script, use it freely.unset mv ls mkdir rmdie(){ echo "Error: $*. Exiting" exit 1}reg(){ for i in *.dll *.ocx; do regsvr32 /i $i &> /dev/null echo -n "." done}dlls_over(){ echo -e "REDEDIT4\n" > "$1" || die "cannot append to $1" echo "[HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides]" >> "$1" || die "cannot append to $1" for i in $2; do echo "\"$i\"=\"native, builtin\"" >> "$1" || die "cannot append to $1" done regedit "$1" || die "cannot import $1"}DLLS2BACKUP="mshtml shdocvw shlwapi urlmon wininet"DLLS2OVERRIDE="iexplore.exe mshtml shdoclc shdocvw shlwapi urlmon wininet mlang"DLLS2REGISTER="shdocvw browseui" # Currently unused because we re'register all filesPOSTFIX="builtin"D_WINE="$HOME/.wine"D_CDRIVE="$D_WINE/drive_c"D_SYSTEM="$D_CDRIVE/windows/system32"D_TEMP="$D_CDRIVE/windows/temp/cabextract"F_DLLS2OVERRIDE="$D_CDRIVE/ie6.reg"F_IE="$D_CDRIVE/Program Files/Internet Explorer/iexplore.exe"F_ELIB="MSLS31.DLL"F_ESRC="IEMIL_3.CAB"echo -e "* This script will help you to install IE6 SP1 in wine (only 0.9.48 is tested!)\n"which cabextract &>/dev/null || die "cabextract not found. Please, install it at first"test -z "`ps ax | grep wineserver | grep -v grep`" || die "Wineserver is detected. Please, exit all Windows applications"echo "* Creating windows bottle ..."test ! -d "$D_WINE" || die "$D_WINE found but only a fresh installation is supported. Delete or backup this folder"wineprefixcreate || die "wineprefixcreate failed"test -d "$D_SYSTEM" || die "$D_WINE creation failed"echo "* Backing up iexplorer.exe $DLLS2BACKUP ..."mv "$F_IE" "$F_IE.$POSTFIX" || die "Cannot find or rename $F_IE"for i in $DLLS2BACKUP; do mv "$D_SYSTEM/$i.dll" "$D_SYSTEM/$i.dll.$POSTFIX" || die "failed backup'ing $i.dll"doneecho "* Setting dlls overrides ..."dlls_over "$F_DLLS2OVERRIDE" "$DLLS2OVERRIDE"wineserver -kecho "* Installing IE6 SP1 ..."ie6path=./while test -z "`ls -l "$ie6path" 2>/dev/null | grep -i IE6SETUP.EXE`"; do echo "IE6SETUP.EXE not found at '$ie6path'" echo -n "* Please, give me a full path to the IE6 SP1 installation files (press Ctrl + C to abort): " read ie6pathdonecd "$ie6path" || die "$ie6path disappeared?!"wine IE6SETUP.EXEwinebootecho "* Installing additional libraries ..."mkdir -p "$D_TEMP" || die "cannot create $D_TEMP directory"CAB=$ie6path/`ls "$ie6path" | grep -i iemil_3.cab`cabextract -d "$D_TEMP" "$CAB" >/dev/null || die "cannot extract $CAB"FILE=`ls "$D_TEMP" | grep -i msls31.dll`mv "$D_TEMP/$FILE" "$D_SYSTEM"echo "* Registering libraries ..."sleep 30cd "$D_SYSTEM" || die "cannot enter system32 directory"reg; regecho -e "\n* IE6 installation complete. You can run IE6 from $F_IE or simply run 'wine \"C:\Program Files\Internet Explorer\iexplore.exe\"'"