2008-11-17 10:42:14 +00:00
; Need to include the versions as we can't pass them in as parameters
; and it's too much work to try to dynamically edit this file
!include /NONFATAL " OoliteVersions.nsh "
!ifndef SVNREV
2008-11-17 19:04:27 +00:00
!warning " No SVN Revision supplied "
2008-11-17 10:42:14 +00:00
!define SVNREV 0
!endif
2008-11-17 19:04:27 +00:00
!ifndef VERSION
!warning " No Version information supplied "
!define VERSION 0.0.0.0
!endif
2008-11-17 10:42:14 +00:00
; Version number must be of format X.X.X.X.
; We use M.m.R.S: M-major, m-minor, R-revision, S-subversion
2008-11-17 19:04:27 +00:00
!define VER ${VERSION}
2008-11-15 09:54:01 +00:00
!ifndef DST
!define DST ..\ ..\ oolite.app
!endif
2008-11-17 10:42:14 +00:00
!ifndef OUTDIR
!define OUTDIR .
!endif
!ifndef SNAPSHOT
!define EXTVER " "
!else
!define EXTVER " -dev "
!endif
2008-11-15 09:54:01 +00:00
2008-11-15 14:21:56 +00:00
!include " MUI.nsh "
2006-03-16 10:08:57 +00:00
SetCompress auto
SetCompressor LZMA
SetCompressorDictSize 32
SetDatablockOptimize on
2008-11-17 10:42:14 +00:00
OutFile " ${OUTDIR}\OoliteInstall-${VER}${EXTVER}.exe "
2009-02-16 11:19:24 +00:00
BrandingText " (C) 2003-2009 Giles Williams and contributors "
2006-03-16 10:08:57 +00:00
Name " Oolite "
2008-11-17 10:42:14 +00:00
Caption " Oolite ${VER}${EXTVER} Setup "
2006-03-16 10:08:57 +00:00
SubCaption 0 " "
SubCaption 1 " "
SubCaption 2 " "
SubCaption 3 " "
SubCaption 4 " "
2006-03-19 21:05:22 +00:00
Icon Oolite.ico
UninstallIcon Oolite.ico
2006-03-16 10:08:57 +00:00
InstallDirRegKey HKLM Software\ Oolite " Install_Dir "
InstallDir $PROGRAMFILES \ Oolite
CRCCheck on
InstallColors /windows
InstProgressFlags smooth
AutoCloseWindow false
SetOverwrite on
2008-11-17 10:42:14 +00:00
VIAddVersionKey " ProductName " " Oolite "
VIAddVersionKey " FileDescription " " A space combat/trading game, inspired by Elite. "
2009-02-16 11:19:24 +00:00
VIAddVersionKey " LegalCopyright " " <EFBFBD> 2003-2009 Giles Williams and contributors"
2008-11-17 10:42:14 +00:00
VIAddVersionKey " FileVersion " " ${VER} "
!ifdef SNAPSHOT
VIAddVersionKey " SVN Revision " " ${SVNREV} "
!endif
!ifdef BUILDTIME
VIAddVersionKey " Build Time " " ${BUILDTIME} "
!endif
VIProductVersion " ${VER} "
2008-11-15 14:21:56 +00:00
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP " .\OoliteInstallerHeaderBitmap_ModernUI.bmp "
!define MUI_HEADERIMAGE_UNBITMAP " .\OoliteInstallerHeaderBitmap_ModernUI.bmp "
!define MUI_ICON oolite.ico
!define MUI_UNICON oolite.ico
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE " English "
2008-11-17 10:42:14 +00:00
Function .onInit
; 1. Check for multiple running installers
System :: Call 'kernel32::CreateMutexA(i 0, i 0, t "OoliteInstallerMutex") i .r1 ?e'
Pop $R0
StrCmp $R0 0 + 3
MessageBox MB_OK | MB_ICONEXCLAMATION " Another instance of the Oolite installer is already running. "
Abort
; 2. Checks for already-installed versions of Oolite and offers to uninstall
ReadRegStr $R0 HKLM \
" Software\Microsoft\Windows\CurrentVersion\Uninstall\Oolite " \
" UninstallString "
StrCmp $R0 " " done
MessageBox MB_OKCANCEL | MB_ICONEXCLAMATION \
" Oolite is already installed. $\n$\nClick `OK` to remove the \
previous version or ` Cancel ` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst :
ClearErrors
ExecWait '$R0 _?=$INSTDIR'
IfErrors no_remove_uninstaller
Delete " $INSTDIR \UninstOolite.exe "
Goto done
no_remove_uninstaller :
MessageBox MB_OK | MB_ICONEXCLAMATION " The Uninstaller did not complete successfully. Please ensure Oolite was correctly uninstalled then run the installer again. "
Abort
done :
FunctionEnd
2006-03-16 10:08:57 +00:00
Function RegSetup
FunctionEnd
Function un.RegSetup
FunctionEnd
2008-11-15 09:54:01 +00:00
;------------------------------------------------------------
; Installation Section
2006-03-16 10:08:57 +00:00
Section " "
SetOutPath $INSTDIR
2008-11-15 09:54:01 +00:00
; Package files
2006-03-16 10:08:57 +00:00
CreateDirectory " $INSTDIR \AddOns "
2008-11-15 09:54:01 +00:00
File " Oolite.ico "
File " Oolite_Readme.txt "
File " OoliteRS.pdf "
2009-05-25 10:11:20 +00:00
File " ..\..\Doc\AdviceForNewCommanders.pdf "
2008-11-15 09:54:01 +00:00
File /r /x .svn /x * ~ " ${DST} "
WriteUninstaller " $INSTDIR \UninstOolite.exe "
; Registry entries
2006-03-16 10:08:57 +00:00
WriteRegStr HKLM Software\ Oolite " Install_Dir " " $INSTDIR "
2008-11-17 10:42:14 +00:00
WriteRegStr HKLM Software\ Microsoft\ Windows\ CurrentVersion\ Uninstall\ Oolite DisplayName " Oolite ${VER}${EXTVER} "
2006-03-16 10:08:57 +00:00
WriteRegStr HKLM Software\ Microsoft\ Windows\ CurrentVersion\ Uninstall\ Oolite UninstallString '"$INSTDIR\UninstOolite.exe"'
2008-11-15 09:54:01 +00:00
; Start Menu shortcuts
2009-02-23 18:54:14 +00:00
SetOutPath $INSTDIR \ oolite.app
2006-03-16 10:08:57 +00:00
CreateDirectory " $SMPROGRAMS \Oolite "
2009-02-23 18:54:14 +00:00
CreateShortCut " $SMPROGRAMS \Oolite\Oolite.lnk " " $INSTDIR \oolite.app\oolite.exe " " " " $INSTDIR \Oolite.ico "
2006-03-16 10:08:57 +00:00
CreateShortCut " $SMPROGRAMS \Oolite\Oolite ReadMe.lnk " " $INSTDIR \Oolite_Readme.txt "
2008-11-15 09:54:01 +00:00
CreateShortCut " $SMPROGRAMS \Oolite\Oolite Reference Sheet.lnk " " $INSTDIR \OoliteRS.pdf "
2009-02-23 19:16:28 +00:00
CreateShortCut " $SMPROGRAMS \Oolite\Oolite Website.lnk " " http://oolite.org/ "
2006-03-16 10:08:57 +00:00
CreateShortCut " $SMPROGRAMS \Oolite\Oolite Uninstall.lnk " " $INSTDIR \UninstOolite.exe "
Call RegSetup
2008-11-15 09:54:01 +00:00
Exec " notepad.exe $INSTDIR\Oolite_Readme.txt "
2006-03-29 02:13:36 +00:00
2006-03-16 10:08:57 +00:00
SectionEnd
2008-11-15 09:54:01 +00:00
;------------------------------------------------------------
; Uninstaller Section
2006-03-16 10:08:57 +00:00
Section " Uninstall "
2008-11-15 09:54:01 +00:00
; Remove registry entries
2006-03-16 10:08:57 +00:00
DeleteRegKey HKLM Software\ Oolite
DeleteRegKey HKLM Software\ Microsoft\ Windows\ CurrentVersion\ Uninstall\ Oolite
Call un.RegSetup
2008-11-15 09:54:01 +00:00
; Remove Start Menu entries
2006-03-16 10:08:57 +00:00
RMDir /r " $SMPROGRAMS \Oolite "
2008-11-15 09:54:01 +00:00
; Remove Package files (but leave any generated content behind)
2008-12-07 11:43:05 +00:00
RMDir /r " $INSTDIR \oolite.app\Contents "
RMDir /r " $INSTDIR \oolite.app\GNUstep "
RMDir /r " $INSTDIR \oolite.app\oolite.app "
RMDir /r " $INSTDIR \oolite.app\Resources "
RMDir /r " $INSTDIR \oolite.app\Logs "
Delete " $INSTDIR \*.* "
Delete " $INSTDIR \oolite.app\*.* "
2008-11-15 09:54:01 +00:00
2006-03-16 10:08:57 +00:00
SectionEnd