Magic number : 16
#!/bin/bash
# Date : (2009-05-23 15-00)
# Last revision : (2010-02-16 09-00)
# Wine version used : 1.1.38
# Distribution used to test : Fedora 12
# Author : NSLW
# Licence : Retail
# Depend : ImageMagick, unzip
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
download_patch()
{
cd "$REPERTOIRE/ressources"
if [ "`sha1sum < $PATCHFILE | sed 's/ .*//'`" != "$PATCHFILESUM" ]; then
POL_SetupWindow_download "PlayOnLinux is downloading $PATCHFILE" "Downloading patch" "$PATCHLINK/$PATCHFILE"
fi
if [ "`sha1sum < $PATCHFILE | sed 's/ .*//'`" != "$PATCHFILESUM" ]; then
echo 1 #checksum bad
else
echo 0 #checksum good
fi
}
patch_game()
{
POL_SetupWindow_menu "What installer should do?" "Actions" "Let me choose patch manually~Download patch automatically" "~"
if [ "$APP_ANSWER" == "Let me choose patch manually" ]; then
POL_SetupWindow_browse "Select patch file" "$TITLE" ""
PATCHFILE="$APP_ANSWER"
elif [ "$APP_ANSWER" == "Download patch automatically" ]
then
APP_ANSWER="TRUE"
while [ "$APP_ANSWER" == "TRUE" ]; do
APP_ANSWER="FALSE"
if [ $(download_patch) == "1" ]; then
sleep 1
POL_SetupWindow_question "Installer failed to download patch.\nDo you want to try again?" "$TITLE"
fi
done
fi
cd "$REPERTOIRE/ressources"
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TITLE"
wine "$PATCHFILE"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "Patch for $TITLE has been installed successfully" "$TITLE"
}
POL_SetupWindow_make_icon_for_shortcut()
{
convert "$HOME/.local/share/icons/$2" -geometry 32X32 "$REPERTOIRE/icones/32/$1"
}
Get_Latest_Wine_Version()
{
wget http://mulx.playonlinux.com/wine/linux-i386/LIST --output-document="$REPERTOIRE/tmp/LIST"
xyz=`cat "$REPERTOIRE/tmp/LIST" | sed -e 's/\.//g' | cut -d';' -f2 | sort -n | tail -n1`
echo "$(echo $xyz | cut -c1-1).$(echo $xyz | cut -c2-2).$(echo $xyz | cut -c3-4)"
}
TITLE="Diablo II"
PREFIX="DiabloII"
WORKINGWINEVERSION="1.1.38"
PATCHFILE="D2Patch_112a.exe"
PATCHLINK="http://ftp.blizzard.com/pub/diablo2/patches/PC"
PATCHFILESUM="cec6957c0c02fdc4fa4f296a70bd2637240e8e44"
wget http://upload.wikimedia.org/wikipedia/en/d/d5/Diablo_II_Coverart.png --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_presentation "$TITLE" "Blizzard" "www.blizzard.com" "NSLW" "$PREFIX"
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"
#asking about patching
if [ -e "$REPERTOIRE/configurations/installed/$TITLE" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Patch game" "~"
if [ "$APP_ANSWER" == "Patch game" ]; then
patch_game
fi
POL_SetupWindow_Close
exit
fi
POL_SetupWindow_message "Please insert \"Install disc\" (1st disc)" "$TITLE"
POL_SetupWindow_cdrom
cd "$CDROM"
CHECK=$(find . -iwholename ./installer.exe)
if [ "$CHECK" == "" ]; then
CHECK="install.exe"
fi
POL_SetupWindow_check_cdrom "$CHECK"
#taking icon from the game
convert "$CDROM/disc.ico" -geometry 32X32 "$REPERTOIRE/icones/32/$TITLE"
POL_SetupWindow_install_wine "$WORKINGWINEVERSION"
Use_WineVersion "$WORKINGWINEVERSION"
POL_SetupWindow_prefixcreate
#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%" |tr -d '\015' | tr -d '\010'`
PROGRAMFILES=${PROGRAMFILES:3}
POL_SetupWindow_message_image "Installation process will begin after this message\nIt's recommended that you choose full install option." "Installation types" "$PLAYONLINUX/themes/tango/info.png"
wine start /unix "$CDROM/$CHECK"
POL_SetupWindow_message "When the installer will ask you for 2nd CD, click NEXT." "$TITLE"
wine eject
POL_SetupWindow_message "When the installer will ask you for 3rd CD, click NEXT." "$TITLE"
wine eject
POL_SetupWindow_message "Click NEXT when the installation will finish" "$TITLE"
wine eject
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Diablo II" "Diablo II.exe" "" "$TITLE" "" ""
Set_WineVersion_Assign "$WORKINGWINEVERSION" "$TITLE"
POL_SetupWindow_make_icon_for_shortcut "$TITLE" "*_diablo ii.0.xpm"
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Diablo II" "D2VidTst.exe" "" "D2 Video Test" "" ""
Set_WineVersion_Assign "$WORKINGWINEVERSION" "D2 Video Test"
POL_SetupWindow_make_icon_for_shortcut "D2 Video Test" "*_d2vidtst.0.xpm"
POL_SetupWindow_question "Would you like to have got 3dfx Glide wrapper (recommended)?\nYou'll have to rerun Video Test after" "$TITLE"
if [ "$APP_ANSWER" == "TRUE" ]; then
cd "$REPERTOIRE/ressources"
if [ ! -e "$REPERTOIRE/ressources/gl32ogl14d.zip" ]; then
POL_SetupWindow_download "PlayOnLinux is downloading Glide wrapper" "Downloading wrapper" "http://www.svenswrapper.de/gl32ogl14d.zip"
fi
cd "$WINEPREFIX/drive_c/$PROGRAMFILES/Diablo II"
unzip "$REPERTOIRE/ressources/gl32ogl14d.zip"
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Diablo II" "glide-init.exe" "" "D2 3dfx Glide configuration" "" ""
Set_WineVersion_Assign "$WORKINGWINEVERSION" "D2 3dfx Glide configuration"
fi
POL_SetupWindow_reboot
POL_SetupWindow_message "$TITLE has been installed successfully." "$TITLE"
#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TITLE"
if [ "$APP_ANSWER" == "TRUE" ]; then
patch_game
fi
POL_SetupWindow_Close
exit