Category Archives: Gaming

Wrote my first install script for PlayOnLinux

I like to play games once in a while, but I don’t have Windows.
So like many other Linux gamers, I use Wine, but I like to have an overlay to keep things neat and organized, and thus I use PlayOnLinux.
PlayOnLinux comes with installation scripts so that the games will work right away without me having to fiddle around with a bunch of hacks to get it working, but as it turns out, the game I wanted to play (Civilization IV: Complete Edition) didn’t have an installation script that worked, so I decided to write my own and try to get it approved by the people at PlayOnLinux, and thus added to the software list of approved and signed scripts 🙂

It hasn’t been approved yet, but it’s getting there.
This is the script so far (fully working in this state).

Go to the link below for the newest development info

Another interesting thing to note, is that I am hosting the Civ IV patches myself that the script is downloading and installing, since I want to make sure that it’s always being hosted on a fast connection for everyone to use.

If anyone else need the patches for use outside of this script, you can download them below

Civilization IV Patch 1.74
Civilization IV – Warlords Patch 2.13
Civilization IV – Beyond The Sword Patch 3.19

[code lang=”bash”]
# Date : (2013-06-26)
# Last revision : (2013-07-23)
# Wine version used : 1.4.1
# Distribution used to test : xUbuntu 13.10
# Author : Jimmy Ramsmark
# Licence : GPLv3
# Depend : msxml3, d3dx9

# This script was tested using the DVD version of `Civilization IV: Complete’
# version 1.74, bought in the Sweden in 2011.

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="Civilization IV: Complete Edition"
TITLECIV="Civilization IV"
TITLEBTS="Civilization IV – Beyond The Sword"
TITLEW="Civilization IV – Warlords"
TITLECOL="Civilization IV – Colonization"
AUTHOR="Jimmy Ramsmark"

POL_GetSetupImages "$PREFIX/top.jpg" "$PREFIX/left.jpg" "$TITLE"

POL_SetupWindow_SetID 1779

POL_SetupWindow_presentation "$TITLE" "Firaxis Games" "" "$AUTHOR" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"

POL_SetupWindow_InstallMethod "DVD,STEAM"

if [ "$INSTALL_METHOD" == "DVD" ]; then
# Let the user select a DVD

# Check if this DVD is the Civilization IV DVD
POL_SetupWindow_check_cdrom "Autorun/Civ4Installer.ico"

# Set and install the correct Wine version

# Install DirectX9
POL_Call POL_Install_d3dx9

if [ "$INSTALL_METHOD" == "DVD" ]; then
# Run installer
POL_Wine_WaitBefore "$TITLECIV"
POL_Wine start /unix "$CDROM/setup.exe"
POL_Wine_WaitExit "$TITLECIV"

#Patch Civilization IV: Beyond the sword to 3.19
cd "$POL_USER_ROOT/tmp"
POL_Download "" "c45f6e028f51db2386120a5861eabe7c"
POL_Wine_WaitBefore "$TITLECIV"
POL_Wine Civ4BeyondTheSwordPatch3.19.exe
POL_Wine_WaitExit "$TITLECIV"
POL_Call POL_Install_steam

# Start steam, update it, and install the games
POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_CIV
POL_SetupWindow_message "$(eval_gettext ‘Steam is about to perform an update.\nAfter Steam finishes updating and shows you to the login interface, login and then let $TITLE install.\n\nWhen the installation is finished, press next (Do not close Steam)’)" "$TITLECIV"

POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_W
POL_SetupWindow_message "$(eval_gettext ‘Steam is installing $TITLEW, press next when the installation is finished’)" "$TITLECIV"

POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_BTS
POL_SetupWindow_message "$(eval_gettext ‘Steam is installing $TITLEBTS, press next when the installation is finished’)" "$TITLECIV"

POL_Wine start /unix "Steam.exe" steam://install/$STEAM_ID_COL
POL_SetupWindow_message "$(eval_gettext ‘Steam is installing $TITLECOL, please quit Steam properly when the installation is finished (make sure Steam is not still in the traybar) and then press next so that the installation script can continue.’)" "$TITLECIV"
POL_Wine_WaitExit "$TITLECIV"

# Install msxml3.msi
# Override for msxml3 is needed before the install
# The msvcr71 one is just there so that mods will work later on

POL_Wine_OverrideDLL "native" "msxml3"
POL_Wine_OverrideDLL "builtin" "msvcr71"
POL_Call POL_Install_msxml3

#Create shortcuts
if [ "$INSTALL_METHOD" == "STEAM" ]; then
POL_Shortcut "Steam.exe" "$TITLECIV" "$TITLECIV.png" "-applaunch $STEAM_ID_CIV" "Game;StrategyGame;"
POL_Shortcut "Steam.exe" "$TITLEBTS" "$TITLEBTS.png" "-applaunch $STEAM_ID_BTS" "Game;StrategyGame;"
POL_Shortcut "Steam.exe" "$TITLEW" "$TITLEW.png" "-applaunch $STEAM_ID_W" "Game;StrategyGame;"
POL_Shortcut "Steam.exe" "$TITLECOL" "$TITLECOL.png" "-applaunch $STEAM_ID_COL" "Game;StrategyGame;"
POL_Shortcut "Steam.exe" "Steam – Civ IV" "" "" "Game;"
POL_Shortcut "Civilization4.exe" "$TITLECIV" "$TITLECIV.png" "" "Game;StrategyGame;"
POL_Shortcut "Civ4BeyondSword.exe" "$TITLEBTS" "$TITLEBTS.png" "" "Game;StrategyGame;"
POL_Shortcut "Civ4Warlords.exe" "$TITLEW" "$TITLEW.png" "" "Game;StrategyGame;"

POL_SetupWindow_message "$(eval_gettext ‘Installation finished\n\nThe game might crash on the first attempt, but no worries, just try one more time.’)" "$TITLECIV"
exit 0