Seeing SnakeMan ask about installers in another thread, made me realize this is something we should probably all be comparing notes on, and learning from each other about.
I've used the NSIS installer system for a couple different... uh... "projects" now and really like it. The scripting is relatively easy for a non-coder (like me) to figure out, but is still powerful and flexible. It has a strong user community and good open-source support. It also is "portable" in that there is a version I can run from almost any PC on my USB memory stick.


I would be more than happy to share any installer scripts I've done with anyone else who is interested.
A theater isn't much good if others can't easily install it,


========================
Edit: my current NSIS theater template - 20 Apr 07
Code: Select all
; Script generated by the HM NIS Edit Script Wizard.
/*
Theater Installer template
@@Version history here
1a - Proof of concept
*/
; HM NIS Edit Wizard helper defines
; these define some variables I use in some later statements
!define TNAME "Bering"
!define FRIENDLYNAME "Bering Theater Installer"
!define VER "0.0.0.1" ; this has to be #.#.#.#
!define TDIRECTORY "Theater\${TNAME}"
!define DEVDIRECTORY "F:\FF4Installers\Theaters\${TNAME}" ;@@
!define LICENSEFILE "${DEVDIRECTORY}\license.txt"
;variables for previous installs to delete
!define PrevDir01 "theaters\${TNAME}"
!define PrevDir02 "DesertStormTheaterAddon"
; then further defines for however many you want to delete
; define other variables to free up generic ones
var F4root
var ErrCode
var F4ver
var F4subver
;=== Program Details
Name "${FRIENDLYNAME}"
OutFile "${TNAME}_${VER}.exe"
Caption "${FRIENDLYNAME}"
VIProductVersion "${VER}"
VIAddVersionKey ProductName "${FRIENDLYNAME}"
VIAddVersionKey Comments "Installs the Bering theater."
;VIAddVersionKey CompanyName "Bering Theaters, Inc."
;VIAddVersionKey LegalCopyright "Trexian Tools"
VIAddVersionKey FileDescription "${FRIENDLYNAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${FRIENDLYNAME}"
VIAddVersionKey LegalTrademarks "Bering and Bering Straits are Trademarks of Bering Trademark Holding Company"
;VIAddVersionKey PrivateBuild ""
;VIAddVersionKey SpecialBuild ""
;=== Runtime Switches
CRCCheck On
;SilentInstall Silent
AutoCloseWindow True
SetCompressor lzma
BrandingText "Grinning and Bering it."
;=== Includes - this will include the necessary dlls and functions that I use in the installer
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "Registry.nsh"
!include "WinMessages.nsh"
!include "TextFunc.nsh"
!include "TextReplace.nsh"
!include "Sections.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${DEVDIRECTORY}\${TNAME}.ico"
!define MUI_INSTALLCOLORS /windows
; Welcome page
;!define MUI_WELCOMEFINISHPAGE_BITMAP "${DEVDIRECTORY}\leftgraphic.bmp"
!define MUI_WELCOMEPAGE_TITLE "${FRIENDLYNAME} ${VER} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "Setup will install ${FRIENDLYNAME} ${VER} into your Falcon installation."
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "${LICENSEFILE}"
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page - this is the last page people see
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_TITLE "${FRIENDLYNAME} ${VER} Installation completed."
!define MUI_FINISHPAGE_TEXT "Click 'Finish' to close this wizard."
!insertmacro MUI_PAGE_FINISH
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Section "Installer" SEC01
; F4registry check -
${registry::KeyExists} "HKLM\Software\MicroProse\Falcon\4.0" $0
${registry::KeyExists} "HKLM\Software\Lead Pursuit\Battlefield Operations\Falcon" $1
IntCmp $0 0 F4Exists
IntCmp $1 0 AFInstall
StrCpy $ErrCode "No appropriate registry found."
Goto Error
F4Exists:
IntCmp $1 0 0 F4Version
Messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "" "Select where you want the theater installed." "OF/RV" "AF" IDCANCEL
Pop $0
IntCmp $0 3 Finish
IntCmp $0 2 AFInstall
F4Version:
ReadRegStr $F4Root HKLM "Software\MicroProse\Falcon\4.0" "basedir"
IfFileExists $F4Root\theater.lst 0 NoFileFound
IfFileExists $F4Root\terrdata\objects\KoreaObj.Dxl RVFound
IfFileExists $F4Root\terrdata\objects\KoreaObj.lod OFFound NoFileFound
NoFileFound:
StrCpy $ErrCode "No F4 install found."
Goto Error
RVFound:
StrCpy $F4ver "F4"
StrCpy $F4subver "RV"
Goto F4Install
OFFound:
StrCpy $F4ver "F4"
StrCpy $F4subver "OF"
Goto F4Install
AFInstall:
ReadRegStr $F4root HKLM "Software\Lead Pursuit\Battlefield Operations\Falcon" "basedir"
StrCpy $1 "$F4root\campaign\korea"
StrCpy $2 "$F4root\Utilities\LxNormalFix.exe $$LP @${TNAME} @$F4root\Theaters\${TNAME}\terrdata"
StrCpy $F4ver "AF"
Goto CheckPrevious
F4Install:
ReadRegStr $F4root HKLM "Software\MicroProse\Falcon\4.0" "basedir"
StrCpy $1 "$F4root\campaign\save"
StrCpy $2 "$F4root\Utilities\LxNormalFix.exe @${TNAME} @$F4root\Theaters\${TNAME}\terrdata"
; check for existing directory and delete if necessary
CheckPrevious:
StrCpy $7 ${PrevDir01}
IfFileExists "$F4root\${PrevDir01}\*.*" DelPrevVer
StrCpy $7 ${PrevDir02}
IfFileExists "$F4root\${PrevDir02}\*.*" DelPrevVer
; go on as many previous directories as you want to delete - doing the StrCpy $7 and next previous directory
Goto CreateDirs
DelPrevVer:
MessageBox MB_OKCANCEL "Previous version detected: $7. OK to delete previous version and install, or cancel installation?" IDOK DeletePrev IDCANCEL Finish
DeletePrev:
RMDir "$F4root\${PrevDir01}"
RMDir "$F4root\${PrevDir02}"
; and so on until all prev dirs are deleted
CreateDirs:
CreateDirectory "$F4root\Theaters\${TNAME}\campaign\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\terrain\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\texture\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\weather\"
SetOutPath "$F4root\Theaters\${TNAME}"
SetOverwrite Ifnewer
CopyFiles /filesonly "$1\*.pri" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.txt" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.b" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.db" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.ia" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.dfs" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.dat" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.gbd" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.lst" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.idx" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.wch" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\atc.ini" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\Falcon4.AII" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\FALCON4.RT" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\FALCON4.TT" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\KOREA.NAM" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\Korea.tm" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\mpwcells.bin" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\tmp.frc" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\tmp.his" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\VALIDAC.ACT" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$F4root\terrdata\korea\texture\texture.bin" "$F4root\Theaters\${TNAME}\terrdata\texture\"
CopyFiles /filesonly "$F4root\terrdata\korea\texture\texture.zip" "$F4root\Theaters\${TNAME}\terrdata\texture\"
CopyFiles /filesonly "$F4root\terrdata\korea\texture\fartiles.pal" "$F4root\Theaters\${TNAME}\terrdata\texture\"
CopyFiles "$F4root\terrdata\korea\weather\*.*" "$F4root\Theaters\${TNAME}\terrdata\weather\"
; unpack the theater files
File /r "${DEVDIRECTORY}\*.*" ;@@
; snake try to make campmap and campaign files included only once
;campmap
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\art\DesertStorm1\art\resource\campmap.*" "$F4Root\Theaters\${TNAME}\art\DesertStorm2\art\resource\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\art\DesertStorm1\art\resource\campmap.*" "$F4Root\Theaters\${TNAME}\art\DesertStorm3\art\resource\"
;campaign files
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\desertstorm.*" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm2\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\desertstorm.*" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm3\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\kneemap.gif" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm2\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\kneemap.gif" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm3\"
; database copy
StrCmp $F4subver "OF" DataBaseOF
StrCmp $F4subver "RV" DataBaseRV
; database AF
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\objects\AF\*.*" "$F4Root\Theaters\${TNAME}\objects\"
goto EndOfDataBaseCopy
DataBaseOF:
; database OF
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\objects\OF\*.*" "$F4Root\Theaters\${TNAME}\objects\"
goto EndOfDataBaseCopy
DataBaseRV:
; database RV
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\objects\RV\*.*" "$F4Root\Theaters\${TNAME}\objects\"
EndOfDataBaseCopy:
RMDir /r "$F4Root\Theaters\${TNAME}\objects\F4AF\"
RMDir /r "$F4Root\Theaters\${TNAME}\objects\RV\"
RMDir /r "$F4Root\Theaters\${TNAME}\objects\OF\"
StrCmp $F4ver "F4" F4curTheater TheaterAdmin
F4curTheater:
; set current theater to new theater
; this reads the specified registry value into $3 for use later
ReadRegStr $3 HKLM "Software\MicroProse\Falcon\4.0" "curTheater"
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "${TNAME}" "REG_SZ" $R0
StrCmp $F4subver "OF" TheaterAdmin
; RV stuff
TheaterAdmin:
SetOutPath "$F4root\utilities"
ExecWait "lstupdate.exe $8 +Theater\${TNAME}\${TNAME}.tdf"
ExecWait 'SPTinstall.exe -auto "$F4root\Theaters\${TNAME}\terrdata"'
ExecWait "LXNormalFix.exe $2"
; compress textures if F4 then finish
StrCmp $F4ver "AF" Finish
ExecWait "$F4root\Utilities\Seasonswitcher.exe -0"
MessageBox MB_YESNO "Do you want to make the new theater the current one?" IDYES Finish IDNO 0
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "$3" "REG_SZ" $R0
Goto finish
Error:
Messagebox MB_OK $ErrCode
Finish:
SectionEnd