SHA256
1
0
forked from pool/wine
wine/wisotool
2010-04-25 16:43:42 +00:00

1958 lines
60 KiB
Bash

#!/bin/sh
# Quick and dirty script to install apps from .iso files
# Adapted from winetricks as of r995
# Copyright 2007, 2008, 2009, 2010 Google (Dan Kegel, dank@kegel.com)
# Copyright 2008, 2009, 2010 Austin English (austinenglish@gmail.com)
# License: LGPL (for compatibility with winehq)
# Please report problems at http://code.google.com/p/winezeug/issues
# Note to contributors: please avoid gnu extensions in this shell script,
# as it has to run on MacOSX and Solaris, too. A good book on the topic is
# "Portable Shell Programming" by Bruce Blinn
#---- Constants -------------------------------------------------
# Name of this version of wisotool (YYYYMMDD)
VERSION=20100424
early_wine()
{
WINEDLLOVERRIDES=mshtml= $WINE "$@"
}
# Default values for important settings if not already in environment.
# These settings should not need editing here.
case "$OS" in
"Windows_NT")
# Cheezy fix for getting rid of double slashes when running cygwin in wine
case "$HOME" in
/) HOME="" ;;
esac
WINE=""
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
DRIVE_C="C:/"
XXXPATH=cygpath
;;
*)
WINE=${WINE:-wine}
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
DRIVE_C="$WINEPREFIX/dosdevices/c:"
XXXPATH="early_wine winepath"
# FIXME: does id work on mac/solaris?
USERID=`id -u`
;;
esac
# You can add your own verb to wisotool by creating $WISOTOOL_VERBS/foo.verb
WISOTOOL_VERBS="${WISOTOOL_VERBS:-$HOME/.wisotool/verbs}"
mkdir -p "$WISOTOOL_VERBS"
# Internal variables; these locations are not too important
WISOTOOL_CACHE="${WISOTOOL_CACHE:-$HOME/.wisotoolcache}"
test -d "$WISOTOOL_CACHE" || WISOTOOL_CACHE="$HOME/.wisotool/cache"
WISOTOOL_CACHE_WIN="`$XXXPATH -w $WISOTOOL_CACHE | tr '\012' ' ' | sed 's/ $//'`"
WISOTOOL_TMP="$DRIVE_C"/wisotooltmp
WISOTOOL_TMP_WIN='c:\wisotooltmp'
# Clean up after failed runs, if needed
rm -rf "$WISOTOOL_TMP"
mkdir -p "$WISOTOOL_TMP"
# Handle case where z: doesn't exist
if test "$WISOTOOL_CACHE_WIN" = ""
then
# WISOTOOL_CACHE isn't accessible via a drive letter mapping, so make one,
# but be sure to clean it up later.
for letter in y x w v u t s r q
do
if ! test -d "$WINEPREFIX"/dosdevices/${letter}:
then
WISOTOOL_CACHE_SYMLINK="$WINEPREFIX"/dosdevices/${letter}:
ln -sf "$WISOTOOL_CACHE" "$WISOTOOL_CACHE_SYMLINK"
break
fi
done
fi
USERNAME=${USERNAME:-$LOGNAME}
# Overridden for windows
ISO_MOUNT_ROOT=/mnt/wisotool
WINDIR="$DRIVE_C/windows"
# Which sourceforge mirror to use. Rotate based on time, since
# their mirror picker sometimes persistantly sends you to a broken
# mirror.
case `date +%S` in
*[01]) SOURCEFORGE=http://internap.dl.sourceforge.net/sourceforge ;;
*[23]) SOURCEFORGE=http://easynews.dl.sourceforge.net/sourceforge ;;
*) SOURCEFORGE=http://downloads.sourceforge.net;;
esac
#---- Functions -------------------------------------------------
# Detect which sudo to use
detect_sudo() {
SUDO=sudo
test "$GUI" = 1 || return
if test x"$DISPLAY" != x""
then
if test -x "`which gksudo 2>/dev/null`"
then
SUDO=gksudo
elif test -x "`which kdesudo 2>/dev/null`"
then
SUDO=kdesudo
fi
fi
}
# Detect which menu program to use
detect_menu() {
# TODO: add 'dialog'
MENU=xmessage
if test -x "`which zenity 2>/dev/null`"
then
MENU=zenity
elif test -x "`which kdialog 2>/dev/null`"
then
MENU=kdialog
fi
}
warn() {
echo "------------------------------------------------------"
echo "$@"
echo "------------------------------------------------------"
test "$GUI" = 1 || return
# For some reason, nulls were showing up in $@?!, causing truncated output in zenity
msg="`echo $@ | tr '\000' ' '`"
case $MENU in
*zenity) zenity --error --title=Wisotool --text="$msg" --no-wrap;;
*kdialog) kdialog --title Wisotool --error "$msg" ;;
*xmessage) xmessage -title Wisotool -center " Error: $msg " ;;
esac
}
die() {
warn "$@"
exit 1
}
# Abort if user doesn't own the given directory (or its parent, if it doesn't exist yet)
die_if_user_not_dirowner() {
if test -d "$1"
then
checkdir="$1"
else
# fixme: quoting problem?
checkdir=`dirname "$1"`
fi
nuser=`id -u`
nowner=`ls -l -n -d -L "$checkdir" | awk '{print $3}'`
if test x$nuser != x$nowner
then
die "You (`id -un`) don't own $checkdir. Don't run wisotool as another user!"
fi
}
#----------------------------------------------------------------
usage() {
set +x
# WARNING: do not use single quote in any package description; that breaks the gui menu.
echo "Script to install games automatically."
echo "Usage: $0 [options] package [package] ..."
echo ""
echo "Options:"
echo " -q quieter"
echo " -v verbose"
echo " -V display Version"
echo "Packages:"
sort "$WISOTOOL_VERBS"/menutext
echo "Pseudopackages:"
echo " load Load a disc into the iso cache"
echo " load=KEY Load a disc with given key; only works from commandline at moment"
# Show the other help message, too
case $GUI in
0) load_help ;;
esac
}
#----------------------------------------------------------------
# Trivial GUI just to handle case where user tries running without commandline
kdialog_showmenu() {
title="$1"
shift
text="$1"
shift
col1name="$1"
shift
col2name="$1"
shift
while test $# -gt 0
do
args="$args $1 $1 off"
shift
done
kdialog --title "$title" --separate-output --checklist "$text" $args
}
xmessage_showmenu() {
title="$1"
shift
text="$1"
shift
col1name="$1"
shift
col2name="$1"
shift
if test $# -gt 0
then
args="$1"
shift
fi
while test $# -gt 0
do
args="$args,$1"
shift
done
(echo "$title"; echo ""; echo "$text") | \
xmessage -print -file - -buttons "Cancel,$args" | sed 's/Cancel//'
}
showmenu()
{
# FIXME: call verblist_get_descriptions instead of scraping usage() ?
case $MENU in
zenity)
echo "zenity --title 'Select a package to install' --text 'Install?' --list --checklist --column '' --column Package --column Description --height 440 --width 600 \\" > "$WISOTOOL_TMP"/zenity.sh
usage | grep '^ [3a-z]' | sed 's/^ \([^ ]*\) *\(.*\)/FALSE "\1" '"'\2'/" | sed 's/$/ \\/' >> $WISOTOOL_TMP/zenity.sh
todo="`sh "$WISOTOOL_TMP"/zenity.sh | tr '|' ' '`"
;;
kdialog)
packages=`usage | awk '/^ [3a-z]/ {print $1}'`
todo="`kdialog_showmenu "wisotool" "Select a package to install" "Install?" "Package" $packages`"
;;
xmessage)
packages=`usage | awk '/^ [3a-z]/ {print $1}'`
todo="`xmessage_showmenu "wisotool" "Select a package to install" "Install?" "Package" $packages`"
;;
esac
if test "$todo"x = x
then
exit 0
fi
}
#----- Helpers ------------------------------------------------
# Execute with error checking
try() {
# "VAR=foo try cmd" fails to put VAR in the environment
# with some versions of bash if try is a shell function?!
# Adding this explicit export works around it.
export WINEDLLOVERRIDES
echo Executing "$@"
# Mark executable - needed if running on windows vista
case "$1" in
*.exe) chmod +x "$1" || true
cmd /c "$@"
;;
*)
"$@"
;;
esac
status=$?
if test $status -ne 0
then
die "Note: command '$@' returned status $status. Aborting."
fi
}
try_regedit() {
# on windows, doesn't work without cmd /c
case "$OS" in
"Windows_NT") cmdc="cmd /c";;
*) unset cmdc
esac
try early_wine $cmdc regedit "$@"
}
regedit() {
die oops, bug, please report
}
try_cabextract() {
# Not always installed, but shouldn't be fatal unless it's being used
CABEXTRACT="`which cabextract 2>/dev/null`"
if test ! -x "$CABEXTRACT"
then
die "Cannot find cabextract. Please install it (e.g. 'sudo apt-get install cabextract' or 'sudo yum install cabextract')."
fi
try $CABEXTRACT "$@"
}
cabextract() {
die oops, bug, please report
}
# At some point, make the return value controllable by a global
# commandline option so we can see if we still need the workaround.
workaround_wine_bug()
{
if test "$WINE" = ""
then
echo No need to work around wine bug $1 on windows
return 1
fi
case $1 in
"$WISOTOOL_BLACKLIST")
echo wine bug $1 workaround blacklisted, skipping
return 1
;;
esac
warn Working around wine bug $1
return 0
}
# verify an sha1sum
verify_sha1sum() {
wantsum=$1
file=$2
gotsum=`$SHA1SUM < $file | sed 's/ .*//'`
if [ "$gotsum"x != "$wantsum"x ]
then
die "sha1sum mismatch! Rename $file and try again."
fi
}
# Download a file
# Usage: package url [sha1sum [filename]]
# Caches downloads in wisotoolcache/$package
download() {
if [ "$4"x != ""x ]
then
file="$4"
else
file=`basename "$2"`
fi
cache="$WISOTOOL_CACHE/$1"
mkdir -p "$cache"
if test ! -f "$cache/$file"
then
cd "$cache"
# Mac folks tend to have curl rather than wget
# On Mac, 'which' doesn't return good exit status
# Need to jam in --header "Accept-Encoding: gzip,deflate" else
# redhat.com decompresses liberation-fonts.tar.gz!
if [ -x "`which wget 2>/dev/null`" ]
then
# Use -nd to insulate ourselves from people who set -x in WGETRC
# [*] --retry-connrefused works around the broken sf.net mirroring
# system when downloading corefonts
# [*] --read-timeout is useful on the adobe server that doesn't
# close the connection unless you tell it to (control-C or closing
# the socket)
try wget -O "$file" -nd -c --read-timeout=300 --retry-connrefused --header "Accept-Encoding: gzip,deflate" "$2"
else
# curl doesn't get filename from the location given by the server!
# fortunately, we know it
try curl -L -o "$file" -C - --header "Accept-Encoding: gzip,deflate" "$2"
fi
# Need to decompress .exe's that are compressed, else cygwin fails
# Only affects cygwin, so don't barf if 'file' not installed
FILE=`which file 2>/dev/null`
case $FILE-$file in
/*-*.exe)
case `file $file` in
*gzip*) mv $file $file.gz; gunzip < $file.gz > $file;;
esac
esac
cd "$olddir"
fi
if [ "$3"x != ""x ]
then
verify_sha1sum $3 "$cache/$file"
fi
}
set_winver() {
echo "Setting Windows version to $1"
cat > "$WISOTOOL_TMP"/set-winver.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine]
"Version"="$1"
_EOF_
try_regedit "$WISOTOOL_TMP_WIN"\\set-winver.reg
}
set_app_winver() {
app="$1"
version="$2"
echo "Setting $app to $version mode"
(
echo REGEDIT4
echo ""
echo "[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\$app]"
echo "\"Version\"=\"$version\""
) > "$WISOTOOL_TMP"/set-winver.reg
try_regedit "$WISOTOOL_TMP_WIN"\\set-winver.reg
rm "$WISOTOOL_TMP"/set-winver.reg
}
load_vcdmount()
{
if test "$WINE" != ""
then
return
fi
# Call only on real Windows.
# Sets VCD_DIR and ISO_MOUNT_ROOT
# The only free mount tool I know for Windows Vista is Virtual CloneDrive,
# which can be downloaded at
# http://www.slysoft.com/en/virtual-clonedrive.html
# FIXME: actually install it here
# Locate vcdmount.exe.
VCD_DIR="Elaborate Bytes/VirtualCloneDrive"
if test ! -x "$programfilesdir_unix/$VCD_DIR/vcdmount.exe" && test ! -x "$programfilesdir_x86_unix/$VCD_DIR/vcdmount.exe"
then
warn "Installing Virtual CloneDrive"
download . http://static.slysoft.com/SetupVirtualCloneDrive.exe
# have to use cmd else vista won't let cygwin run .exe's?
chmod +x "$WISOTOOL_CACHE"/SetupVirtualCloneDrive.exe
cd "$WISOTOOL_CACHE"
cmd /c SetupVirtualCloneDrive.exe
cd "$olddir"
fi
if test -x "$programfilesdir_unix/$VCD_DIR/vcdmount.exe"
then
VCD_DIR="$programfilesdir_unix/$VCD_DIR"
elif test -x "$programfilesdir_x86_unix/$VCD_DIR/vcdmount.exe"
then
VCD_DIR="$programfilesdir_x86_unix/$VCD_DIR"
else
die "can't find Virtual CloneDrive?"
fi
# FIXME: Use WMI to locate the drive named
# "ELBY CLONEDRIVE..." using WMI as described in
# http://delphihaven.wordpress.com/2009/07/05/using-wmi-to-get-a-drive-friendly-name/
# For now, you just have to hardcode it for your system :-(
warn "You probably need to edit the script to tell it which drive VirtualCloneDrive picked"
for ISO_MOUNT_LETTER in e f g h
do
ISO_MOUNT_ROOT=/cygdrive/$ISO_MOUNT_LETTER
test -d $ISO_MOUNT_ROOT || break
done
test -d $ISO_MOUNT_ROOT && die "cannot find the VirtualCloneDrive"
}
iso_mount()
{
my_img="$1"
iso_umount
if test "$WINE" = ""
then
load_vcdmount
my_img_win="`$XXXPATH -w $my_img | tr '\012' ' ' | sed 's/ $//'`"
cd "$VCD_DIR"
try vcdmount.exe /l=$letter "$my_img_win"
cd "$olddir"
while ! test -d "$ISO_MOUNT_ROOT"
do
echo "Waiting for mount to finish"
sleep 1
done
else
# Linux
case "$SUDO" in
gksudo)
try $SUDO "mkdir -p $ISO_MOUNT_ROOT"
try $SUDO "mount -o ro,loop,uid=$USERID,unhide $my_img $ISO_MOUNT_ROOT"
;;
*)
try $SUDO mkdir -p $ISO_MOUNT_ROOT
try $SUDO mount -o ro,loop,uid=$USERID,unhide "$my_img" $ISO_MOUNT_ROOT
;;
esac
ISO_MOUNT_LETTER=i
echo "Mounting as drive ${ISO_MOUNT_LETTER}:"
# Gotta provide a symlink to the raw disc, else installers that check volume names will fail
# FIXME: one of these gives a warning frequently, possibly on second run
ln -sf "$my_img" "$WINEPREFIX/dosdevices/${ISO_MOUNT_LETTER}::"
ln -sf "$ISO_MOUNT_ROOT" "$WINEPREFIX/dosdevices/${ISO_MOUNT_LETTER}:"
fi
}
iso_umount()
{
if test "$WINE" = ""
then
# Windows
load_vcdmount
cd "$VCD_DIR"
try vcdmount.exe /u
cd "$olddir"
else
echo "Running $SUDO umount $ISO_MOUNT_ROOT"
case "$SUDO" in
gksudo)
$SUDO "umount $ISO_MOUNT_ROOT"
try $SUDO "rm -rf $ISO_MOUNT_ROOT"
;;
*)
$SUDO umount $ISO_MOUNT_ROOT
try $SUDO rm -rf $ISO_MOUNT_ROOT
;;
esac
rm -f "$WINEPREFIX"/dosdevices/${ISO_MOUNT_LETTER}:
rm -f "$WINEPREFIX"/dosdevices/${ISO_MOUNT_LETTER}::
fi
}
#----------------------------------------------------------------
# Executed if user kills script
cleanup()
{
echo "Caught signal, cleaning up."
case "$pid" in
"") ;;
*) kill $pid ;;
esac
# TODO: merge this with cleanup code at end of script
test "$WISOTOOL_CACHE_SYMLINK" && rm -f "$WISOTOOL_CACHE_SYMLINK"
echo "Done cleanup, quitting."
exit 1
}
load_iso() {
# Detect raw device
dev=/dev/null
for dev in /dev/cdrom /dev/sr0
do
test -b $dev && break
done
test $dev = /dev/null && die "can't find cd/dvd drive"
# Hack for Gentoo - make sure we can read from the drive
test -r $dev || sudo chmod 666 $dev
# Wait for user to insert disc
while ! dd if=$dev of=/dev/null count=1
do
sleep 1
done
# Copy disc to .iso file, display progress every 5 seconds
# Use conv=noerror,sync to replace unreadable blocks with zeroes
dd if=/dev/sr0 of="$WISOTOOL_CACHE"/temp.iso bs=2048 conv=noerror,sync & pid=$!
# Since we're running dd in the background, register a handler to kill it if user presses ^C
trap cleanup 1 2 3 6
while ps -p $pid > /dev/null 2>&1
do
sleep 5
ls -l "$WISOTOOL_CACHE"/temp.iso
done
pid=""
echo "Computing sha1sum..."
# FIXME: can't handle spaces in "$WISOTOOL_CACHE"
sum=`sha1sum "$WISOTOOL_CACHE"/temp.iso | awk '{print $1}'`
echo "Sha1sum of iso is $sum"
mv "$WISOTOOL_CACHE"/temp.iso "$WISOTOOL_CACHE"/$sum.iso
if test "$1" != ""
then
# FIXME: in gui, prompt user for key if load= was chosen?
echo "$1" > "$WISOTOOL_CACHE"/$sum.txt
fi
# Note: if you haven't written the verb for this disc yet,
# the .iso won't be moved to the right directory.
# So when writing a new verb, first run 'sh wisotool load',
# then write just the verblist_add part (including sha1sum), then
# run 'sh wisotool migrate' to move the iso into the right directory,
# and then write the rest of the verb.
migrate_files
eject
}
#----------------------------------------------------------------
ahk_do() {
echo "$@" | sed "s/\$/
/" > "$WISOTOOL_TMP"/tmp.ahk
$WINE "$programfilesdir_unix/AutoHotkey/AutoHotkey.exe" "$WISOTOOL_TMP_WIN"\\tmp.ahk
}
# Put any helper functions needed here:
ahk_helpers() {
cat > helper_tmp << __EOF__
SetControlDelay, -1
WINDOW_CLICK_LOOP(windowname, button, windowtext="", loops=10, wintimeout=10)
{
WinWait, %windowname%, %windowtext%, %wintimeout%
if ErrorLevel
{
exit 1
}
IfWinNotActive, %windowname%, %windowtext%
{
WinActivate, %windowname%, %windowtext%
}
Loop, %loops%
{
IfWinExist, %windowname%, %windowtext%
{
ControlClick, %button%, %windowname%, %windowtext%
}
Else
{
break
}
sleep 1000
}
}
__EOF__
cat helper_tmp | tr ';' '\012' | sed "s/\$/
/" > helpers.ahk
}
#----------------------------------------------------------------
load_autohotkey()
{
test -f "$programfilesdir_unix/AutoHotkey/AutoHotkey.exe" || try sh "$WINETRICKS" -q autohotkey
}
#----------------------------------------------------------------
verblist_init()
{
# Must call this before first call to verblist_add
file_map="case \$1 in "
# Clear menu
rm -f "$WISOTOOL_VERBS"/menutext
}
verblist_finish()
{
# Must follow last call to verblist_add
file_map="$file_map esac"
}
# Add a verb's description to the menu
menu_add() {
verbname=$1
description="$2"
printf " %-16s %s\n" $verbname "$description" >> "$WISOTOOL_VERBS"/menutext
}
# Add a new verb
verblist_add()
{
# Usage: verblist_add verbname "description" file1 file2 ...
verbname=$1
description="$2"
shift
shift
present=''
test $verbname != 'help' && present=' [loaded]'
for file
do
file_map="$file_map $file) echo $verbname;; "
if ! test -f "$WISOTOOL_CACHE"/$verbname/$file
then
present=''
fi
done
menu_add $verbname "$description$present"
}
# Returns true if given verb is in the list
verblist_is_legal_verb()
{
verb=$1
awk '{print $1}' < "$WISOTOOL_VERBS"/menutext > "$WISOTOOL_TMP"/verbs
if grep "^$verb$" "$WISOTOOL_TMP"/verbs > /dev/null
then
return 0
else
return 1
fi
}
# Given a file, output the verb it belongs to
map_file_to_verb()
{
eval $file_map
}
# Output a list of the verbs for which the needed files are in the cache
list_available_verbs()
{
find "$WISOTOOL_CACHE/." -type f | sed 's,.*/,,' > /tmp/wfiles
for file in `cat /tmp/wfiles`
do
map_file_to_verb $file
done | sort -u
}
# Move any/all *.iso still at top level into the proper subdirectory
migrate_files()
{
for file in "$WISOTOOL_CACHE"/*.iso
do
barefile=`basename $file`
verb=`map_file_to_verb $barefile`
if test "$verb" != ""
then
mkdir -p "$WISOTOOL_CACHE"/$verb
movee=`echo $file | sed 's/.iso$/.*/' `
echo Moving $movee to $WISOTOOL_CACHE/$verb/
mv $movee "$WISOTOOL_CACHE"/$verb/
fi
done
}
#----- Verbs ----------------------------------------------------
verblist_init
#----------------------------------------------------------------
verblist_add 3dmark2000 "3DMark2000 (MadOnion.com, 2000) [download]" 3dmark2000_v11_100308.exe
load_3dmark2000() {
load_autohotkey
# http://www.futuremark.com/download/3dmark2000/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/3dmark2000_v11_100308.exe"
then
download $PACKAGE http://www.ocinside.de/download/3dmark2000_v11_100308.exe b0400d59cfd45d8c8893d3d4edc58b6285ee1502
fi
cd "$WISOTOOL_TMP"
mkdir $PACKAGE
cd $PACKAGE
try unzip "$WISOTOOL_CACHE/$PACKAGE"/3dmark2000_v11_100308.exe
ahk_do "
SetTitleMatchMode, 2
run Setup.exe
WinWait Welcome
ControlClick Button1 ; Next
WinWait License
ControlClick Button2 ; Yes
WinWaitClose ahk_class #32770 ; License
WinWait ahk_class #32770 ; Destination
ControlClick Button1 ; Next
WinWaitClose ahk_class #32770 ; Destination
WinWait ahk_class #32770 ; Start
ControlClick Button1 ; Next
WinWait Registration
ControlClick Button1 ; Next
WinWait Complete
ControlClick Button1 ; Unclick View Readme
ControlClick Button4 ; Finish
"
}
#----------------------------------------------------------------
verblist_add 3dmark2001 "3DMark2001 (MadOnion.com, 2001) [download]" 3dmark2000_v11_100308.exe
load_3dmark2001() {
load_autohotkey
# http://www.futuremark.com/download/3dmark2001/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE"/3dmark2001se_330_100308.exe
then
download $PACKAGE http://www.ocinside.de/download/3dmark2001se_330_100308.exe 643bacbcc1615bb4f46d3b045b1b8d78371a6b54
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
SetTitleMatchMode, 2
run 3dmark2001se_330_100308.exe
WinWait ahk_class #32770 ; welcome
MsgBox, 64, , clicking Next on welcome, 1
ControlClick Button2 ; Next
sleep 5000
WinWait ahk_class #32770 ; License
MsgBox, 64, , clicking Next on license, 1
ControlClick Button2 ; Next
WinWait ahk_class #32770 ; Destination
MsgBox, 64, , clicking Next on Destination, 1
ControlClick Button1 ; Next
WinWait ahk_class #32770 ; Start
MsgBox, 64, , clicking Next on Start, 1
ControlClick Button1 ; Next
WinWait,, Registration
ControlClick Button1 ; Next
WinWait,, Complete
ControlClick Button1 ; Unclick View Readme
ControlClick Button4 ; Finish
"
}
#----------------------------------------------------------------
verblist_add 3dmark03 "3D Mark 03 (Futuremark, 2003) [download]" 3DMark03_v360_1901.exe
load_3dmark03() {
load_autohotkey
# http://www.futuremark.com/benchmarks/3dmark03/download/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/3DMark03_v360_1901.exe"
then
download $PACKAGE http://www.bulletproofnerds.com/uploadedfiles/futuremark/3DMark03_v360_1901.exe 46a439101ddbbe3c9563b5e9651cb61b46ce0619
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
warn "Don't use mouse while this installer is running. Sorry..."
# This old installer doesn't seem to be scriptable the usual way, so spray and pray.
ahk_do "
run 3DMark03_v360_1901.exe
Sleep 4000
; Welcome
Send {Enter}
Sleep 2000
; Accept license
Send a
Send {Enter}
Sleep 2000
; Choose Destination
Send {Enter}
Sleep 2000
; Begin install
Send {Enter}
; Wait for install to finish
Sleep 35000
; Purchase later
Send {Tab}
Send {Tab}
Send {Enter}
; Uncheck readme
Send {Space}
Send {Tab}
Send {Tab}
Send {Enter}
"
}
#----------------------------------------------------------------
verblist_add 3dmark05 "3D Mark 05 (Futuremark, 2005) [download]" 3DMark05_v130_1901.exe
load_3dmark05() {
load_autohotkey
# http://www.futuremark.com/download/3dmark05/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/3DMark05_v130_1901.exe"
then
download $PACKAGE http://www.bulletproofnerds.com/uploadedfiles/futuremark/3DMark05_v130_1901.exe 8ad6bc2917e22edf5fc95d1fa96cc82515093fb2
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
run 3DMark05_v130_1901.exe
WinWait ahk_class #32770, Welcome
Send {Enter}
WinWait, ahk_class #32770, License
ControlClick Button1 ; Accept
ControlClick Button4 ; Next
WinWait, ahk_class #32770, Destination
ControlClick Button1 ; Next
WinWait, ahk_class #32770, Install
ControlClick Button1 ; Install
WinWait, ahk_class #32770, Purchase
ControlClick Button4 ; Later
WinWait, ahk_class #32770, Complete
ControlClick Button1 ; Uncheck view readme
ControlClick Button3 ; Finish
"
if workaround_wine_bug 22392
then
warn "You must run the app with the -nosysteminfo option to avoid a crash on startup"
fi
}
#----------------------------------------------------------------
verblist_add 3dmark06 "3D Mark 06 (Futuremark, 2006) [download]" 3DMark06_v120_1901.exe
load_3dmark06() {
load_autohotkey
# http://www.futuremark.com/benchmarks/3dmark06/download/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/3DMark06_v120_1901.exe"
then
download $PACKAGE http://www.bulletproofnerds.com/uploadedfiles/futuremark/3DMark06_v120_1901.exe 2e4a52d5b0f7caebd7b4407dfa9e258ac623b5dd
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
run 3DMark06_v120_1901.exe
WinWait ahk_class #32770, Welcome
Send {Enter}
WinWait, ahk_class #32770, License
ControlClick Button1 ; Accept
ControlClick Button4 ; Next
WinWait, ahk_class #32770, Destination
ControlClick Button1 ; Next
WinWait, ahk_class #32770, Install
ControlClick Button1 ; Install
WinWait ahk_class OpenAL Installer
ControlClick Button2 ; OK
WinWait ahk_class #32770
ControlClick Button1 ; OK
WinWait, ahk_class #32770, Purchase
ControlClick Button4 ; Later
WinWait, ahk_class #32770, Complete
ControlClick Button1 ; Uncheck view readme
ControlClick Button3 ; Finish
"
if workaround_wine_bug 22393
then
# "Demo" button doesn't work without this
sh "$WINETRICKS" -q d3dx9_28 d3dx9_36
fi
if workaround_wine_bug 22392
then
warn "You must run the app with the -nosysteminfo option to avoid a crash on startup"
fi
}
#----------------------------------------------------------------
verblist_add assassinscreed "Assassins Creed (Ubisoft, 2008)" a62112860423b32bf3ea77df6f5fe0b60c772de2.iso
load_assassinscreed() {
load_autohotkey
if workaround_wine_bug 22392
then
# Don't hang at a dialog box when Detection crashes
sh "$WINETRICKS" nocrashdialog
fi
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/a62112860423b32bf3ea77df6f5fe0b60c772de2.iso
ahk_do "
run ${ISO_MOUNT_LETTER}:setup.exe
SetTitleMatchMode, 2
winwait, InstallShield Wizard, Language
; wine bug? - clicking on Next does nothing until you move the mouse over the installer window
;ControlClick Next, InstallShield Wizard
Send {Enter}
winwait, InstallShield Wizard, Welcome
ControlClick Next, InstallShield Wizard
winwait, InstallShield Wizard, License
sleep 500
send a{Enter}
winwait, InstallShield Wizard, begin
sleep 1000
ControlClick &Install, InstallShield Wizard
winwait, Product Registration, register
ControlClick Never, Product Registration
ControlClick Button1, Product Registration
winwait, InstallShield Wizard, inish
send {Enter}
"
iso_umount
}
#----------------------------------------------------------------
# http://appdb.winehq.org/objectManager.php?sClass=version&iId=408
verblist_add baldursgate2 "Baldurs Gate 2 - Shadows of Amn (Bioware, 2000)" \
cc9359dce1a7be6c64bb6f8e6dea6d14d4a5f716.iso \
429872605dad10433c3c581a1c11eba4d0988c46.iso \
a6d18fcd7d16ddafbda7aa028b117566b1e09d2a.iso \
94ed41768949c89a1a6479305f00a9cee1d2dcd5.iso.iso
load_baldursgate2() {
load_autohotkey
# Possible wine bug: cd is still in use, even if wine eject is used. Workaround it by
# copying all the cd's to a directory, and running the installer from there.
# You still need the first CD mounted at the end, however...
if test ! -d "$WISOTOOL_CACHE"/$PACKAGE/tempcd
then
try mkdir -p "$WISOTOOL_CACHE"/$PACKAGE/tempcd
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/cc9359dce1a7be6c64bb6f8e6dea6d14d4a5f716.iso
sleep 5s
try cp -r "$ISO_MOUNT_ROOT"/* "$WISOTOOL_CACHE"/$PACKAGE/tempcd
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/429872605dad10433c3c581a1c11eba4d0988c46.iso
sleep 5s
try cp -r "$ISO_MOUNT_ROOT"/* "$WISOTOOL_CACHE"/$PACKAGE/tempcd
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/a6d18fcd7d16ddafbda7aa028b117566b1e09d2a.iso
sleep 5s
try cp -r "$ISO_MOUNT_ROOT"/* "$WISOTOOL_CACHE"/$PACKAGE/tempcd
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/94ed41768949c89a1a6479305f00a9cee1d2dcd5.iso
sleep 5s
try cp -r "$ISO_MOUNT_ROOT"/* "$WISOTOOL_CACHE"/$PACKAGE/tempcd
fi
# Will perform a full install, so no cd's needed
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/cc9359dce1a7be6c64bb6f8e6dea6d14d4a5f716.iso
ahk_do "
run "$WISOTOOL_CACHE"/$PACKAGE/tempcd/setup.exe
winwait, Baldur's Gate, Welcome to the Baldur's Gate
send {N}
winwait, Baldur's Gate, Please read the following License Agreement
sleep 500
ControlClick, &Yes, Baldur's Gate, Please read the following License Agreement
winwait, Baldur's Gate, Setup will install Baldur's Gate
send {N}
winwait, Baldur's Gate, Click the type of Setup you prefer
send {F}
send {Enter}
winwait, Baldur's Gate, Setup will add program icons
sleep 500
send {Enter}
winwait, Setup Needs The Next Disk
Send {Home}
Send {Shift down}
Send {End}
Send I:{Enter}
winwait, Information
Send {Enter}
Sleep 5000
process, wait, Promo.exe, 5
promopid = %ErrorLevel%
winclose, ahk_pid %promopid%
winwait, Baldur's Gate, Setup has finished installing
Send {Enter}
"
try rm -rf "$WISOTOOL_CACHE"/$PACKAGE/tempcd
}
#----------------------------------------------------------------
verblist_add diablo2 "Diablo II (Blizzard, 2000)" \
e20efb1ea60e58b4a25275a00571aabfe3ab4511.iso \
51e2c630d5dd017e6168a8cf3ee24e39010316d9.iso \
382ea98f270e39855b558b8fac0d609712a54ae8.iso \
e20efb1ea60e58b4a25275a00571aabfe3ab4511.iso
load_diablo2() {
warn "You must have already done 'wisotool load=YOURKEY' on the install disc, and 'wisotool load' on the other two discs."
load_autohotkey
download diablo2 http://ftp.blizzard.com/pub/diablo2/patches/PC/D2Patch_113c.exe c78761bfb06999a9788f25a23a1ed30260ffb8ab
# Force clean-ish install
test -d "$programfilesdir_unix/Diablo II" && rm -rf "$programfilesdir_unix/Diablo II"
# Get user's key
DIABLOIIKEY=`cat "$WISOTOOL_CACHE"/$PACKAGE/e20efb1ea60e58b4a25275a00571aabfe3ab4511.txt | tr -d -`
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/e20efb1ea60e58b4a25275a00571aabfe3ab4511.iso
ahk_do "
run ${ISO_MOUNT_LETTER}:setup.exe
winwait, Diablo II Setup
send {i}
winwait, Choose Installation Size
send {u}
send {Enter}
send {Raw}$USERNAME
send {Tab}{Raw}$DIABLOIIKEY
send {Enter}
winwait, Diablo II - choose install directory
send {Enter}
winwait, Desktop Shortcut
send {N}
winwait, Insert Disc"
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/51e2c630d5dd017e6168a8cf3ee24e39010316d9.iso
# Needed by patch 1.13c to avoid disc swapping
cp "$ISO_MOUNT_ROOT"/d2music.mpq "$programfilesdir_unix/Diablo II/"
ahk_do "
send, {Enter}
Sleep 1000
winwait, Insert Disc"
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/382ea98f270e39855b558b8fac0d609712a54ae8.iso
ahk_do "
send, {Enter}
Sleep 1000
winwait, Insert Disc"
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/e20efb1ea60e58b4a25275a00571aabfe3ab4511.iso
ahk_do "
send, {Enter}
Sleep 1000
winwait, View ReadMe?
ControlClick &No, View ReadMe?
winwait, Register Diablo II Electronically?
send {N}
winwait, Diablo II Setup - Video Test
ControlClick &Cancel, Diablo II Setup - Video Test
winclose, Diablo II Setup"
iso_umount
try "$WINE" "$WISOTOOL_CACHE"/diablo2/D2Patch_113c.exe
ahk_do "
winwait Blizzard Updater v2.72
send {Enter}
winwait Diablo II
ControlClick &Cancel, Diablo II"
# Dagnabbit, the darn updater starts the game after it updates, no matter what I do?
killall "Game.exe"
warn "When starting the game, be patient, wait until the menu appears. The game seems to hang if it looses focus, see bug 14456, you may need to set winecfg to virtual desktop."
}
#----------------------------------------------------------------
verblist_add dragonage "Dragon Age: Origins (Bioware, 2009)" 705a6b06d0dd807bf62b4391d278649d728ebda4.iso
load_dragonage() {
warn "You must have already done 'wisotool load=YOURKEY' on the install disc."
load_autohotkey
# Get user's key
DRAGONAGEKEY=`cat "$WISOTOOL_CACHE"/$PACKAGE/705a6b06d0dd807bf62b4391d278649d728ebda4.txt | tr -d -`
# Installer has a non-fatal crash on exit, so ignore it.
sh "$WINETRICKS" -q nocrashdialog physx vcrun2005
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/705a6b06d0dd807bf62b4391d278649d728ebda4.iso
ahk_do "
Run, ${ISO_MOUNT_LETTER}:Setup.exe
SetTitleMatchMode, 2
winwait, Installer Language
send {Enter}
winwait, Dragon Age: Origins Setup
ControlClick Next, Dragon Age: Origins Setup
winwait, Dragon Age: Origins Setup, End User License
ControlClick Button4, Dragon Age: Origins Setup
ControlClick I agree, Dragon Age: Origins Setup
SetTitleMatchMode, 1
winwait, Dragon Age: Origins, Registration
send $DRAGONAGEKEY
send {Enter}
winwait, Dragon Age: Origins Setup, Install Type
Sleep 1000
send {Enter}
loop 100
{
IfWinExist, Dragon Age: Origins Setup
sleep 60000
}
exit 0
"
iso_umount
if workaround_wine_bug 22383
then
try "$WINETRICKS" -q strictdrawordering=disabled
fi
}
#----------------------------------------------------------------
verblist_add gta_vc "Grand Theft Auto: Vice City (Rockstar, 2003) " \
e98c2d323dd0494989a844442586dc2d48fba8f9.iso \
d31f5c35cc63d804a7ffdb212f550681b97ee5b3.iso
load_gta_vc() {
load_autohotkey
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/e98c2d323dd0494989a844442586dc2d48fba8f9.iso
ahk_do "
SetTitleMatchMode, 2
Run, ${ISO_MOUNT_LETTER}:Setup.exe
winwait, Choose Setup Language
sleep 1000
Send {enter}
winwait, Grand Theft Auto Vice City, Welcome to the InstallShield Wizard
sleep 1000
Send {enter}
winwait, Grand Theft Auto Vice City, License Agreement
sleep 1000
Send !a
send {enter}
winwait, Grand Theft Auto Vice City, Customer Information
sleep 1000
controlclick, edit1
send $USERNAME
send {tab}
send company ; installer won't proceed without something here
send {enter}
winwait, Grand Theft Auto Vice City, Choose Destination Location
sleep 1000
controlclick, Button1
winwait, Grand Theft Auto Vice City, Select Components
sleep 1000
controlclick, Button2
winwait, Grand Theft Auto Vice City, Ready to Install the Program
sleep 1000
send {enter}
winwait, Setup Needs The Next Disk, Please insert disk 2
sleep 1000"
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/d31f5c35cc63d804a7ffdb212f550681b97ee5b3.iso
ahk_do "
sleep 1000
send {enter}
winwait, Grand Theft Auto Vice City, InstallShield Wizard Complete
sleep 1000
send {enter}
"
iso_umount
if workaround_wine_bug 22414
then
try "$WINETRICKS" -q quartz
fi
}
#----------------------------------------------------------------
verblist_add help "How to use this tool"
load_help() {
warn "If the game is not marked with {download} or {loaded} in the menu, you have to insert its disc and give the 'load' command before you can choose that game in the menu. If the game has multiple discs, you have to do this for each disc."
warn "If the game has an install key, you have to enter that when loading the first disc. (You have to do that from the commandline, e.g. sh wisotool load=XXXX-YYYY-ZZZZ.)"
}
#----------------------------------------------------------------
verblist_add morrowind "The Elder Scrolls III: Morrowind (Bethesda, 2002)" \
c8368ed30d3f3fcd7fccf8bffcfcdf0a6d4cb68b.iso
load_morrowind_goty() {
cd $WISOTOOL_TMP
# FIXME: Untested on Windows!
# FIXME: Only supports the main installer, and the construction set (which follows automatically)
# eventually should support the expansions as well
load_autohotkey
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/c8368ed30d3f3fcd7fccf8bffcfcdf0a6d4cb68b.iso
ahk_helpers
cat > morrowind.tmp << __EOF__
#include helpers.ahk
Run, ${ISO_MOUNT_LETTER}:Setup.exe
WINDOW_CLICK_LOOP("The Elder Scrolls III: Morrowind Setup", "&Yes", "The Elder Scrolls III: Morrowind (License Agreement)", 10, 100)
WINDOW_CLICK_LOOP("The Elder Scrolls III: Morrowind Setup", "&Next >", "Please read the following important information.", 10, 100)
WINDOW_CLICK_LOOP("The Elder Scrolls III: Morrowind Setup", "&Next >", "Setup will install Morrowind in the following folder.", 10, 100)
WINDOW_CLICK_LOOP("The Elder Scrolls III: Morrowind Setup", "&Next >", "Setup has enough information to start copying the program files.", 10, 100)
; Then launched construction set setup
WINDOW_CLICK_LOOP("The Elder Scrolls Construction Set Setup", "&Yes", "The Elder Scrolls Construction Set (License Agreement)", 10, 500)
; No confirm screen? (FIXME: verify on windows)
WINDOW_CLICK_LOOP("The Elder Scrolls Construction Set Setup", "&Next >", "Setup has enough information to start copying the program files", 10, 100)
WINDOW_CLICK_LOOP("The Elder Scrolls Construction Set Setup", "Finish", "Setup has finished installing TES Construction Set on your computer.", 10, 100)
; Exits the Construction set setup on its own, and goes back to main installer
; The text box is split into two lines separately, not using word wrap, hence the weird sentence..
WINDOW_CLICK_LOOP("Question", "&No", "Would you like to register Morrowind online now? Make sure", 10, 100)
; Sometimes finicky here, short sleep here works around it
Sleep 10000
WINDOW_CLICK_LOOP("The Elder Scrolls III: Morrowind Setup", "Finish", "Setup has finished installing Morrowind on your computer.", 10, 100)
WINDOW_CLICK_LOOP("Information", "&OK", "You have installed Windows XP, which includes DirectX 8.1", 10, 100)
exit 0
__EOF__
sed -e 's/$/\r/' morrowind.tmp > morrowind.ahk
try $WINE "$programfilesdir_unix/AutoHotkey/AutoHotkey.exe" morrowind.ahk
sleep 30s
iso_umount
cd $olddir
}
#----------------------------------------------------------------
verblist_add pcmark04 "PC Mark 04 (Futuremark, 2004) [download]" PCMark04_v130_installer.exe
load_pcmark04() {
load_autohotkey
# http://www.futuremark.com/download/pcmark04/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/PCMark04_v130_installer.exe"
then
die "Sorry, you have to download PCMark04_v130_installer.exe yourself and put it in $WISOTOOL_CACHE/$PACKAGE/PCMark04_v130_installer.exe"
fi
warn "Please don't use mouse while this installer is running. Sorry..."
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
SetTitleMatchMode, 2
run PCMark04_v130_installer.exe
; Skip past the two windows warning about WMP9 etc.
WinWait, Information
Send {Enter}
WinWaitClose, Information
WinWait, Information
Send {Enter}
WinWait ahk_class #32770, Welcome
Send {Enter}
WinWait, ahk_class #32770, License
Send a ; Accept
Send {Enter} ; Next
Sleep 3000 ; Wait for Destination window
Send {Enter}
Sleep 3000 ; Wait for Install window
Send {Enter}
; Wait for install to finish
WinWait, PCMark04, Registration
; Purchase later
; This window won't activate any other way!
MsgBox, 32, , Preparing your dungeon. Why not enjoy a delicious slime mold while you wait?, 1
Send {Enter}
Sleep 3000
; Uncheck readme
Send {Space}
Send {Tab}
Send {Tab}
Send {Enter}
"
if workaround_wine_bug 22402
then
warn "You may need to apply the patch from bug 22402 to avoid a crash in the tumbling blocks test."
fi
}
#----------------------------------------------------------------
verblist_add pcmark05 "PC Mark 05 (Futuremark, 2005) [download]" PCMark05_v130_1901.exe
load_pcmark05() {
load_autohotkey
# http://www.futuremark.com/download/pcmark05/
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/PCMark05_v120_1901.exe"
then
download $PACKAGE http://www.bulletproofnerds.com/uploadedfiles/futuremark/PCMark05_v120_1901.exe 8636fce0e4023cd59bcf7f3e1a027e233ee81193
fi
warn "Don't use mouse while this installer is running. Sorry..."
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
SetTitleMatchMode, 2
run PCMark05_v120_1901.exe
; Skip past the two windows warning about WMP10 etc.
WinWait, Information
Send {Enter}
WinWaitClose, Information
WinWait, Information
Send {Enter}
WinWait ahk_class #32770, Welcome
Send {Enter}
WinWait, ahk_class #32770, License
Send a ; Accept
Send {Enter} ; Next
Sleep 3000 ; Wait for 2nd Welcome window
Send {Enter}
Sleep 3000 ; Wait for Destination window
Send {Enter}
Sleep 3000 ; Wait for Install window
Send {Enter}
; Wait for install to finish
WinWait, PCMark05, Registration
; Purchase later
; This window won't activate any other way!
MsgBox, 32, , Preparing your dungeon. Why not enjoy a delicious slime mold while you wait?, 1
Send {Enter}
Sleep 2000
; Uncheck readme
Send {Space}
Send {Tab}
Send {Tab}
Send {Enter}
"
}
#----------------------------------------------------------------
# Not finished
#verblist_add passmark7 "Performance Test 7 (Passmark, 2010) [download]" petst.exe
load_passmark7() {
load_autohotkey
# http://www.passmark.com/download/pt_download.htm
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/petst.exe"
then
download $PACKAGE http://www.passmark.com/ftp/petst.exe 6d9db9c1bc53452cf7a2d3ad07a1195218095f8f
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
run petst.exe
"
warn "TODO: finish."
}
#----------------------------------------------------------------
verblist_add plantsvszombies "Plants vs. Zombies (PopCap Games, 2009) [download]" PlantsVsZombiesSetup.exe
load_plantsvszombies() {
load_autohotkey
if ! test -f "$WISOTOOL_CACHE/plantsvszombies/PlantsVsZombiesSetup.exe"
then
download plantsvszombies "http://downloads.popcap.com/www/popcap_downloads/PlantsVsZombiesSetup.exe" fcae7b8c63d9a5b5f6ed783232bc5f612fd5c963
fi
cd "$WISOTOOL_CACHE/plantsvszombies"
ahk_do "
run PlantsVsZombiesSetup.exe
winwait, Plants vs. Zombies Installer
send {Enter}
winwait, Plants vs. Zombies License Agreement
ControlClick Button1
winwait, Plants vs. Zombies Installation Complete!
send {Space}{Enter}
ControlClick, x309 y278, Plants vs. Zombies Installation Complete!,,,, Pos
"
}
#----------------------------------------------------------------
verblist_add re5bench "Resident Evil 5 Benchmark (Capcom, 2009) [download]" nzd_ResidentEvil5_Benchmark.exe
load_re5bench() {
load_autohotkey
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/nzd_ResidentEvil5_Benchmark.exe"
then
download $PACKAGE http://download.nvidia.com/downloads/nZone/demos/nzd_ResidentEvil5_Benchmark.exe 041492b9af138f67e7acf97fbd8e926dda59ab12
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
run nzd_ResidentEvil5_Benchmark.exe
WinWait ahk_class MsiDialogCloseClass
Sleep 1000
Send {Enter}
; ControlClick Button1 ; Next. Doesn't work?
WinWait ahk_class MsiDialogCloseClass, License
ControlClick Button3 ; Accept
ControlClick Button5 ; Next
WinWait ahk_class MsiDialogCloseClass, Destination
ControlClick Button1 ; Next
WinWait ahk_class MsiDialogCloseClass, Ready
ControlClick Button1 ; Install
WinWait ahk_class MsiDialogCloseClass, Completed
ControlClick Button3 ; Uncheck Launch
ControlClick Button1 ; Finish
"
if workaround_wine_bug 21939
then
try sh "$WINETRICKS" -q wmp9
fi
}
#----------------------------------------------------------------
verblist_add quake3 "Quake 3 (ID Software, 1999)" 4d2102a8df3c1fea237f2a6a141346c436614d5e.iso
load_quake3() {
load_autohotkey
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/4d2102a8df3c1fea237f2a6a141346c436614d5e.iso
ahk_do "
Run ${ISO_MOUNT_LETTER}:Setup.exe
WinWait, Quake III Arena
ControlClick, x532 y206 ; Click Install
WinWait, Welcome
ControlClick, Button1 ; Click Next
WinWait, Software License Agreement
ControlClick, Button2 ; Click Yes
WinWait, Setup Type
ControlClick, Button2 ; Click Next
WinWait, Choose Destination Location
ControlClick, Button1 ; Click Next
WinWait, Select Program Folder
ControlClick, Button2 ; Click Next
WinWait, Question, Would you like to place a Shortcut on your Desktop?
ControlClick, Button7 ; Click No
WinWait, Setup Complete
ControlClick, Button3 ; Click No I will restart my computer later.
ControlClick, Button5 ; Click Finish
"
iso_umount
}
#----------------------------------------------------------------
verblist_add sims3 "The Sims 3 (EA, 2009)" 8a82a067f3bb8f68d034a06954e9a16ea381958a.iso
load_sims3() {
load_autohotkey
if workaround_wine_bug 22350
then
try sh "$WINETRICKS" -q dotnet20
fi
if workaround_wine_bug 21517
then
try sh "$WINETRICKS" -q d3dx9
fi
# Get user's key
KEY=`cat "$WISOTOOL_CACHE"/$PACKAGE/8a82a067f3bb8f68d034a06954e9a16ea381958a.txt | tr -d -`
echo KEY is $KEY
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/8a82a067f3bb8f68d034a06954e9a16ea381958a.iso
# Default lang, USA, accept defaults, uncheck EA dl mgr, uncheck readme
ahk_do "
run ${ISO_MOUNT_LETTER}:Sims3Setup.exe
winwait, Choose Setup Language
send {Enter}
SetTitleMatchMode, 2
winwait, - InstallShield Wizard
sleep 1000
ControlClick &Next >, - InstallShield Wizard
sleep 1000
send uuuuuu{Tab}{Tab}{Enter}
sleep 1000
send a{Enter}
sleep 1000
send {Raw}$KEY
send {Enter}
winwait, - InstallShield Wizard, Setup Type
send {Enter}
winwait, - InstallShield Wizard, Click Install to begin
send {Enter}
winwait, - InstallShield Wizard, EA Download Manager
ControlClick Yes, - InstallShield Wizard
send {Enter}
winwait, - InstallShield Wizard, Complete
ControlClick View the readme file, - InstallShield Wizard
ControlClick Finish, - InstallShield Wizard
"
iso_umount
cd "$programfilesdir_unix/Electronic Arts/The Sims 3/Game/Bin"
echo "Sims3 version info:"
cat skuversion.txt
download sims3 http://na.llnet.eadownloads.ea.com/u/f/sims/sims3/patches/Sims3_1.6.6.002001_from_1.0.631.00001.exe 02703d296417750005326ff0d37295fa434a3f49
cd "$WISOTOOL_CACHE"/sims3
ahk_do "
run Sims3_1.6.6.002001_from_1.0.631.00001.exe
SetTitleMatchMode, 2
winwait, - InstallShield Wizard, Complete
ControlClick Finish, - InstallShield Wizard
"
# FIXME: apply next patch, too
}
#----------------------------------------------------------------
verblist_add starcraft "Starcraft Battle Chest (Blizzard, 1998)" 8d6cc11bc76b8af22868a95e17e0282277e9c53c.iso 966bae1f2e2035e066139e78137e623c92838254.iso
load_starcraft() {
warn "You must have already done 'wisotool load=YOURKEY' on the install disc, and 'wisotool load' on the other disc."
load_autohotkey
# Force clean-ish install
test -d "$programfilesdir_unix/StarCraft" && rm -rf "$programfilesdir_unix/StarCraft"
# Get user's key
KEY=`cat "$WISOTOOL_CACHE"/$PACKAGE/8d6cc11bc76b8af22868a95e17e0282277e9c53c.txt`
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/8d6cc11bc76b8af22868a95e17e0282277e9c53c.iso
ahk_do "
run ${ISO_MOUNT_LETTER}:StarCraft (Windows).exe
winwait, StarCraft - Brood War
send {i}
winwait, End User License Agreement
Sleep 2000
send {a}
winwait, CD-Key
send $USERNAME
send {Tab}$KEY
send {Enter}
winwait, Installation Destination Directory
send {Enter}
winwait,,Please insert"
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/966bae1f2e2035e066139e78137e623c92838254.iso
ahk_do "
send, {Enter}
SetTitleMatchMode, 2
winwait, - StarCraft
winwaitclose, - StarCraft
Sleep 2000
send {e}"
iso_umount
# FIXME: apply patch, follow instructions in http://us.blizzard.com/support/article.xml?articleId=21150
}
#----------------------------------------------------------------
verblist_add starcraft2 "Starcraft II beta (Blizzard, 2010)"
load_starcraft2() {
load_autohotkey
if test -d "$programfilesdir_unix/StarCraft II Beta"
then
warn "$PACKAGE already installed, skipping."
return 0
fi
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/StarCraft II Beta enUS 13891 Installer/Installer.exe"
then
die "You must have run the downloader and told it to save in $WISOTOOL_CACHE/$PACKAGE"
fi
if ! test -f "$WINDIR"/system32/plugin.ocx && workaround_wine_bug 22089
then
try sh "$WINETRICKS" -q ie6
fi
cd "$WISOTOOL_CACHE/$PACKAGE/StarCraft II Beta enUS 13891 Installer"
ahk_do "
SetTitleMatchMode, 2
run Installer.exe
winwait, StarCraft II Beta Installer
ControlClick, x300 y200
winwait, End User License Agreement
winactivate
MouseMove, 300, 300
Click WheelDown, 70
Sleep, 1000
ControlClick, Agree
winwait, Installation Destination Directory
send {Enter}
winwait, StarCraft II v, update was successful
winclose
"
}
#----------------------------------------------------------------
verblist_add stfu "Starwars: The Force Unleashed (Aspyr, 2009)" 0d0f4e826c3a04542a68d7bcc971f4df7526965b.iso 5d6e2eb1b08b9d4a71b2390b385c3048ec91f3df.iso
load_stfu() {
load_autohotkey
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/0d0f4e826c3a04542a68d7bcc971f4df7526965b.iso
warn "Starting installer. This can be very slow, please be patient."
ahk_do "
run ${ISO_MOUNT_LETTER}:setup.exe
SetTitleMatchMode, 2
winwait, Select Setup Language
send {Enter}
winwait, Setup, Welcome
send {Enter}
winwait, Setup, License
sleep 500
send {Tab}a{Space}{Enter}
winwait, Setup, Destination
send {Enter}
winwait, Setup, Menu
send {Enter}
winwait, Setup, Tasks
send {Space}{Enter}
winwait, Setup, begin
sleep 1000
ControlClick &Install, Setup
winwait, Setup Needs the Next Disk
"
iso_umount
iso_mount "$WISOTOOL_CACHE"/$PACKAGE/5d6e2eb1b08b9d4a71b2390b385c3048ec91f3df.iso
ahk_do "
SetTitleMatchMode, 2
send {Enter}
winwait, Setup, Completing
send {Space}{Tab} ; don't show readme
send {Space}{Tab} ; don't start app
send {Enter}
"
iso_umount
# Patch to 1.2
# FIXME: add a commandline option to disable patching in general
# URL from http://www.lucasfiles.com/index.php?s=&action=download&id=1537&agree=true
# See also http://www.forceunleashed.net/news/force-unleashed-patch-1-2/
download stfu http://xfer.lfnetwork.com/lucasfiles.com/downloads/1537/SWTFU_PC_EF_1.2_Update.exe cfd8043c4b86f4dc0ff0acd4c108b11c4b76e716
cd "$WISOTOOL_CACHE/stfu"
ahk_do "
run SWTFU_PC_EF_1.2_Update.exe
SetTitleMatchMode, 2
winwait, Patch
send {Enter}
winwait, Patch, Finish
send {Enter}
"
}
#----------------------------------------------------------------
verblist_add unigine_heaven "Unigen Heaven 2 Benchmark (Unigen, 2010) [download]" Unigine_Heaven-2.0.msi 6a0bd499ae8ed8d73d74d964d3c4312a0a40b7e6
load_unigine_heaven() {
load_autohotkey
if ! test -f "$WISOTOOL_CACHE/$PACKAGE/Unigine_Heaven-2.0.msi"
then
warn "This download is slow, you may want to do a manual download from http://downloads.guru3d.com/Unigine-Heaven-DirectX-11-benchmark-2.0-download-2414.html instead"
#download $PACKAGE http://www.techpowerup.com/downloads/1775e/Unigine_Heaven-2.0.msi 6a0bd499ae8ed8d73d74d964d3c4312a0a40b7e6
download $PACKAGE http://unigine.com/download/files/Unigine_Heaven-2.0.msi 6a0bd499ae8ed8d73d74d964d3c4312a0a40b7e6
fi
cd "$WISOTOOL_CACHE/$PACKAGE"
ahk_do "
run msiexec /i Unigine_Heaven-2.0.msi
WinWait ahk_class MsiDialogCloseClass
Sleep 1000
Send {Enter}
WinWait ahk_class MsiDialogCloseClass, License
ControlClick Button1 ; Accept
ControlClick Button3 ; Accept
WinWait ahk_class MsiDialogCloseClass, Choose
ControlClick Button1 ; Typical
WinWait ahk_class MsiDialogCloseClass, Ready
ControlClick Button2 ; Install
WinWait ahk_class OpenAL Installer
ControlClick Button2 ; OK
WinWait ahk_class #32770
ControlClick Button1 ; OK
WinWait ahk_class MsiDialogCloseClass, Completed
ControlClick Button1 ; Finish
"
}
#----------------------------------------------------------------
verblist_add wog "World of Goo demo (2D Boy, 2008) [download]" WorldOfGooDemo.1.0.exe
load_wog() {
load_autohotkey
if ! test -f "$WISOTOOL_CACHE/wog/WorldOfGooDemo.1.0.exe"
then
# Get temporary download location
download wog "http://www.worldofgoo.com/dl2.php?lk=demo&filename=WorldOfGooDemo.1.0.exe"
URL=`cat "$WISOTOOL_CACHE/wog/dl2.php?lk=demo&filename=WorldOfGooDemo.1.0.exe" |
grep WorldOfGooDemo.1.0.exe | sed 's,.*http,http,;s,".*,,'`
rm "$WISOTOOL_CACHE/wog/dl2.php?lk=demo&filename=WorldOfGooDemo.1.0.exe"
download wog "$URL" e61d8253b9fe0663cb3c69018bb3d2ec6152d488
fi
cd "$WISOTOOL_CACHE/wog"
ahk_do "
run WorldOfGooDemo.1.0.exe
winwait, World of Goo Setup, License Agreement
send {Enter}
winwait, World of Goo Setup, Choose Components
send {Enter}
winwait, World of Goo Setup, Choose Install Location
send {Enter}
winwait, World of Goo Setup, Thank you
ControlClick, Make me dirty right now, World of Goo Setup, Thank you
send {Enter}
"
}
#----------------------------------------------------------------
print_version() {
echo "$VERSION"
}
#--------- Main program -----------------------------------------
olddir=`pwd`
srcdir=`dirname $0`
srcdir=`cd $srcdir; /bin/pwd`
# Load external verbs. Filenames may not contain spaces.
if cd "$WISOTOOL_VERBS"
then
for file in `find . -type f -name '*.verb' 2>/dev/null`
do
. $file
done
fi
cd "$olddir"
verblist_finish
# On Solaris, choose more modern commands (needed for id -u).
case `uname -s` in
SunOS) PATH="/usr/xpg6/bin:/usr/xpg4/bin:$PATH"
;;
esac
case "$1" in
-V|--version)
echo "wisotool version $VERSION. (C) 2007-2010 Dan Kegel et al. LGPL."
exit 0
;;
esac
detect_menu
detect_sudo
GUI=0
case x"$1" in
x) GUI=1 ;;
x-h|x--help|xhelp) usage ; exit 1 ;;
esac
case "$OS" in
"Windows_NT")
;;
*)
# Prevent running with wrong user id.
# It's bad to create files as the wrong user!
die_if_user_not_dirowner "$WINEPREFIX"
die_if_user_not_dirowner "$WISOTOOL_CACHE"
if [ ! -x "`which "$WINE" 2>/dev/null`" ]
then
die "Cannot find wine ($WINE)"
fi
# Create wineprefix if not already there
test -d "$WINEPREFIX" || WINEDLLOVERRIDES=mshtml= $WINE cmd /c echo yes > /dev/null 2>&1
;;
esac
mkdir -p "$WISOTOOL_TMP"
case $GUI in
1) showmenu ; set $todo ;;
esac
mkdir -p "$WISOTOOL_CACHE"
WINETRICKS="$srcdir/winetricks"
if ! test -f "$WINETRICKS"
then
WINETRICKS="$WISOTOOL_CACHE/winetricks"
wget -o "$WINETRICKS" http://kegel.com/wine/winetricks
fi
# The folder-name is localized!
programfilesdir_win="`unset WINEDEBUG; WINEDLLOVERRIDES=mshtml= $WINE cmd.exe /c echo "%ProgramFiles%" | tr -d '\015'`"
test x"$programfilesdir_win" != x || die "$WINE cmd.exe /c echo '%ProgramFiles%' returned empty string"
programfilesdir_unix="`unset WINEDEBUG; $XXXPATH -u "$programfilesdir_win" | tr -d '\015' `"
test x"$programfilesdir_unix" != x || die "winepath -u $programfilesdir_win returned empty string"
wisotool_tmp_win="`$XXXPATH -w "$WISOTOOL_TMP"`"
# 64 bit windows has a second directory for program files
programfilesdir_x86_win="${programfilesdir_win} (x86)"
programfilesdir_x86_unix="${programfilesdir_unix} (x86)"
if ! test -d "$programfilesdir_x86_unix"
then
programfilesdir_x86_win="${programfilesdir_win}"
programfilesdir_x86_unix="${programfilesdir_unix}"
fi
export programfilesdir_x86_unix
# (Fixme: get fonts path from SHGetFolderPath
# See also http://blogs.msdn.com/oldnewthing/archive/2003/11/03/55532.aspx)
#
# Did the user rename Fonts to fonts?
if test ! -d "$WINDIR"/Fonts && test -d "$WINDIR"/fonts
then
winefontsdir="$WINDIR"/fonts
else
winefontsdir="$WINDIR"/Fonts
fi
# Mac folks tend to not have sha1sum, but we can make do with openssl
if [ -x "`which sha1sum 2>/dev/null`" ]
then
SHA1SUM="sha1sum"
elif [ -x "`which openssl 2>/dev/null`" ]
then
SHA1SUM="openssl dgst -sha1"
else
die "No sha1sum utility available."
fi
if [ ! -x "`which unzip 2>/dev/null`" ]
then
die "Cannot find unzip. Please install it (e.g. 'sudo apt-get install unzip' or 'sudo yum install unzip')."
fi
while test "$1" != ""
do
PACKAGE=$1
case $1 in
-q) WISOTOOL_QUIET="/q"
WINEDEBUG=${WINEDEBUG:-"fixme-all"}
export WINEDEBUG
;;
-v) set -x;;
ls) list_available_verbs;;
load) load_iso;;
load=*) key="`echo $1 | sed 's/load=//'`"; load_iso "$key";;
migrate) migrate_files;;
version) print_version;;
*) if verblist_is_legal_verb $1
then
load_$1
else
echo Unknown arg $1; usage ; exit 1;
fi
;;
esac
# Provide a bit of feedback
test "$WISOTOOL_QUIET" = "" && case $1 in
-q) echo Setting quiet mode;;
-v) echo Setting verbose mode;;
*) #echo "$1 done" ;;
esac
shift
# User-specific postinstall hook.
# Source it so the script can call download() if needed.
if [ -f "$WISOTOOL_CACHE"/$PACKAGE/$PACKAGE-postinstall.sh ]
then
( . "$WISOTOOL_CACHE"/$PACKAGE/$PACKAGE-postinstall.sh )
fi
# cleanup
rm -rf "$WISOTOOL_TMP"/* "$WISOTOOL_TMP/tmp.ahk"
done
test "$WISOTOOL_CACHE_SYMLINK" && rm -f "$WISOTOOL_CACHE_SYMLINK"
# remove the temp directory
rm -rf "$WISOTOOL_TMP"