#! /bin/sh
# ie6wine: install IE6 SP1 in wine using local IE6 SP1 installation files.
# Tested only in wine 0.9.48.
# (c) 2007. Artem S. Tashkinov. No license apply to this script, use it freely.
unset mv ls mkdir rm
die()
{
echo "Error: $*. Exiting"
exit 1
}
reg()
{
for i in *.dll *.ocx; do
WINEPREFIX="$D_WINE" regsvr32 /i $i &> /dev/null
echo -n "."
sleep 0.5
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
echo "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer]" >> "$1" || die "cannot append to $1"
echo "\"Build\"=\"50000.0\"" >> "$1" || die "cannot append to $1"
echo "\"Version\"=\"5.0.0.0\"" >> "$1" || die "cannot append to $1"
echo "\"IVer\"=\"50\"" >> "$1" || die "cannot append to $1"
WINEPREFIX="$D_WINE" 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 files
POSTFIX="builtin"
D_WINE="$HOME/.wineIE"
WINEPREFIX="$D_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 --prefix "$D_WINE" || 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"
done
echo "* Setting dlls overrides ..."
dlls_over "$F_DLLS2OVERRIDE" "$DLLS2OVERRIDE"
WINEPREFIX="$D_WINE" wineserver -k
echo "* 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 ie6path
done
cd "$ie6path" || die "$ie6path disappeared?!"
WINEPREFIX="$D_WINE" wine IE6SETUP.EXE
WINEPREFIX="$D_WINE" wineboot
echo "* 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 ..."
cd "$D_SYSTEM" || die "cannot enter system32 directory"
reg; reg
echo -e "\n* IE6 installation complete. You can run IE6 from $F_IE or simply run 'wine \"C:\Program Files\Internet Explorer\iexplore.exe\"'"