Skip to content

Commit dbe909a

Browse files
committed
Updated Windows Installer script
1 parent 4c7831e commit dbe909a

File tree

1 file changed

+39
-24
lines changed

1 file changed

+39
-24
lines changed

mk/windoze/Installer/MegaGlestInstaller.nsi

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,33 @@
22
; General Attributes
33

44
!define APNAME Mega-Glest
5+
!define APVER 3.3.4
56

6-
Name "${APNAME} 3.3.3"
7+
Name "${APNAME} ${APVER}"
78
SetCompressor /FINAL /SOLID lzma
89
SetCompressorDictSize 64
9-
OutFile "${APNAME}-Installer.exe"
10+
OutFile "${APNAME}-Installer-${APVER}_i386_win32.exe"
1011
Icon "..\glest.ico"
1112
UninstallIcon "..\glest.ico"
1213
!define MUI_ICON "..\glest.ico"
1314
!define MUI_UNICON "..\glest.ico"
14-
InstallDir "$PROGRAMFILES\${APNAME}"
15+
InstallDir "$PROGRAMFILES\${APNAME}_${APVER}"
1516
ShowInstDetails show
1617
BGGradient 0xDF9437 0xffffff
1718

1819
; Request application privileges for Windows Vista
1920
RequestExecutionLevel none
2021

22+
PageEx license
23+
LicenseText "Megaglest License"
24+
LicenseData "..\..\..\data\glest_game\docs\license.txt"
25+
PageExEnd
26+
27+
PageEx license
28+
LicenseText "Megaglest README"
29+
LicenseData "..\..\..\data\glest_game\docs\readme.txt"
30+
PageExEnd
31+
2132
;--------------------------------
2233
; Images not included!
2334
; Use your own animated GIFs please
@@ -35,7 +46,7 @@ RequestExecutionLevel none
3546

3647
; Registry key to check for directory (so if you install again, it will
3748
; overwrite the old one automatically)
38-
InstallDirRegKey HKLM "Software\${APNAME}" "Install_Dir"
49+
InstallDirRegKey HKLM "Software\${APNAME}_${APVER}" "Install_Dir"
3950

4051
; Pages
4152

@@ -57,14 +68,18 @@ Function MUIGUIInit
5768
# GetDlgItem $0 $0 1006
5869
# SetCtlColors $0 0xDF9437 0xDF9437
5970

60-
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}" "UninstallString"
71+
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}_${APVER}" "UninstallString"
6172
StrCmp $R0 "" doneInit
6273

6374
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
64-
"${APNAME} is already installed. $\n$\nClick `OK` to remove the \
65-
previous version or `Cancel` to cancel this upgrade." \
75+
"${APNAME} v${APVER} is already installed. $\n$\nClick `OK` to remove the \
76+
previous installation or `Cancel` to install to a different location." \
6677
IDOK uninstInit
67-
Abort
78+
79+
# change install folder to a version specific name to aovid over-writing
80+
# old one
81+
StrCpy $INSTDIR "$PROGRAMFILES\${APNAME}_${APVER}"
82+
goto doneInit
6883

6984
;Run the uninstaller
7085
uninstInit:
@@ -86,7 +101,7 @@ FunctionEnd
86101

87102
Function .onInstSuccess
88103

89-
MessageBox MB_OK "${APNAME} installed successfully, click OK to launch game."
104+
MessageBox MB_OK "${APNAME} v${APVER} installed successfully, click OK to launch game."
90105

91106
SetOutPath $INSTDIR
92107
Exec 'glest_game.exe'
@@ -124,13 +139,13 @@ Section "${APNAME} (required)"
124139
# File /r /x .svn "..\..\..\data\glest_game\screens"
125140

126141
; Write the installation path into the registry
127-
WriteRegStr HKLM Software\${APNAME} "Install_Dir" "$INSTDIR"
142+
WriteRegStr HKLM Software\${APNAME}_${APVER} "Install_Dir" "$INSTDIR"
128143

129144
; Write the uninstall keys for Windows
130-
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}" "DisplayName" "${APNAME}"
131-
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
132-
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}" "NoModify" 1
133-
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}" "NoRepair" 1
145+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}_${APVER}" "DisplayName" "${APNAME} v${APVER}"
146+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}_${APVER}" "UninstallString" '"$INSTDIR\uninstall.exe"'
147+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}_${APVER}" "NoModify" 1
148+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}_${APVER}" "NoRepair" 1
134149
WriteUninstaller "uninstall.exe"
135150

136151
CreateDirectory $INSTDIR\data
@@ -149,13 +164,13 @@ SectionEnd
149164
; Optional section (can be disabled by the user)
150165
Section "Start Menu Shortcuts"
151166

152-
CreateDirectory "$SMPROGRAMS\${APNAME}"
153-
CreateShortCut "$SMPROGRAMS\${APNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
154-
CreateShortCut "$SMPROGRAMS\${APNAME}\${APNAME}_game.lnk" "$INSTDIR\glest_game.exe" "" "$INSTDIR\glest_game.exe" 0
167+
CreateDirectory "$SMPROGRAMS\${APNAME}_${APVER}"
168+
CreateShortCut "$SMPROGRAMS\${APNAME}_${APVER}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
169+
CreateShortCut "$SMPROGRAMS\${APNAME}_${APVER}\${APNAME}_${APVER}_game.lnk" "$INSTDIR\glest_game.exe" "" "$INSTDIR\glest_game.exe" 0
155170

156-
CreateShortCut "$SMPROGRAMS\${APNAME}\${APNAME}_config.lnk" "$INSTDIR\glest_configurator.exe" "" "$INSTDIR\glest_configurator.exe" 0
157-
CreateShortCut "$SMPROGRAMS\${APNAME}\${APNAME}_editor.lnk" "$INSTDIR\glest_editor.exe" "" "$INSTDIR\glest_editor.exe" 0
158-
CreateShortCut "$SMPROGRAMS\${APNAME}\${APNAME}_viewer.lnk" "$INSTDIR\g3d_viewer.exe" "" "$INSTDIR\g3d_viewer.exe" 0
171+
CreateShortCut "$SMPROGRAMS\${APNAME}_${APVER}\${APNAME}_${APVER}_config.lnk" "$INSTDIR\glest_configurator.exe" "" "$INSTDIR\glest_configurator.exe" 0
172+
CreateShortCut "$SMPROGRAMS\${APNAME}_${APVER}\${APNAME}_${APVER}_editor.lnk" "$INSTDIR\glest_editor.exe" "" "$INSTDIR\glest_editor.exe" 0
173+
CreateShortCut "$SMPROGRAMS\${APNAME}_${APVER}\${APNAME}_${APVER}_viewer.lnk" "$INSTDIR\g3d_viewer.exe" "" "$INSTDIR\g3d_viewer.exe" 0
159174

160175
SectionEnd
161176

@@ -166,8 +181,8 @@ SectionEnd
166181
Section "Uninstall"
167182

168183
; Remove registry keys
169-
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}"
170-
DeleteRegKey HKLM SOFTWARE\${APNAME}
184+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APNAME}_${APVER}"
185+
DeleteRegKey HKLM SOFTWARE\${APNAME}_${APVER}
171186

172187
; Remove files and uninstaller
173188
Delete $INSTDIR\uninstall.exe
@@ -204,10 +219,10 @@ Section "Uninstall"
204219
RMDir /r $INSTDIR\tutorials
205220

206221
; Remove shortcuts, if any
207-
Delete "$SMPROGRAMS\${APNAME}\*.*"
222+
Delete "$SMPROGRAMS\${APNAME}_${APVER}\*.*"
208223

209224
; Remove directories used
210-
RMDir "$SMPROGRAMS\${APNAME}"
225+
RMDir "$SMPROGRAMS\${APNAME}_${APVER}"
211226
RMDir "$INSTDIR"
212227

213228
SectionEnd

0 commit comments

Comments
 (0)