forked from qgis/QGIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQGIS-Installer.nsi
594 lines (445 loc) · 22 KB
/
QGIS-Installer.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
;----------------------------------------------------------------------------------------------------------------------------
;Quantum GIS Installer for Windows
;Written by Marco Pasetti
;Mail to: [email protected]
;----------------------------------------------------------------------------------------------------------------------------
;Select if you are building a "Development Version" or a "Release Version" of the Quantum GIS Installer
;Change the INSTALLER_TYPE variable to Release or Development
!define INSTALLER_TYPE "Release-NoGrass"
;----------------------------------------------------------------------------------------------------------------------------
;Version variables
!define RELEASE_VERSION_NUMBER "1.4.0"
!define RELEASE_VERSION_NAME "Trunk-Test-Build"
!define RELEASE_SVN_REVISION "11639"
!define RELEASE_BINARY_REVISION "0"
!define DEV_VERSION_NUMBER ""
!define DEV_VERSION_NAME ""
!define DEV_SVN_REVISION ""
!define DEV_BINARY_REVISION ""
; Added by Tim to get optimal compression
SetCompressor /SOLID lzma
; Added by Tim to allow priveledge elevation in vista
RequestExecutionLevel admin
;----------------------------------------------------------------------------------------------------------------------------
;Don't modify the following lines
;----------------------------------------------------------------------------------------------------------------------------
;NSIS Includes
!include "MUI2.nsh"
!include "LogicLib.nsh"
;----------------------------------------------------------------------------------------------------------------------------
;define the QGIS Base Name
!define RELEASE_QGIS_BASE "Quantum GIS Mimas"
!define DEV_QGIS_BASE "Quantum GIS Unstable Dev"
;Set the installer variables, depending on the selected version to build
!if ${INSTALLER_TYPE} == "Release"
!define VERSION_NUMBER "${RELEASE_VERSION_NUMBER}"
!define VERSION_NAME "${RELEASE_VERSION_NAME}"
!define COMPLETE_NAME "${RELEASE_QGIS_BASE} ${RELEASE_VERSION_NUMBER} ${RELEASE_VERSION_NAME}"
!define SVN_REVISION "${RELEASE_SVN_REVISION}"
!define BINARY_REVISION "${RELEASE_BINARY_REVISION}"
!define QGIS_BASE "${RELEASE_QGIS_BASE}"
!define INSTALLER_NAME "QGIS-${VERSION_NUMBER}-${BINARY_REVISION}-Setup.exe"
!define DISPLAYED_NAME "${RELEASE_QGIS_BASE} ${VERSION_NUMBER}-${BINARY_REVISION}"
!define CHECK_INSTALL_NAME "${RELEASE_QGIS_BASE}"
!define INSTALLER_DISPLAYED_NAME "${COMPLETE_NAME}"
!define PACKAGE_FOLDER ".\QGIS-Release-Package"
!else if ${INSTALLER_TYPE} == "Release-NoGrass"
!define VERSION_NUMBER "${RELEASE_VERSION_NUMBER}"
!define VERSION_NAME "${RELEASE_VERSION_NAME}"
!define COMPLETE_NAME "${RELEASE_QGIS_BASE} ${RELEASE_VERSION_NUMBER}"
!define SVN_REVISION "${RELEASE_SVN_REVISION}"
!define BINARY_REVISION "${RELEASE_BINARY_REVISION}"
!define QGIS_BASE "${RELEASE_QGIS_BASE}"
!define INSTALLER_NAME "QGIS-${VERSION_NUMBER}-${BINARY_REVISION}-No-GrassSetup.exe"
!define DISPLAYED_NAME "${RELEASE_QGIS_BASE} ${VERSION_NUMBER}-${BINARY_REVISION}"
!define CHECK_INSTALL_NAME "${RELEASE_QGIS_BASE}"
!define INSTALLER_DISPLAYED_NAME "${COMPLETE_NAME}"
!define PACKAGE_FOLDER ".\QGIS-Release-Package-No-Grass"
!else if ${INSTALLER_TYPE} == "Development"
!define VERSION_NUMBER "${DEV_VERSION_NUMBER}"
!define VERSION_NAME "${DEV_VERSION_NAME}"
!define COMPLETE_NAME "${DEV_QGIS_BASE} ${DEV_VERSION_NUMBER} ${DEV_VERSION_NAME}"
!define SVN_REVISION "${DEV_SVN_REVISION}"
!define BINARY_REVISION "${DEV_BINARY_REVISION}"
!define QGIS_BASE "${DEV_QGIS_BASE}"
!define INSTALLER_NAME "QGIS-Dev-r${SVN_REVISION}-${BINARY_REVISION}-Setup.exe"
!define DISPLAYED_NAME "${DEV_QGIS_BASE} ${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
!define CHECK_INSTALL_NAME "${DEV_QGIS_BASE}"
!define INSTALLER_DISPLAYED_NAME "${DISPLAYED_NAME}"
!define PACKAGE_FOLDER ".\QGIS-Dev-Package"
!endif
;----------------------------------------------------------------------------------------------------------------------------
;Publisher variables
!define PUBLISHER "QGIS Development Team"
!define WEB_SITE "http://www.qgis.org"
!define WIKI_PAGE "http://wiki.qgis.org/qgiswiki"
;----------------------------------------------------------------------------------------------------------------------------
;General Definitions
;Name of the application shown during install
Name "${INSTALLER_DISPLAYED_NAME}"
;Name of the output file (installer executable)
OutFile "${INSTALLER_NAME}"
;Define installation folder
InstallDir "$PROGRAMFILES\${QGIS_BASE}"
;Request application privileges for Windows Vista
RequestExecutionLevel user
;Tell the installer to show Install and Uninstall details as default
ShowInstDetails show
ShowUnInstDetails show
;----------------------------------------------------------------------------------------------------------------------------
;.onInit Function (called when the installer is nearly finished initializing)
;Check if QGIS is already installed on the system and, if yes, what version and binary release;
;depending on that, select the install procedure:
;1. first installation = if QGIS is not already installed
;install QGIS asking for the install PATH
;2. upgrade installation = if an older release of QGIS is already installed
;call the uninstaller of the currently installed QGIS release
;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
;QGIS will be installed in the same PATH of the previous installation
;3. downgrade installation = if a newer release of QGIS is already installed
;call the uninstaller of the currently installed QGIS release
;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
;QGIS will be installed in the same PATH of the previous installation
;4. repair installation = if the same release of QGIS is already installed
;call the uninstaller of the currently installed QGIS release
;if the uninstall procedure succeeded, call the current installer asking for the install PATH
;the currently installed release of QGIS is defined by the variable $INSTALLED_VERSION = $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
Function .onInit
Var /GLOBAL ASK_FOR_PATH
StrCpy $ASK_FOR_PATH "YES"
Var /GLOBAL UNINSTALL_STRING
Var /GLOBAL INSTALL_PATH
Var /GLOBAL INSTALLED_VERSION_NUMBER
Var /GLOBAL INSTALLED_SVN_REVISION
Var /GLOBAL INSTALLED_BINARY_REVISION
Var /GLOBAL INSTALLED_VERSION
Var /GLOBAL DISPLAYED_INSTALLED_VERSION
Var /GLOBAL MESSAGE_0_
Var /GLOBAL MESSAGE_1_
Var /GLOBAL MESSAGE_2_
Var /GLOBAL MESSAGE_3_
ReadRegStr $UNINSTALL_STRING HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString"
ReadRegStr $INSTALL_PATH HKLM "Software\${QGIS_BASE}" "InstallPath"
ReadRegStr $INSTALLED_VERSION_NUMBER HKLM "Software\${QGIS_BASE}" "VersionNumber"
ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${QGIS_BASE}" "SvnRevision"
${If} $INSTALLED_SVN_REVISION == ""
ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${QGIS_BASE}" "Revision"
${EndIf}
ReadRegStr $INSTALLED_BINARY_REVISION HKLM "Software\${QGIS_BASE}" "BinaryRevision"
StrCpy $MESSAGE_0_ "${CHECK_INSTALL_NAME} is already installed on your system.$\r$\n"
StrCpy $MESSAGE_0_ "$MESSAGE_0_$\r$\n"
!if ${INSTALLER_TYPE} == "Release"
${If} $INSTALLED_BINARY_REVISION == ""
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER"
${Else}
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION"
${EndIf}
!else
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_SVN_REVISION-$INSTALLED_BINARY_REVISION"
!endif
StrCpy $MESSAGE_0_ "$MESSAGE_0_The installed release is $DISPLAYED_INSTALLED_VERSION$\r$\n"
StrCpy $MESSAGE_1_ "$MESSAGE_0_$\r$\n"
StrCpy $MESSAGE_1_ "$MESSAGE_1_You are going to install a newer release of ${CHECK_INSTALL_NAME}$\r$\n"
StrCpy $MESSAGE_1_ "$MESSAGE_1_$\r$\n"
StrCpy $MESSAGE_1_ "$MESSAGE_1_Press OK to uninstall Quantum GIS $DISPLAYED_INSTALLED_VERSION"
StrCpy $MESSAGE_1_ "$MESSAGE_1_ and install ${DISPLAYED_NAME} or Cancel to quit."
StrCpy $MESSAGE_2_ "$MESSAGE_0_$\r$\n"
StrCpy $MESSAGE_2_ "$MESSAGE_2_You are going to install an older release of ${CHECK_INSTALL_NAME}$\r$\n"
StrCpy $MESSAGE_2_ "$MESSAGE_2_$\r$\n"
StrCpy $MESSAGE_2_ "$MESSAGE_2_Press OK to uninstall Quantum GIS $DISPLAYED_INSTALLED_VERSION"
StrCpy $MESSAGE_2_ "$MESSAGE_2_ and install ${DISPLAYED_NAME} or Cancel to quit."
StrCpy $MESSAGE_3_ "$MESSAGE_0_$\r$\n"
StrCpy $MESSAGE_3_ "$MESSAGE_3_This is the latest release available.$\r$\n"
StrCpy $MESSAGE_3_ "$MESSAGE_3_$\r$\n"
StrCpy $MESSAGE_3_ "$MESSAGE_3_Press OK to reinstall ${DISPLAYED_NAME} or Cancel to quit."
IntOp $INSTALLED_SVN_REVISION $INSTALLED_SVN_REVISION * 1
IntOp $INSTALLED_BINARY_REVISION $INSTALLED_BINARY_REVISION * 1
IntOp $INSTALLED_VERSION $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
!define /math VERSION ${SVN_REVISION} + ${BINARY_REVISION}
${If} $INSTALLED_VERSION_NUMBER == ""
${Else}
${If} $INSTALLED_VERSION < ${VERSION}
MessageBox MB_OKCANCEL "$MESSAGE_1_" IDOK upgrade IDCANCEL quit_upgrade
upgrade:
StrCpy $ASK_FOR_PATH "NO"
ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
Goto continue_upgrade
quit_upgrade:
Abort
continue_upgrade:
${ElseIf} $INSTALLED_VERSION > ${VERSION}
MessageBox MB_OKCANCEL "$MESSAGE_2_" IDOK downgrade IDCANCEL quit_downgrade
downgrade:
StrCpy $ASK_FOR_PATH "NO"
ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
Goto continue_downgrade
quit_downgrade:
Abort
continue_downgrade:
${ElseIf} $INSTALLED_VERSION = ${VERSION}
MessageBox MB_OKCANCEL "$MESSAGE_3_" IDOK reinstall IDCANCEL quit_reinstall
reinstall:
ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
Goto continue_reinstall
quit_reinstall:
Abort
continue_reinstall:
${EndIf}
${EndIf}
${If} $INSTALLED_VERSION_NUMBER == ""
${Else}
${If} $0 = 0
${Else}
Abort
${EndIf}
${EndIf}
FunctionEnd
;----------------------------------------------------------------------------------------------------------------------------
;CheckUpdate Function
;Check if to show the MUI_PAGE_DIRECTORY during the installation (to ask for the install PATH)
Function CheckUpdate
${If} $ASK_FOR_PATH == "NO"
Abort
${EndIf}
FunctionEnd
;----------------------------------------------------------------------------------------------------------------------------
;Interface Settings
!define MUI_ABORTWARNING
!define MUI_ICON ".\Installer-Files\Install_QGIS.ico"
!define MUI_UNICON ".\Installer-Files\Uninstall_QGIS.ico"
!define MUI_HEADERIMAGE_BITMAP_NOSTETCH ".\Installer-Files\InstallHeaderImage.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH ".\Installer-Files\UnInstallHeaderImage.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\Installer-Files\WelcomeFinishPage.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\Installer-Files\UnWelcomeFinishPage.bmp"
;----------------------------------------------------------------------------------------------------------------------------
;Installer Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ".\Installer-Files\LICENSE.txt"
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckUpdate
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;----------------------------------------------------------------------------------------------------------------------------
; Language files
!insertmacro MUI_LANGUAGE "English"
;----------------------------------------------------------------------------------------------------------------------------
;Installer Sections
;Declares the variables for optional Sample Data Sections
Var /GLOBAL HTTP_PATH
Var /GLOBAL ARCHIVE_NAME
Var /GLOBAL EXTENDED_ARCHIVE_NAME
Var /GLOBAL ORIGINAL_UNTAR_FOLDER
Var /GLOBAL CUSTOM_UNTAR_FOLDER
Var /GLOBAL ARCHIVE_SIZE_KB
Var /GLOBAL ARCHIVE_SIZE_MB
Var /GLOBAL DOWNLOAD_MESSAGE_
Section "Quantum GIS" SecQGIS
SectionIn RO
;Added by Tim to set the reg key so we get default toolbar layout
!include ui.nsh
;Added by Tim to set the reg key so we get default plugin loading
!include plugins.nsh
;Added by Tim to set the reg key so we get default python & py plugins
!include python_plugins.nsh
;Set the INSTALL_DIR variable
Var /GLOBAL INSTALL_DIR
${If} $ASK_FOR_PATH == "NO"
StrCpy $INSTALL_DIR "$INSTALL_PATH"
${Else}
StrCpy $INSTALL_DIR "$INSTDIR"
${EndIf}
;Set to try to overwrite existing files
SetOverwrite try
;Set the GIS_DATABASE directory
SetShellVarContext current
Var /GLOBAL GIS_DATABASE
StrCpy $GIS_DATABASE "$DOCUMENTS\GIS DataBase"
;Create the GIS_DATABASE directory
CreateDirectory "$GIS_DATABASE"
;add Installer files
SetOutPath "$INSTALL_DIR\icons"
File .\Installer-Files\QGIS.ico
File .\Installer-Files\QGIS_Web.ico
SetOutPath "$INSTALL_DIR"
File .\Installer-Files\QGIS-WebSite.url
;add Quantum GIS files
SetOutPath "$INSTALL_DIR"
File /r ${PACKAGE_FOLDER}\*.*
;Create the Uninstaller
WriteUninstaller "$INSTALL_DIR\Uninstall-QGIS.exe"
;Registry Key Entries
;HKEY_LOCAL_MACHINE Install entries
;Set the Name, Version and Revision of QGIS+ PublisherInfo + InstallPath
WriteRegStr HKLM "Software\${QGIS_BASE}" "Name" "${QGIS_BASE}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "VersionNumber" "${VERSION_NUMBER}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "VersionName" "${VERSION_NAME}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "SvnRevision" "${SVN_REVISION}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "BinaryRevision" "${BINARY_REVISION}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "Publisher" "${PUBLISHER}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "WebSite" "${WEB_SITE}"
WriteRegStr HKLM "Software\${QGIS_BASE}" "InstallPath" "$INSTALL_DIR"
;HKEY_LOCAL_MACHINE Uninstall entries
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayName" "${COMPLETE_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString" "$INSTALL_DIR\Uninstall-QGIS.exe"
!if ${INSTALLER_TYPE} == "Release"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}"\
"DisplayVersion" "${VERSION_NUMBER}-${BINARY_REVISION}"
!else
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}"\
"DisplayVersion" "${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
!endif
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayIcon" "$INSTALL_DIR\icons\QGIS.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "EstimatedSize" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "HelpLink" "${WIKI_PAGE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "URLInfoAbout" "${WEB_SITE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "Publisher" "${PUBLISHER}"
;Create the Desktop Shortcut
SetShellVarContext current
CreateShortCut "$DESKTOP\${QGIS_BASE}.lnk" "$INSTALL_DIR\bin\qgis.exe" ""\
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"
;Create the Windows Start Menu Shortcuts
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\${QGIS_BASE}"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\${QGIS_BASE}.lnk" "$INSTALL_DIR\bin\qgis.exe" ""\
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS Web Site.lnk" "$INSTALL_DIR\QGIS-WebSite.url" ""\
"$INSTALL_DIR\icons\QGIS_Web.ico" "" SW_SHOWNORMAL "" "Visit the Quantum GIS Web Site"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\Uninstall ${QGIS_BASE}.lnk" "$INSTALL_DIR\Uninstall-QGIS.exe" ""\
"$INSTALL_DIR\Uninstall-QGIS.exe" "" SW_SHOWNORMAL "" "Uninstall ${COMPLETE_NAME}"
SectionEnd
Function DownloadDataSet
IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME sample data set.$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to be downloaded.$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME will be copyed to:$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER.$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue or Cancel to skip the download and complete the ${QGIS_BASE}"
StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME data set.$\r$\n"
MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
download:
SetShellVarContext current
InitPluginsDir
NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
Pop $0
StrCmp $0 "success" download_ok download_failed
download_ok:
InitPluginsDir
untgz::extract "-d" "$GIS_DATABASE" "$TEMP\$ARCHIVE_NAME"
Pop $0
StrCmp $0 "success" untar_ok untar_failed
untar_ok:
Rename "$GIS_DATABASE\$ORIGINAL_UNTAR_FOLDER" "$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER"
Delete "$TEMP\$ARCHIVE_NAME"
Goto end
download_failed:
DetailPrint "$0" ;print error message to log
MessageBox MB_OK "Download Failed.$\r$\n${QGIS_BASE} will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
Goto end
cancel_download:
MessageBox MB_OK "Download Cancelled.$\r$\n${QGIS_BASE} will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
Goto end
untar_failed:
DetailPrint "$0" ;print error message to log
end:
FunctionEnd
Section /O "North Carolina Data Set" SecNorthCarolinaSDB
;Set the size (in KB) of the archive file
StrCpy $ARCHIVE_SIZE_KB 138629
;Set the size (in KB) of the unpacked archive file
AddSize 293314
StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
StrCpy $ARCHIVE_NAME "nc_spm_latest.tar.gz"
StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina"
StrCpy $ORIGINAL_UNTAR_FOLDER "nc_spm_08"
StrCpy $CUSTOM_UNTAR_FOLDER "North-Carolina"
Call DownloadDataSet
SectionEnd
Section /O "South Dakota (Spearfish) Data Set" SecSpearfishSDB
;Set the size (in KB) of the archive file
StrCpy $ARCHIVE_SIZE_KB 20803
;Set the size (in KB) of the unpacked archive file
AddSize 42171
StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
StrCpy $ARCHIVE_NAME "spearfish_grass60data-0.3.tar.gz"
StrCpy $EXTENDED_ARCHIVE_NAME "South Dakota (Spearfish)"
StrCpy $ORIGINAL_UNTAR_FOLDER "spearfish60"
StrCpy $CUSTOM_UNTAR_FOLDER "Spearfish60"
Call DownloadDataSet
SectionEnd
Section /O "Alaska Data Set" SecAlaskaSDB
;Set the size (in KB) of the archive file
StrCpy $ARCHIVE_SIZE_KB 10253
;Set the size (in KB) of the unpacked archive file
AddSize 33914
StrCpy $HTTP_PATH "http://download.osgeo.org/qgis/data"
StrCpy $ARCHIVE_NAME "qgis_sample_data.tar.gz"
StrCpy $EXTENDED_ARCHIVE_NAME "Alaska"
StrCpy $ORIGINAL_UNTAR_FOLDER "qgis_sample_data"
StrCpy $CUSTOM_UNTAR_FOLDER "Alaska"
Call DownloadDataSet
SectionEnd
;----------------------------------------------------------------------------------------------------------------------------
;Uninstaller Section
Section "Uninstall"
;remove files
Delete "$INSTDIR\Uninstall-QGIS.exe"
Delete "$INSTDIR\qgis.exe"
Delete "$INSTDIR\qgis_help.exe"
Delete "$INSTDIR\avcexport.exe"
Delete "$INSTDIR\avcimport.exe"
Delete "$INSTDIR\e00conv.exe"
Delete "$INSTDIR\gpsbabel.exe"
Delete "$INSTDIR\QGIS-WebSite.url"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.csv"
Delete "$INSTDIR\icons\QGIS.ico"
Delete "$INSTDIR\icons\QGIS_Web.ico"
Delete "$INSTDIR\MRSID_README.txt"
Delete "$INSTDIR\run.bat"
;remove folders
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\doc"
RMDir /r "$INSTDIR\grass"
RMDir /r "$INSTDIR\i18n"
RMDir /r "$INSTDIR\icons"
RMDir /r "$INSTDIR\images"
RMDir /r "$INSTDIR\include"
RMDir /r "$INSTDIR\lib"
RMDir /r "$INSTDIR\msys"
RMDir /r "$INSTDIR\plugins"
RMDir /r "$INSTDIR\python"
RMDir /r "$INSTDIR\resources"
RMDir /r "$INSTDIR\svg"
RMDir /r "$INSTDIR\themes"
RMDir /r "$INSTDIR\proj"
RMDir /r "$INSTDIR\epsg_csv"
;if empty, remove the install folder
RMDir "$INSTDIR"
;remove the Desktop ShortCut
SetShellVarContext current
Delete "$DESKTOP\${QGIS_BASE}.lnk"
;remove the Programs Start ShortCut
SetShellVarContext all
RMDir /r "$SMPROGRAMS\${QGIS_BASE}"
;remove the Registry Entries
DeleteRegKey HKLM "Software\${QGIS_BASE}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}"
SectionEnd
;----------------------------------------------------------------------------------------------------------------------------
;Installer Section Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecQGIS} "Install ${QGIS_BASE}"
!insertmacro MUI_DESCRIPTION_TEXT ${SecNorthCarolinaSDB} "Download and install the North Carolina sample data set"
!insertmacro MUI_DESCRIPTION_TEXT ${SecSpearfishSDB} "Download and install the South Dakota (Spearfish) sample data set"
!insertmacro MUI_DESCRIPTION_TEXT ${SecAlaskaSDB} "Download and install the Alaska sample database (shapefiles and TIFF data)"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;----------------------------------------------------------------------------------------------------------------------------