1;--------------------------------------------------------------------------
2;    QGIS-Installer.nsi - QGIS Installer for Windows
3;    ---------------------
4;    Date                 : September 2008
5;    Copyright            : (C) 2008 by Marco Pasetti
6;    Email                : marco dot pasetti at alice dot it
7;--------------------------------------------------------------------------
8;                                                                         #
9;   This program is free software; you can redistribute it and/or modify  #
10;   it under the terms of the GNU General Public License as published by  #
11;   the Free Software Foundation; either version 2 of the License, or     #
12;   (at your option) any later version.                                   #
13;                                                                         #
14;--------------------------------------------------------------------------
15
16;Extended for creatensis.pl by Jürgen E. Fischer <jef@norbit.de>
17
18;----------------------------------------------------------------------------------------------------------------------------
19
20; Added by Tim to get optimal compression
21SetCompressor /SOLID lzma
22
23; Added by Tim to allow privilege elevation in vista
24RequestExecutionLevel admin
25
26;----------------------------------------------------------------------------------------------------------------------------
27
28;NSIS Includes
29
30!include "x64.nsh"
31!include "MUI.nsh"
32!include "LogicLib.nsh"
33
34;----------------------------------------------------------------------------------------------------------------------------
35
36;Set the installer variables, depending on the selected version to build
37
38!addplugindir osgeo4w/untgz
39!addplugindir osgeo4w/nsis
40!addplugindir osgeo4w/inetc
41
42;----------------------------------------------------------------------------------------------------------------------------
43
44;Publisher variables
45
46!define PUBLISHER "QGIS Development Team"
47!define WEB_SITE "https://qgis.org"
48!define WIKI_PAGE "https://qgis.org/en/docs/"
49
50;----------------------------------------------------------------------------------------------------------------------------
51
52;General Definitions
53
54;Name of the application shown during install
55Name "${DISPLAYED_NAME}"
56
57;Name of the output file (installer executable)
58OutFile "${INSTALLER_NAME}"
59
60;Tell the installer to show Install and Uninstall details as default
61ShowInstDetails hide
62ShowUnInstDetails hide
63
64;----------------------------------------------------------------------------------------------------------------------------
65
66; .onInit Function (called when the installer is nearly finished initializing)
67
68; Check if QGIS is already installed on the system and, if yes, what version and binary release;
69; depending on that, select the install procedure:
70
71; 1. first installation = if QGIS is not already installed
72;    install QGIS asking for the install PATH
73
74; 2. upgrade installation = if an older release of QGIS is already installed
75;    call the uninstaller of the currently installed QGIS release
76;    if the uninstall procedure succeeded, call the current installer without asking for the install PATH
77;    QGIS will be installed in the same PATH of the previous installation
78
79; 3. downgrade installation = if a newer release of QGIS is already installed
80;    call the uninstaller of the currently installed QGIS release
81;    if the uninstall procedure succeeded, call the current installer without asking for the install PATH
82;    QGIS will be installed in the same PATH of the previous installation
83
84; 4. repair installation = if the same release of QGIS is already installed
85;    call the uninstaller of the currently installed QGIS release
86;    if the uninstall procedure succeeded, call the current installer asking for the install PATH
87
88Function .onInit
89!ifdef INNER
90	WriteUninstaller "${UNINSTALLERDEST}\uninstall.exe"
91	Quit
92!endif
93	${If} ${ARCH} == "x86_64"
94		${If} ${RunningX64}
95			DetailPrint "Installer running on 64-bit host"
96			; disable registry redirection (enable access to 64-bit portion of registry)
97			SetRegView 64
98			; change install dir
99			${If} $INSTDIR == ""
100			  StrCpy $INSTDIR "$PROGRAMFILES64\${QGIS_BASE}"
101			${EndIf}
102		${EndIf}
103	${EndIf}
104
105	${If} $INSTDIR == ""
106		StrCpy $INSTDIR "$PROGRAMFILES\${QGIS_BASE}"
107	${EndIf}
108
109	Var /GLOBAL ASK_FOR_PATH
110	StrCpy $ASK_FOR_PATH "YES"
111
112	Var /GLOBAL UNINSTALL_STRING
113	Var /GLOBAL INSTALL_PATH
114
115	Var /GLOBAL INSTALLED_VERSION_NUMBER
116	Var /GLOBAL INSTALLED_SVN_REVISION
117	Var /GLOBAL INSTALLED_BINARY_REVISION
118
119	Var /GLOBAL INSTALLED_VERSION_INT
120
121	Var /GLOBAL DISPLAYED_INSTALLED_VERSION
122
123	Var /GLOBAL MESSAGE_0_
124	Var /GLOBAL MESSAGE_1_
125	Var /GLOBAL MESSAGE_2_
126	Var /GLOBAL MESSAGE_3_
127
128	ReadRegStr $UNINSTALL_STRING HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString"
129	ReadRegStr $INSTALL_PATH HKLM "Software\${QGIS_BASE}" "InstallPath"
130	ReadRegStr $INSTALLED_VERSION_NUMBER HKLM "Software\${QGIS_BASE}" "VersionNumber"
131	ReadRegStr $INSTALLED_BINARY_REVISION HKLM "Software\${QGIS_BASE}" "BinaryRevision"
132
133	ReadRegStr $INSTALLED_VERSION_INT HKLM "Software\${QGIS_BASE}" "VersionInt"
134	${If} $INSTALLED_VERSION_INT == ""
135		# First using new scheme: 1080001
136		# Previous: SvnRevision 14615 + BinaryRevision 0
137		ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${QGIS_BASE}" "SvnRevision"
138		IntOp $INSTALLED_VERSION_INT $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
139	${EndIf}
140
141	StrCpy $MESSAGE_0_ "${QGIS_BASE} is already installed on your system.$\r$\n"
142	StrCpy $MESSAGE_0_ "$MESSAGE_0_$\r$\n"
143
144	${If} $INSTALLED_BINARY_REVISION == ""
145		StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER"
146	${Else}
147		StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION"
148	${EndIf}
149
150	StrCpy $MESSAGE_0_ "$MESSAGE_0_The installed release is $DISPLAYED_INSTALLED_VERSION$\r$\n"
151
152	StrCpy $MESSAGE_1_ "$MESSAGE_0_$\r$\n"
153	StrCpy $MESSAGE_1_ "$MESSAGE_1_You are going to install a newer release of ${QGIS_BASE}$\r$\n"
154	StrCpy $MESSAGE_1_ "$MESSAGE_1_$\r$\n"
155	StrCpy $MESSAGE_1_ "$MESSAGE_1_Press OK to uninstall QGIS $DISPLAYED_INSTALLED_VERSION"
156	StrCpy $MESSAGE_1_ "$MESSAGE_1_ and install ${DISPLAYED_NAME} or Cancel to quit."
157
158	StrCpy $MESSAGE_2_ "$MESSAGE_0_$\r$\n"
159	StrCpy $MESSAGE_2_ "$MESSAGE_2_You are going to install an older release of ${QGIS_BASE}$\r$\n"
160	StrCpy $MESSAGE_2_ "$MESSAGE_2_$\r$\n"
161	StrCpy $MESSAGE_2_ "$MESSAGE_2_Press OK to uninstall QGIS $DISPLAYED_INSTALLED_VERSION"
162	StrCpy $MESSAGE_2_ "$MESSAGE_2_ and install ${DISPLAYED_NAME} or Cancel to quit."
163
164	StrCpy $MESSAGE_3_ "$MESSAGE_0_$\r$\n"
165	StrCpy $MESSAGE_3_ "$MESSAGE_3_This is the latest release available.$\r$\n"
166	StrCpy $MESSAGE_3_ "$MESSAGE_3_$\r$\n"
167	StrCpy $MESSAGE_3_ "$MESSAGE_3_Press OK to reinstall ${DISPLAYED_NAME} or Cancel to quit."
168
169	${If} $INSTALLED_VERSION_INT = 0
170	${Else}
171		${If} $INSTALLED_VERSION_INT < ${VERSION_INT}
172			MessageBox MB_OKCANCEL "$MESSAGE_1_" IDOK upgrade IDCANCEL quit_upgrade
173			upgrade:
174				StrCpy $ASK_FOR_PATH "NO"
175				ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
176				Goto continue_upgrade
177			quit_upgrade:
178				Abort
179			continue_upgrade:
180		${ElseIf} $INSTALLED_VERSION_INT > ${VERSION_INT}
181			MessageBox MB_OKCANCEL "$MESSAGE_2_" IDOK downgrade IDCANCEL quit_downgrade
182			downgrade:
183				StrCpy $ASK_FOR_PATH "NO"
184				ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
185				Goto continue_downgrade
186			quit_downgrade:
187				Abort
188			continue_downgrade:
189		${ElseIf} $INSTALLED_VERSION_INT = ${VERSION_INT}
190			MessageBox MB_OKCANCEL "$MESSAGE_3_" IDOK reinstall IDCANCEL quit_reinstall
191			reinstall:
192				ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
193				Goto continue_reinstall
194			quit_reinstall:
195				Abort
196			continue_reinstall:
197		${EndIf}
198
199		${If} $0 = 0
200		${Else}
201			Abort
202		${EndIf}
203	${EndIf}
204FunctionEnd
205
206;----------------------------------------------------------------------------------------------------------------------------
207
208;CheckUpdate Function
209;Check if to show the MUI_PAGE_DIRECTORY during the installation (to ask for the install PATH)
210
211Function CheckUpdate
212
213	${If} $ASK_FOR_PATH == "NO"
214		Abort
215	${EndIf}
216
217FunctionEnd
218
219;----------------------------------------------------------------------------------------------------------------------------
220
221;Interface Settings
222
223!define MUI_ABORTWARNING
224!define MUI_ICON ".\Installer-Files\Install_QGIS.ico"
225!define MUI_UNICON ".\Installer-Files\Uninstall_QGIS.ico"
226!define MUI_HEADERIMAGE_BITMAP_NOSTETCH ".\Installer-Files\InstallHeaderImage.bmp"
227!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH ".\Installer-Files\UnInstallHeaderImage.bmp"
228!define MUI_WELCOMEFINISHPAGE_BITMAP ".\Installer-Files\WelcomeFinishPage.bmp"
229!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\Installer-Files\WelcomeFinishPage.bmp"
230
231;----------------------------------------------------------------------------------------------------------------------------
232
233;Installer Pages
234
235!define MUI_WELCOMEPAGE_TITLE_3LINES
236!insertmacro MUI_PAGE_WELCOME
237!insertmacro MUI_PAGE_LICENSE ${LICENSE_FILE}
238
239!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckUpdate
240!insertmacro MUI_PAGE_DIRECTORY
241
242!insertmacro MUI_PAGE_COMPONENTS
243!insertmacro MUI_PAGE_INSTFILES
244!define MUI_FINISHPAGE_TITLE_3LINES
245!insertmacro MUI_PAGE_FINISH
246
247!insertmacro MUI_UNPAGE_WELCOME
248!insertmacro MUI_UNPAGE_CONFIRM
249!insertmacro MUI_UNPAGE_INSTFILES
250!insertmacro MUI_UNPAGE_FINISH
251
252;----------------------------------------------------------------------------------------------------------------------------
253
254; Language files
255!insertmacro MUI_LANGUAGE "English"
256!insertmacro MUI_LANGUAGE "German"
257!insertmacro MUI_LANGUAGE "French"
258!insertmacro MUI_LANGUAGE "Russian"
259!insertmacro MUI_LANGUAGE "Japanese"
260!insertmacro MUI_LANGUAGE "Italian"
261!insertmacro MUI_LANGUAGE "Polish"
262!insertmacro MUI_LANGUAGE "Spanish"
263!insertmacro MUI_LANGUAGE "PortugueseBR"
264!insertmacro MUI_LANGUAGE "Portuguese"
265!insertmacro MUI_LANGUAGE "Czech"
266!insertmacro MUI_LANGUAGE "Croatian"
267!insertmacro MUI_LANGUAGE "Thai"
268!insertmacro MUI_LANGUAGE "Dutch"
269
270;----------------------------------------------------------------------------------------------------------------------------
271
272;Installer Sections
273
274;Declares the variables for optional Sample Data Sections
275Var /GLOBAL HTTP_PATH
276Var /GLOBAL ARCHIVE_NAME
277Var /GLOBAL EXTENDED_ARCHIVE_NAME
278Var /GLOBAL ORIGINAL_UNTAR_FOLDER
279Var /GLOBAL CUSTOM_UNTAR_FOLDER
280Var /GLOBAL ARCHIVE_SIZE_KB
281Var /GLOBAL ARCHIVE_SIZE_MB
282Var /GLOBAL DOWNLOAD_MESSAGE_
283
284!ifndef INNER
285Section "QGIS" SecQGIS
286	SectionIn RO
287
288        ;Added by Tim to set the reg key so we get default plugin loading
289        !include plugins.nsh
290        ;Added by Tim to set the reg key so we get default python & py plugins
291        !include python_plugins.nsh
292
293	;Set the INSTALL_DIR variable
294	Var /GLOBAL INSTALL_DIR
295
296	${If} $ASK_FOR_PATH == "NO"
297		StrCpy $INSTALL_DIR "$INSTALL_PATH"
298	${Else}
299		StrCpy $INSTALL_DIR "$INSTDIR"
300	${EndIf}
301
302	;Set to try to overwrite existing files
303	SetOverwrite try
304
305	;Set the GIS_DATABASE directory
306	SetShellVarContext current
307	Var /GLOBAL GIS_DATABASE
308	StrCpy $GIS_DATABASE "$DOCUMENTS\GIS DataBase"
309
310	;Create the GIS_DATABASE directory
311	CreateDirectory "$GIS_DATABASE"
312
313	;add Installer files
314	SetOutPath "$INSTALL_DIR\icons"
315	File .\Installer-Files\QGIS.ico
316	File .\Installer-Files\QGIS_Web.ico
317	SetOutPath "$INSTALL_DIR"
318	File .\Installer-Files\postinstall.bat
319	File .\Installer-Files\preremove.bat
320
321	;add QGIS files
322	SetOutPath "$INSTALL_DIR"
323	File /r ${PACKAGE_FOLDER}\*.*
324
325!ifndef INNER
326	SetOutPath $INSTDIR
327	File uninstall.exe
328!endif
329
330	;Registry Key Entries
331
332	;HKEY_LOCAL_MACHINE Install entries
333	;Set the Name, Version and Revision of QGIS+ PublisherInfo + InstallPath
334	WriteRegStr HKLM "Software\${QGIS_BASE}" "Name" "${QGIS_BASE}"
335	WriteRegStr HKLM "Software\${QGIS_BASE}" "VersionNumber" "${VERSION_NUMBER}"
336	WriteRegStr HKLM "Software\${QGIS_BASE}" "VersionName" "${VERSION_NAME}"
337	WriteRegStr HKLM "Software\${QGIS_BASE}" "VersionInt" "${VERSION_INT}"
338	WriteRegStr HKLM "Software\${QGIS_BASE}" "BinaryRevision" "${BINARY_REVISION}"
339	WriteRegStr HKLM "Software\${QGIS_BASE}" "Publisher" "${PUBLISHER}"
340	WriteRegStr HKLM "Software\${QGIS_BASE}" "WebSite" "${WEB_SITE}"
341	WriteRegStr HKLM "Software\${QGIS_BASE}" "InstallPath" "$INSTALL_DIR"
342
343	;HKEY_LOCAL_MACHINE Uninstall entries
344	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayName" "${DISPLAYED_NAME}"
345	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayVersion" "${VERSION_NUMBER}"
346	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString" "$INSTALL_DIR\uninstall.exe"
347	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "DisplayIcon" "$INSTALL_DIR\icons\QGIS.ico"
348	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "EstimatedSize" 1
349	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "HelpLink" "${WIKI_PAGE}"
350	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "URLInfoAbout" "${WEB_SITE}"
351	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "Publisher" "${PUBLISHER}"
352
353	;Create the Desktop Shortcut
354	SetShellVarContext current
355
356	;Create the Windows Start Menu Shortcuts
357	SetShellVarContext all
358
359	CreateDirectory "$SMPROGRAMS\${QGIS_BASE}"
360
361	GetFullPathName /SHORT $0 $INSTALL_DIR
362	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_ROOT", "$0").r0'
363	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_STARTMENU", "$SMPROGRAMS\${QGIS_BASE}").r0'
364	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_DESKTOP", "$DESKTOP\${QGIS_BASE}").r0'
365	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_MENU_LINKS", "1").r0'
366	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_DESKTOP_LINKS", "1").r0'
367
368	ReadEnvStr $0 COMSPEC
369	nsExec::ExecToLog '"$0" /c "$INSTALL_DIR\postinstall.bat"'
370
371	IfFileExists "$INSTALL_DIR\etc\reboot" RebootNecessary NoRebootNecessary
372
373RebootNecessary:
374	IfSilent FlagRebootNecessary
375	SetRebootFlag true
376	Return
377
378FlagRebootNecessary:
379	SetErrorLevel 3010 ; ERROR_SUCCESS_REBOOT_REQUIRED
380	Return
381
382NoRebootNecessary:
383	Return
384
385SectionEnd
386!endif
387
388Function DownloadDataSet
389
390	IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
391
392	StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME sample data set.$\r$\n"
393	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
394	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
395	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to be downloaded.$\r$\n"
396	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
397	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME will be copied to:$\r$\n"
398	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER.$\r$\n"
399	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
400	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue or Cancel to skip the download and complete the ${QGIS_BASE}"
401	StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME data set.$\r$\n"
402
403	MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
404
405	download:
406	SetShellVarContext current
407	InitPluginsDir
408	inetc::get /caption "$ARCHIVE_NAME" /canceltext "Cancel" "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME" /end
409	Pop $0 # return value = exit code, "OK" means OK
410	StrCmp $0 "OK" download_ok download_failed
411
412	download_ok:
413	InitPluginsDir
414	untgz::extract "-d" "$GIS_DATABASE" "$TEMP\$ARCHIVE_NAME"
415	Pop $0
416	StrCmp $0 "success" untar_ok untar_failed
417
418	untar_ok:
419	Rename "$GIS_DATABASE\$ORIGINAL_UNTAR_FOLDER" "$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER"
420	Delete "$TEMP\$ARCHIVE_NAME"
421	Goto end
422
423	download_failed:
424	DetailPrint "$0" ;print error message to log
425	MessageBox MB_OK "Download Failed.$\r$\n${QGIS_BASE} will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
426	Goto end
427
428	cancel_download:
429	MessageBox MB_OK "Download Canceled.$\r$\n${QGIS_BASE} will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
430	Goto end
431
432	untar_failed:
433	DetailPrint "$0" ;print error message to log
434
435	end:
436
437FunctionEnd
438
439Section /O "North Carolina Data Set" SecNorthCarolinaSDB
440
441	;Set the size (in KB)  of the archive file
442	StrCpy $ARCHIVE_SIZE_KB 138629
443
444	;Set the size (in KB) of the unpacked archive file
445	AddSize 293314
446
447	StrCpy $HTTP_PATH "https://grass.osgeo.org/sampledata"
448	StrCpy $ARCHIVE_NAME "nc_spm_latest.tar.gz"
449	StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina"
450	StrCpy $ORIGINAL_UNTAR_FOLDER "nc_spm_08"
451	StrCpy $CUSTOM_UNTAR_FOLDER "North-Carolina"
452
453	Call DownloadDataSet
454
455SectionEnd
456
457Section /O "South Dakota (Spearfish) Data Set" SecSpearfishSDB
458
459	;Set the size (in KB)  of the archive file
460	StrCpy $ARCHIVE_SIZE_KB 20803
461
462	;Set the size (in KB) of the unpacked archive file
463	AddSize 42171
464
465	StrCpy $HTTP_PATH "https://grass.osgeo.org/sampledata"
466	StrCpy $ARCHIVE_NAME "spearfish_grass60data-0.3.tar.gz"
467	StrCpy $EXTENDED_ARCHIVE_NAME "South Dakota (Spearfish)"
468	StrCpy $ORIGINAL_UNTAR_FOLDER "spearfish60"
469	StrCpy $CUSTOM_UNTAR_FOLDER "Spearfish60"
470
471	Call DownloadDataSet
472
473SectionEnd
474
475Section /O "Alaska Data Set" SecAlaskaSDB
476
477	;Set the size (in KB)  of the archive file
478	StrCpy $ARCHIVE_SIZE_KB 10253
479
480	;Set the size (in KB) of the unpacked archive file
481	AddSize 33914
482
483	StrCpy $HTTP_PATH "https://qgis.org/downloads/data"
484	StrCpy $ARCHIVE_NAME "qgis_sample_data.tar.gz"
485	StrCpy $EXTENDED_ARCHIVE_NAME "Alaska"
486	StrCpy $ORIGINAL_UNTAR_FOLDER "qgis_sample_data"
487	StrCpy $CUSTOM_UNTAR_FOLDER "Alaska"
488
489	Call DownloadDataSet
490
491SectionEnd
492
493;----------------------------------------------------------------------------------------------------------------------------
494
495;Uninstaller Section
496
497!ifdef INNER
498Section "Uninstall"
499	${If} ${ARCH} == "x86_64"
500		${If} ${RunningX64}
501			DetailPrint "Installer running on 64-bit host"
502			; disable registry redirection (enable access to 64-bit portion of registry)
503			SetRegView 64
504		${EndIf}
505	${EndIf}
506
507	GetFullPathName /SHORT $0 $INSTDIR
508	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_ROOT", "$0").r0'
509	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_STARTMENU", "$SMPROGRAMS\${QGIS_BASE}").r0'
510	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_DESKTOP", "$DESKTOP\${QGIS_BASE}").r0'
511	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_MENU_LINKS", "1").r0'
512	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_DESKTOP_LINKS", "1").r0'
513
514	ReadEnvStr $0 COMSPEC
515	nsExec::ExecToLog '"$0" /c "$INSTDIR\preremove.bat"'
516
517	Delete "$INSTDIR\uninstall.exe"
518	Delete "$INSTDIR\*.bat.done"
519	Delete "$INSTDIR\*.log"
520	Delete "$INSTDIR\*.txt"
521	Delete "$INSTDIR\*.ico"
522	Delete "$INSTDIR\*.bat"
523	Delete "$INSTDIR\*.dll"
524
525	RMDir /r "$INSTDIR\bin"
526	RMDir /r "$INSTDIR\apps"
527	RMDir /r "$INSTDIR\etc"
528	RMDir /r "$INSTDIR\include"
529	RMDir /r "$INSTDIR\lib"
530	RMDir /r "$INSTDIR\share"
531	RMDir /r "$INSTDIR\icons"
532	RMDir /r "$INSTDIR\src"
533	RMDir /r "$INSTDIR\contrib"
534	RMDir /r "$INSTDIR\manifest"
535	RMDir /r "$INSTDIR\man"
536
537	;if empty, remove the install folder
538	RMDir "$INSTDIR"
539
540	;remove the Desktop ShortCut
541	SetShellVarContext all
542	Delete "$DESKTOP\${QGIS_BASE}\QGIS Desktop (${VERSION_NUMBER}).lnk"
543	Delete "$DESKTOP\${QGIS_BASE}\QGIS Browser (${VERSION_NUMBER}).lnk"
544	Delete "$DESKTOP\${QGIS_BASE}\OSGeo4W.lnk"
545	RmDir "$DESKTOP\${QGIS_BASE}"
546
547	;remove the Programs Start ShortCut
548	SetShellVarContext all
549	RMDir /r "$SMPROGRAMS\${QGIS_BASE}"
550
551	;remove the Registry Entries
552	DeleteRegKey HKLM "Software\${QGIS_BASE}"
553	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}"
554SectionEnd
555!endif
556
557;----------------------------------------------------------------------------------------------------------------------------
558
559!ifndef INNER
560;Installer Section Descriptions
561!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
562	!insertmacro MUI_DESCRIPTION_TEXT ${SecQGIS} "Install ${QGIS_BASE}"
563	!insertmacro MUI_DESCRIPTION_TEXT ${SecNorthCarolinaSDB} "Download and install the North Carolina sample data set"
564	!insertmacro MUI_DESCRIPTION_TEXT ${SecSpearfishSDB} "Download and install the South Dakota (Spearfish) sample data set"
565	!insertmacro MUI_DESCRIPTION_TEXT ${SecAlaskaSDB} "Download and install the Alaska sample database (shapefiles and TIFF data)"
566!insertmacro MUI_FUNCTION_DESCRIPTION_END
567!endif
568
569;----------------------------------------------------------------------------------------------------------------------------
570