| 1 |
!include "MUI.nsh" |
| 2 |
|
| 3 |
;Title Of Your Application |
| 4 |
Name "Crossfire Server 1.8.0 snapshot" |
| 5 |
|
| 6 |
VIAddVersionKey "ProductName" "Crossfire server installer" |
| 7 |
VIAddVersionKey "Comments" "Website: http://crossfire.real-time.com" |
| 8 |
VIAddVersionKey "FileDescription" "Crossfire server installer" |
| 9 |
VIAddVersionKey "FileVersion" "1.8.0" |
| 10 |
VIAddVersionKey "LegalCopyright" "Crossfire is released under the GPL." |
| 11 |
VIProductVersion "1.8.0.0" |
| 12 |
|
| 13 |
;Do A CRC Check |
| 14 |
CRCCheck On |
| 15 |
SetCompressor /SOLID lzma |
| 16 |
|
| 17 |
;Output File Name |
| 18 |
OutFile "CrossfireServer.exe" |
| 19 |
|
| 20 |
;License Page Introduction |
| 21 |
LicenseText "You must agree to this license before installing." |
| 22 |
|
| 23 |
;The Default Installation Directory |
| 24 |
InstallDir "$PROGRAMFILES\Crossfire Server" |
| 25 |
InstallDirRegKey HKCU "Software\Crossfire Server" "" |
| 26 |
|
| 27 |
!define MUI_ABORTWARNING |
| 28 |
|
| 29 |
!insertmacro MUI_PAGE_WELCOME |
| 30 |
!insertmacro MUI_PAGE_LICENSE "..\COPYING" |
| 31 |
!insertmacro MUI_PAGE_COMPONENTS |
| 32 |
!insertmacro MUI_PAGE_DIRECTORY |
| 33 |
!insertmacro MUI_PAGE_INSTFILES |
| 34 |
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Release_notes.txt" |
| 35 |
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show release notes" |
| 36 |
!insertmacro MUI_PAGE_FINISH |
| 37 |
|
| 38 |
!insertmacro MUI_UNPAGE_WELCOME |
| 39 |
!insertmacro MUI_UNPAGE_COMPONENTS |
| 40 |
!insertmacro MUI_UNPAGE_INSTFILES |
| 41 |
!insertmacro MUI_UNPAGE_FINISH |
| 42 |
|
| 43 |
|
| 44 |
!insertmacro MUI_LANGUAGE "English" |
| 45 |
|
| 46 |
Section "Crossfire Server (required)" cf |
| 47 |
SectionIn RO |
| 48 |
;Install Files |
| 49 |
SetOutPath $INSTDIR |
| 50 |
SetCompress Auto |
| 51 |
SetOverwrite IfNewer |
| 52 |
File "ReleaseLog\crossfire32.exe" |
| 53 |
File "Release_notes.txt" |
| 54 |
File /oname=Changelog.rtf "..\changelog" |
| 55 |
SetOutPath $INSTDIR\share |
| 56 |
File "..\lib\archetypes" |
| 57 |
File "..\lib\artifacts" |
| 58 |
File "..\lib\attackmess" |
| 59 |
File "..\lib\ban_file" |
| 60 |
File "..\lib\bmaps" |
| 61 |
File "..\lib\bmaps.paths" |
| 62 |
File "..\lib\crossfire.0" |
| 63 |
File "..\lib\crossfire.1" |
| 64 |
File "..\lib\def_help" |
| 65 |
File "..\lib\dm_file" |
| 66 |
File "..\lib\exp_table" |
| 67 |
File "..\lib\faces" |
| 68 |
File "..\lib\forbid" |
| 69 |
File "..\lib\formulae" |
| 70 |
File "..\lib\image_info" |
| 71 |
File "..\lib\materials" |
| 72 |
File "..\lib\messages" |
| 73 |
File "..\lib\motd" |
| 74 |
File "..\lib\news" |
| 75 |
File "..\lib\races" |
| 76 |
File "..\lib\regions" |
| 77 |
File "..\lib\rules" |
| 78 |
File "..\lib\settings" |
| 79 |
File "..\lib\smooth" |
| 80 |
File "..\lib\animations" |
| 81 |
File /oname=treasures "..\lib\treasures.bld" |
| 82 |
SetOutPath $INSTDIR\share\help |
| 83 |
File "..\lib\help\*.*" |
| 84 |
SetOutPath $INSTDIR\share\wizhelp |
| 85 |
File "..\lib\wizhelp\*.*" |
| 86 |
|
| 87 |
; Additional directories |
| 88 |
CreateDirectory $INSTDIR\tmp |
| 89 |
CreateDirectory $INSTDIR\var |
| 90 |
CreateDirectory $INSTDIR\var\players |
| 91 |
CreateDirectory $INSTDIR\var\template-maps |
| 92 |
CreateDirectory $INSTDIR\var\unique-items |
| 93 |
CreateDirectory $INSTDIR\var\datafiles |
| 94 |
|
| 95 |
; Write the uninstall keys for Windows |
| 96 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crossfire Server" "DisplayName" "Crossfire Server (remove only)" |
| 97 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crossfire Server" "UninstallString" "$INSTDIR\Uninst.exe" |
| 98 |
WriteUninstaller "Uninst.exe" |
| 99 |
|
| 100 |
;Ask about Windows service |
| 101 |
MessageBox MB_YESNO|MB_ICONQUESTION "Register Crossfire server as a Windows service?" /SD IDYES IDNO dont_install |
| 102 |
|
| 103 |
;Install service |
| 104 |
DetailPrint "Registering service..." |
| 105 |
ExecWait '"$INSTDIR\Crossfire32.exe" -regsrv' |
| 106 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crossfire Server" "ServiceInstalled" "1" |
| 107 |
|
| 108 |
dont_install: |
| 109 |
SectionEnd |
| 110 |
|
| 111 |
Section "Python plugin" py |
| 112 |
DetailPrint "Checking for Python24.dll..." |
| 113 |
GetDllVersion "Python24.dll" $R0 $R1 |
| 114 |
IntOp $R2 $R0 / 0x00010000 |
| 115 |
IntOp $R3 $R0 & 0x0000FFFF |
| 116 |
IntCmp $R2 2 0 wrong |
| 117 |
IntCmp $R3 4 0 wrong |
| 118 |
DetailPrint " found" |
| 119 |
Goto ok |
| 120 |
wrong: |
| 121 |
MessageBox MB_YESNO|MB_ICONQUESTION "Couldn't find Python24.dll. Make sure Python is installed, and that Python24.dll is in your PATH.$\rServer may fail to start if this DLL is not found.$\rInstall plugin anyway?" /SD IDNO IDNO end |
| 122 |
DetailPrint " install anyway." |
| 123 |
ok: |
| 124 |
SetOutPath $INSTDIR\share\plugins |
| 125 |
File "plugin_python\ReleaseLog\plugin_python.dll" |
| 126 |
end: |
| 127 |
SectionEnd |
| 128 |
|
| 129 |
Section /o "Animator plugin" anim |
| 130 |
SetOutPath $INSTDIR\share\plugins |
| 131 |
File "plugin_anim\ReleaseLog\plugin_animator.dll" |
| 132 |
SectionEnd |
| 133 |
|
| 134 |
Section "Menu Shortcuts" menus |
| 135 |
;Add Shortcuts |
| 136 |
SetOutPath $INSTDIR |
| 137 |
CreateDirectory "$SMPROGRAMS\Crossfire Server" |
| 138 |
CreateShortCut "$SMPROGRAMS\Crossfire Server\Crossfire Server.lnk" "$INSTDIR\crossfire32.exe" "" "$INSTDIR\crossfire32.exe" 0 |
| 139 |
CreateShortCut "$SMPROGRAMS\Crossfire Server\Install as Windows service.lnk" "$INSTDIR\crossfire32.exe" "-regsrv" "$INSTDIR\crossfire32.exe" 0 |
| 140 |
CreateShortCut "$SMPROGRAMS\Crossfire Server\Uninstall Windows service.lnk" "$INSTDIR\crossfire32.exe" "-unregsrv" "$INSTDIR\crossfire32.exe" 0 |
| 141 |
CreateShortCut "$SMPROGRAMS\Crossfire Server\Release notes.lnk" "$INSTDIR\Release_notes.txt" |
| 142 |
CreateShortCut "$SMPROGRAMS\Crossfire Server\Changelog.lnk" "$INSTDIR\Changelog.rtf" |
| 143 |
CreateShortCut "$SMPROGRAMS\Crossfire Server\Uninstall.lnk" "$INSTDIR\uninst.exe" "" "$INSTDIR\uninst.exe" 0 |
| 144 |
SectionEnd |
| 145 |
|
| 146 |
UninstallText "This will uninstall Crossfire Server from your system" |
| 147 |
|
| 148 |
Section "un.Crossfire Server" un_cf |
| 149 |
SectionIn RO |
| 150 |
;Unregister service if it was installed |
| 151 |
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crossfire Server" "ServiceInstalled" |
| 152 |
StrCmp $0 "1" 0 +2 |
| 153 |
ExecWait '"$INSTDIR\Crossfire32.exe" -unregsrv' |
| 154 |
|
| 155 |
;Delete Files |
| 156 |
Delete "$INSTDIR\crossfire32.exe" |
| 157 |
Delete "$INSTDIR\Changelog.rtf" |
| 158 |
Delete "$INSTDIR\Share\plugins\python21.dll" |
| 159 |
Delete "$INSTDIR\Release_notes.txt" |
| 160 |
Delete "$INSTDIR\Share\treasures" |
| 161 |
Delete "$INSTDIR\Share\archetypes" |
| 162 |
Delete "$INSTDIR\Share\artifacts" |
| 163 |
Delete "$INSTDIR\Share\attackmess" |
| 164 |
Delete "$INSTDIR\Share\ban_file" |
| 165 |
Delete "$INSTDIR\Share\bmaps" |
| 166 |
Delete "$INSTDIR\Share\bmaps.paths" |
| 167 |
Delete "$INSTDIR\Share\crossfire.0" |
| 168 |
Delete "$INSTDIR\Share\crossfire.1" |
| 169 |
Delete "$INSTDIR\Share\def_help" |
| 170 |
Delete "$INSTDIR\Share\dm_file" |
| 171 |
Delete "$INSTDIR\Share\exp_table" |
| 172 |
Delete "$INSTDIR\Share\faces" |
| 173 |
Delete "$INSTDIR\Share\forbid" |
| 174 |
Delete "$INSTDIR\Share\formulae" |
| 175 |
Delete "$INSTDIR\Share\image_info" |
| 176 |
Delete "$INSTDIR\Share\materials" |
| 177 |
Delete "$INSTDIR\Share\messages" |
| 178 |
Delete "$INSTDIR\Share\motd" |
| 179 |
Delete "$INSTDIR\Share\news" |
| 180 |
Delete "$INSTDIR\Share\races" |
| 181 |
Delete "$INSTDIR\Share\regions" |
| 182 |
Delete "$INSTDIR\Share\rules" |
| 183 |
Delete "$INSTDIR\Share\settings" |
| 184 |
Delete "$INSTDIR\Share\smooth" |
| 185 |
Delete "$INSTDIR\Share\animations" |
| 186 |
|
| 187 |
;Delete help files |
| 188 |
RmDir /r "$INSTDIR\Share\Help" |
| 189 |
RmDir /r "$INSTDIR\Share\WizHelp" |
| 190 |
|
| 191 |
;Delete plugins |
| 192 |
RmDir /r "$INSTDIR\Share\Plugins" |
| 193 |
|
| 194 |
;Remove 'temp' directory |
| 195 |
rmdir /r "$INSTDIR\tmp" |
| 196 |
|
| 197 |
;Remove some data files |
| 198 |
Delete "$INSTDIR\Var\clockdata" |
| 199 |
Delete "$INSTDIR\Var\crossfire.log" |
| 200 |
Delete "$INSTDIR\Var\crossfiremail" |
| 201 |
|
| 202 |
;Delete Start Menu Shortcuts |
| 203 |
RmDir /r "$SMPROGRAMS\Crossfire Server" |
| 204 |
|
| 205 |
;Delete Uninstaller And Unistall Registry Entries |
| 206 |
Delete "$INSTDIR\Uninst.exe" |
| 207 |
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Crossfire Server" |
| 208 |
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Crossfire Server" |
| 209 |
SectionEnd |
| 210 |
|
| 211 |
Section "un.Player files and unique maps data" un_pl |
| 212 |
;Remove player data section |
| 213 |
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Warning, this will remove all player files, player data, and template maps!$\rAre you sure?" IDNO skip |
| 214 |
RmDir /r "$INSTDIR\var\players" |
| 215 |
RmDir /r "$INSTDIR\var\template-maps" |
| 216 |
RmDir /r "$INSTDIR\var\unique-items" |
| 217 |
RmDir /r "$INSTDIR\var\datafiles" |
| 218 |
skip: |
| 219 |
SectionEnd |
| 220 |
|
| 221 |
|
| 222 |
Section -un.final_clean |
| 223 |
|
| 224 |
;Let's check for map uninstaller |
| 225 |
IfFileExists "$INSTDIR\UninstMaps.exe" maps no_maps |
| 226 |
|
| 227 |
maps: |
| 228 |
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to also remove the maps?" IDNO no_maps |
| 229 |
|
| 230 |
Banner::Show /NOUNLOAD /set 76 "Please wait" "Uninstalling maps..." |
| 231 |
|
| 232 |
;Remove maps, let's call the uninstaller in silent mode, and no copying itself somewhere else |
| 233 |
;(else ExecWait can't wait!) |
| 234 |
ExecWait '"$INSTDIR\UninstMaps.exe" /S _?=$INSTDIR' |
| 235 |
;Need to remove installer, as it couldn't remove itself |
| 236 |
Delete "$INSTDIR\UninstMaps.exe" |
| 237 |
|
| 238 |
Banner::Destroy |
| 239 |
|
| 240 |
no_maps: |
| 241 |
|
| 242 |
;Delete Share directory, if empty |
| 243 |
Rmdir "$INSTDIR\share" |
| 244 |
|
| 245 |
;Remove 'var' directory if possible (no force, since user can leave player data) |
| 246 |
rmdir "$INSTDIR\var" |
| 247 |
|
| 248 |
;Clean main directory if possible |
| 249 |
RmDir "$INSTDIR" |
| 250 |
|
| 251 |
SectionEnd |
| 252 |
|
| 253 |
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
| 254 |
!insertmacro MUI_DESCRIPTION_TEXT ${cf} "Crossfire Server (required)." |
| 255 |
!insertmacro MUI_DESCRIPTION_TEXT ${py} "Python plugin support. Enables post office and a few goodies. Python required." |
| 256 |
!insertmacro MUI_DESCRIPTION_TEXT ${anim} "Animator plugin support. Experimental, use at your own risk!" |
| 257 |
!insertmacro MUI_DESCRIPTION_TEXT ${menus} "Insert icons in Start Menu." |
| 258 |
!insertmacro MUI_FUNCTION_DESCRIPTION_END |
| 259 |
|
| 260 |
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN |
| 261 |
!insertmacro MUI_DESCRIPTION_TEXT ${un_cf} "Remove Crossfire Server." |
| 262 |
!insertmacro MUI_DESCRIPTION_TEXT ${un_pl} "Remove ALL player data, as well as unique maps information." |
| 263 |
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END |
| 264 |
|