Skip to content
This repository
Browse code

Merge pull request #3127 from MartijnKaijser/win32_installer_cleanup

Win32 installer add normal install mode (and cleanup)
  • Loading branch information...
commit 276abf9e3d283ae26199d9f8879bb324264a7661 2 parents bcf99dc + 0779020
Martijn Kaijser authored
95  project/Win32BuildSetup/XBMC for Windows.nsi
@@ -11,20 +11,25 @@
11 11
   !include "nsDialogs.nsh"
12 12
   !include "LogicLib.nsh"
13 13
   !include "WinVer.nsh"
  14
+  
  15
+;--------------------------------
  16
+;define global used name
  17
+  !define APP_NAME "XBMC"
  18
+
14 19
 ;--------------------------------
15 20
 ;General
16 21
 
17 22
   ;Name and file
18  
-  Name "XBMC"
19  
-  OutFile "XBMCSetup-${xbmc_revision}-${xbmc_branch}.exe"
  23
+  Name "${APP_NAME}"
  24
+  OutFile "${APP_NAME}Setup-${xbmc_revision}-${xbmc_branch}.exe"
20 25
 
21 26
   XPStyle on
22 27
   
23 28
   ;Default installation folder
24  
-  InstallDir "$PROGRAMFILES\XBMC"
  29
+  InstallDir "$PROGRAMFILES\${APP_NAME}"
25 30
 
26 31
   ;Get installation folder from registry if available
27  
-  InstallDirRegKey HKCU "Software\XBMC" ""
  32
+  InstallDirRegKey HKCU "Software\${APP_NAME}" ""
28 33
 
29 34
   ;Request application privileges for Windows Vista
30 35
   RequestExecutionLevel admin
@@ -34,7 +39,6 @@
34 39
 
35 40
   Var StartMenuFolder
36 41
   Var PageProfileState
37  
-  Var RunArgs
38 42
   Var DirectXSetupError
39 43
   Var VSRedistSetupError
40 44
   
@@ -50,8 +54,7 @@
50 54
   ;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\webapps\ROOT\RELEASE-NOTES.txt"
51 55
   !define MUI_FINISHPAGE_LINK "Please visit http://xbmc.org for more information."
52 56
   !define MUI_FINISHPAGE_LINK_LOCATION "http://xbmc.org"
53  
-  !define MUI_FINISHPAGE_RUN "$INSTDIR\XBMC.exe"
54  
-  ;!define MUI_FINISHPAGE_RUN_PARAMETERS $RunArgs
  57
+  !define MUI_FINISHPAGE_RUN "$INSTDIR\${APP_NAME}.exe"
55 58
   !define MUI_FINISHPAGE_RUN_NOTCHECKED
56 59
   !define MUI_ABORTWARNING  
57 60
 ;--------------------------------
@@ -64,7 +67,7 @@
64 67
   
65 68
   ;Start Menu Folder Page Configuration
66 69
   !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
67  
-  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\XBMC" 
  70
+  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APP_NAME}" 
68 71
   !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
69 72
   !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder  
70 73
 
@@ -83,15 +86,19 @@
83 86
   !insertmacro MUI_LANGUAGE "English"
84 87
 
85 88
 ;--------------------------------
86  
-;Installer Sections
  89
+;Install levels
87 90
 
88  
-InstType "Full"
89  
-InstType "Minimal" 
  91
+InstType "Full"    ; 1.
  92
+InstType "Normal"  ; 2.
  93
+InstType "Minimal" ; 3.
  94
+
  95
+;--------------------------------
  96
+;Installer Sections
90 97
 
91 98
 Section "XBMC" SecXBMC
92 99
   SetShellVarContext current
93 100
   SectionIn RO
94  
-  SectionIn 1 2 #section is in installtype Full and Minimal
  101
+  SectionIn 1 2 3 #section is in install type Normal/Full/Minimal
95 102
   ;ADD YOUR OWN FILES HERE...
96 103
   SetOutPath "$INSTDIR"
97 104
   File "${xbmc_root}\Xbmc\XBMC.exe"
@@ -129,7 +136,7 @@ Section "XBMC" SecXBMC
129 136
   ;File /r "${xbmc_root}\Xbmc\web\*.*"
130 137
 
131 138
   ;Store installation folder
132  
-  WriteRegStr HKCU "Software\XBMC" "" $INSTDIR
  139
+  WriteRegStr HKCU "Software\${APP_NAME}" "" $INSTDIR
133 140
 
134 141
   ;Create uninstaller
135 142
   WriteUninstaller "$INSTDIR\Uninstall.exe"
@@ -142,41 +149,41 @@ Section "XBMC" SecXBMC
142 149
   Delete "$SMPROGRAMS\$StartMenuFolder\XBMC (Windowed).lnk"
143 150
   
144 151
   CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
145  
-  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\XBMC.lnk" "$INSTDIR\XBMC.exe" \
146  
-    "" "$INSTDIR\XBMC.exe" 0 SW_SHOWNORMAL \
147  
-    "" "Start XBMC."
148  
-  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall XBMC.lnk" "$INSTDIR\Uninstall.exe" \
  152
+  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" \
  153
+    "" "$INSTDIR\${APP_NAME}.exe" 0 SW_SHOWNORMAL \
  154
+    "" "Start ${APP_NAME}."
  155
+  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\Uninstall.exe" \
149 156
     "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
150  
-    "" "Uninstall XBMC."
  157
+    "" "Uninstall ${APP_NAME}."
151 158
   
152  
-  WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit XBMC Online.url" "InternetShortcut" "URL" "http://xbmc.org"
  159
+  WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit ${APP_NAME} Online.url" "InternetShortcut" "URL" "http://xbmc.org"
153 160
   !insertmacro MUI_STARTMENU_WRITE_END  
154 161
   
155 162
   ;add entry to add/remove programs
156  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
157  
-                 "DisplayName" "XBMC"
158  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  163
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
  164
+                 "DisplayName" "${APP_NAME}"
  165
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
159 166
                  "UninstallString" "$INSTDIR\uninstall.exe"
160  
-  WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  167
+  WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
161 168
                  "NoModify" 1
162  
-  WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  169
+  WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
163 170
                  "NoRepair" 1
164  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  171
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
165 172
                  "InstallLocation" "$INSTDIR"
166  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
167  
-                 "DisplayIcon" "$INSTDIR\XBMC.exe,0"
168  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  173
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
  174
+                 "DisplayIcon" "$INSTDIR\${APP_NAME}.exe,0"
  175
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
169 176
                  "Publisher" "Team XBMC"
170  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  177
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
171 178
                  "HelpLink" "http://xbmc.org/support"
172  
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC" \
  179
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
173 180
                  "URLInfoAbout" "http://xbmc.org"
174 181
                  
175 182
 SectionEnd
176 183
 
177 184
 SectionGroup "Language" SecLanguages
178 185
 Section "English" SecLanguageEnglish
179  
-  SectionIn 1 2 #section is in installtype Full and Minimal
  186
+  SectionIn 1 2 3 #section is in install type Full/Normal/Minimal
180 187
   SectionIn RO
181 188
   SetOutPath "$INSTDIR\language\English"
182 189
   File /r "${xbmc_root}\Xbmc\language\English\*.*"
@@ -187,7 +194,7 @@ SectionGroupEnd
187 194
 
188 195
 SectionGroup "Skins" SecSkins
189 196
 Section "Confluence" SecSkinConfluence
190  
-  SectionIn 1 2 #section is in installtype Full and Minimal
  197
+  SectionIn 1 2 3 #section is in install type Full/Normal/Minimal
191 198
   SectionIn RO
192 199
   SetOutPath "$INSTDIR\addons\skin.confluence\"
193 200
   File /r "${xbmc_root}\Xbmc\addons\skin.confluence\*.*"
@@ -215,7 +222,7 @@ SectionGroupEnd
215 222
 ;Descriptions
216 223
 
217 224
   ;Language strings
218  
-  LangString DESC_SecXBMC ${LANG_ENGLISH} "XBMC"
  225
+  LangString DESC_SecXBMC ${LANG_ENGLISH} "${APP_NAME}"
219 226
 
220 227
   ;Assign language strings to sections
221 228
   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
@@ -231,7 +238,7 @@ Var UnPageProfileCheckbox_State
231 238
 Var UnPageProfileEditBox
232 239
 
233 240
 Function un.UnPageProfile
234  
-    !insertmacro MUI_HEADER_TEXT "Uninstall XBMC" "Remove XBMC's profile folder from your computer."
  241
+    !insertmacro MUI_HEADER_TEXT "Uninstall ${APP_NAME}" "Remove ${APP_NAME}'s profile folder from your computer."
235 242
   nsDialogs::Create /NOUNLOAD 1018
236 243
   Pop $UnPageProfileDialog
237 244
 
@@ -242,7 +249,7 @@ Function un.UnPageProfile
242 249
   ${NSD_CreateLabel} 0 0 100% 12u "Do you want to delete the profile folder?"
243 250
   Pop $0
244 251
 
245  
-  ${NSD_CreateText} 0 13u 100% 12u "$APPDATA\XBMC\"
  252
+  ${NSD_CreateText} 0 13u 100% 12u "$APPDATA\${APP_NAME}\"
246 253
   Pop $UnPageProfileEditBox
247 254
     SendMessage $UnPageProfileEditBox ${EM_SETREADONLY} 1 0
248 255
 
@@ -265,7 +272,7 @@ Section "Uninstall"
265 272
   SetShellVarContext current
266 273
 
267 274
   ;ADD YOUR OWN FILES HERE...
268  
-  Delete "$INSTDIR\XBMC.exe"
  275
+  Delete "$INSTDIR\${APP_NAME}.exe"
269 276
   Delete "$INSTDIR\copying.txt"
270 277
   Delete "$INSTDIR\known_issues.txt"
271 278
   Delete "$INSTDIR\LICENSE.GPL"
@@ -295,7 +302,7 @@ Section "Uninstall"
295 302
   ${If} $UnPageProfileCheckbox_State == ${BST_CHECKED}
296 303
     RMDir /r "$INSTDIR\userdata"  
297 304
     RMDir "$INSTDIR"
298  
-    RMDir /r "$APPDATA\XBMC\"
  305
+    RMDir /r "$APPDATA\${APP_NAME}\"
299 306
   ${Else}
300 307
 ;Even if userdata is kept in %appdata%\xbmc\userdata, the $INSTDIR\userdata should be cleaned up on uninstall if not used
301 308
 ;If guisettings.xml exists in the XBMC\userdata directory, do not delete XBMC\userdata directory
@@ -307,15 +314,15 @@ Section "Uninstall"
307 314
 
308 315
   
309 316
   !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
310  
-  Delete "$SMPROGRAMS\$StartMenuFolder\XBMC.lnk"
  317
+  Delete "$SMPROGRAMS\$StartMenuFolder\${APP_NAME}.lnk"
311 318
   Delete "$SMPROGRAMS\$StartMenuFolder\XBMC (Portable).lnk"
312 319
   Delete "$SMPROGRAMS\$StartMenuFolder\XBMC (Windowed).lnk"
313  
-  Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall XBMC.lnk"
314  
-  Delete "$SMPROGRAMS\$StartMenuFolder\Visit XBMC Online.url"
  320
+  Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall ${APP_NAME}.lnk"
  321
+  Delete "$SMPROGRAMS\$StartMenuFolder\Visit ${APP_NAME} Online.url"
315 322
   RMDir "$SMPROGRAMS\$StartMenuFolder"  
316  
-  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\XBMC"
  323
+  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
317 324
 
318  
-  DeleteRegKey /ifempty HKCU "Software\XBMC"
  325
+  DeleteRegKey /ifempty HKCU "Software\${APP_NAME}"
319 326
 
320 327
 SectionEnd
321 328
 
@@ -324,7 +331,7 @@ SectionEnd
324 331
 
325 332
 Section "Microsoft Visual C++ 2008/2010 Redistributable Package (x86)" SEC_VCREDIST
326 333
 
327  
-  SectionIn 1 2
  334
+  SectionIn 1 2 #section is in install type Full/Normal and when not installed
328 335
   
329 336
   DetailPrint "Running VS Redist Setup..."
330 337
 
@@ -353,7 +360,7 @@ SectionEnd
353 360
 
354 361
 Section "DirectX Install" SEC_DIRECTX
355 362
  
356  
-  SectionIn 1 2
  363
+  SectionIn 1 2 #section is in install type Full/Normal and when not installed
357 364
 
358 365
   DetailPrint "Running DirectX Setup..."
359 366
 
5  project/Win32BuildSetup/genNsisIncludes.bat
@@ -6,7 +6,7 @@ rem http://xbmc.org
6 6
 rem Script by chadoe
7 7
 rem This script generates nullsoft installer include files for xbmc's languages
8 8
 rem and pvr addons
9  
-
  9
+rem 1. Full / 2. Normal  / 3. Minimal
10 10
 rem languages
11 11
 IF EXIST languages.nsi del languages.nsi > NUL
12 12
 IF EXIST xbmc-pvr-addons.nsi del xbmc-pvr-addons.nsi > NUL
@@ -17,7 +17,8 @@ FOR /F "tokens=*" %%S IN ('dir /B /AD BUILD_WIN32\Xbmc\language') DO (
17 17
   rem English is already included as default language
18 18
   IF "%%S" NEQ "English" (
19 19
     ECHO Section "%%S" SecLanguage!Counter! >> languages.nsi
20  
-    ECHO SectionIn 1 #section is in installtype Full >> languages.nsi
  20
+    ECHO SectionIn 1 2 3 #section is in installtype Full/Normal >> languages.nsi
  21
+    ECHO SectionIn RO #section is in installtype Manditory >> languages.nsi
21 22
     ECHO SetOutPath "$INSTDIR\language\%%S" >> languages.nsi
22 23
     ECHO File /r "${xbmc_root}\Xbmc\language\%%S\*.*" >> languages.nsi
23 24
     ECHO SectionEnd >> languages.nsi

0 notes on commit 276abf9

Please sign in to comment.
Something went wrong with that request. Please try again.