Skip to content

Commit 1ee65ba

Browse files
author
marcopx
committedSep 13, 2008
Added new MS-Windows installer script
git-svn-id: http://svn.osgeo.org/qgis/trunk@9315 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d03d7a0 commit 1ee65ba

File tree

1 file changed

+564
-0
lines changed

1 file changed

+564
-0
lines changed
 

‎ms-windows/QGIS-Installer.nsi

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

0 commit comments

Comments
 (0)
Please sign in to comment.