source: grass/branches/releasebranch_7_0/mswindows/GRASS-Installer.nsi.tmpl

Last change on this file was 70128, checked in by martinl, 8 years ago

wingrass: attempt to fix standalone installer to download and execute vcredist (fix #2996)

(relbr70: merge 70106, 70110, 70113, 70114, 70123 from trunk)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 40.2 KB
Line 
1;----------------------------------------------------------------------------------------------------------------------------
2
3;GRASS GIS Installer for Windows
4;Written by Marco Pasetti
5;Updated for OSGeo4W by Colin Nielsen, Helmut Kudrnovsky, and Martin Landa
6;Last Update: $Id: GRASS-Installer.nsi.tmpl 70128 2016-12-24 17:19:12Z martinl $
7;Mail to: grass-dev@lists.osgeo.org
8
9;----------------------------------------------------------------------------------------------------------------------------
10
11;Select if you are building a "Development Version" (Devel) or a "Release Version" (Release) of the GRASS Installer
12
13!define INSTALLER_TYPE "Devel"
14
15;----------------------------------------------------------------------------------------------------------------------------
16;set compression configuration
17
18SetCompressor /SOLID lzma
19SetCompressorDictSize 128
20
21;----------------------------------------------------------------------------------------------------------------------------
22
23;Version variables
24
25!if "@GRASS_VERSION_SVN@" == ""
26 !define SVN_REVISION "0"
27!else
28 !define SVN_REVISION "@GRASS_VERSION_SVN@"
29!endif
30!define BINARY_REVISION "1"
31!define VERSION_NUMBER "@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@"
32!define GRASS_BASE "GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@"
33!if ${INSTALLER_TYPE} == "Release"
34 !define GRASS_COMMAND "grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@"
35!else
36 !define GRASS_COMMAND "grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@svn"
37!endif
38
39;----------------------------------------------------------------------------------------------------------------------------
40
41;Define Platform and installation folder
42
43;----------------------------------------------------------------------------------------------------------------------------
44
45!if "@ARCH@" == "x86_64-w64-mingw32"
46 !define PLATFORM "x86_64"
47 InstallDir "$PROGRAMFILES64\${GRASS_BASE}"
48!else
49 !define PLATFORM "x86"
50 InstallDir "$PROGRAMFILES32\${GRASS_BASE}"
51!endif
52
53;----------------------------------------------------------------------------------------------------------------------------
54
55;Don't modify the following lines
56
57;----------------------------------------------------------------------------------------------------------------------------
58
59;NSIS Includes
60
61!include "MUI2.nsh"
62!include "LogicLib.nsh"
63!include "Sections.nsh"
64
65;----------------------------------------------------------------------------------------------------------------------------
66
67;Set the installer variables, depending on the selected version to build
68
69!define PACKAGE_FOLDER ".\GRASS-@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@-Package"
70!if ${INSTALLER_TYPE} == "Release"
71 !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-${BINARY_REVISION}-Setup-${PLATFORM}.exe"
72 !define DISPLAYED_NAME "GRASS GIS ${VERSION_NUMBER}-${BINARY_REVISION} (${PLATFORM})"
73 !define CHECK_INSTALL_NAME "GRASS GIS @GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@"
74!else
75 !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}-Setup-${PLATFORM}.exe"
76 !define DISPLAYED_NAME "GRASS GIS ${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION} (${PLATFORM})"
77 !define CHECK_INSTALL_NAME "GRASS GIS @GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@ SVN"
78!endif
79
80;Define the source path of the demolocation files
81
82!define DEMOLOCATION_PATH "${PACKAGE_FOLDER}\demolocation"
83
84;----------------------------------------------------------------------------------------------------------------------------
85
86;Publisher variables
87
88!define PUBLISHER "GRASS Development Team"
89!define WEB_SITE "http://grass.osgeo.org"
90!define WIKI_PAGE "http://grass.osgeo.org/wiki"
91
92;----------------------------------------------------------------------------------------------------------------------------
93
94;General Definitions
95
96;Name of the application shown during install
97Name "${DISPLAYED_NAME}"
98
99;Name of the output file (installer executable)
100OutFile "${INSTALLER_NAME}"
101
102;Request application privileges for Windows
103RequestExecutionLevel admin
104
105;Tell the installer to hide Install and Uninstall details as default
106ShowInstDetails hide
107ShowUnInstDetails hide
108
109;----------------------------------------------------------------------------------------------------------------------------
110
111;StrReplace Function
112;Replaces all ocurrences of a given needle within a haystack with another string
113;Written by dandaman32
114
115Var STR_REPLACE_VAR_0
116Var STR_REPLACE_VAR_1
117Var STR_REPLACE_VAR_2
118Var STR_REPLACE_VAR_3
119Var STR_REPLACE_VAR_4
120Var STR_REPLACE_VAR_5
121Var STR_REPLACE_VAR_6
122Var STR_REPLACE_VAR_7
123Var STR_REPLACE_VAR_8
124
125Function StrReplace
126 Exch $STR_REPLACE_VAR_2
127 Exch 1
128 Exch $STR_REPLACE_VAR_1
129 Exch 2
130 Exch $STR_REPLACE_VAR_0
131 StrCpy $STR_REPLACE_VAR_3 -1
132 StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
133 StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
134 loop:
135 IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
136 StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
137 StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
138 StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
139 Goto loop
140 found:
141 StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
142 IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
143 StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
144 StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
145 StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
146 Goto loop
147 done:
148 Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
149 Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
150 Exch $STR_REPLACE_VAR_0
151FunctionEnd
152
153!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
154 Push "${HAYSTACK}"
155 Push "${NEEDLE}"
156 Push "${NEEDLE2}"
157 Call StrReplace
158 Pop "${OUT}"
159!macroend
160
161!define StrReplace '!insertmacro "_strReplaceConstructor"'
162
163;----------------------------------------------------------------------------------------------------------------------------
164
165;.onInit Function (called when the installer is nearly finished initializing)
166
167;Check if GRASS is already installed on the system and, if yes, what version and binary release;
168;depending on that, select the install procedure:
169
170;1. first installation = if GRASS is not already installed
171;install GRASS asking for the install PATH
172
173;2. upgrade installation = if an older release of GRASS is already installed
174;call the uninstaller of the currently installed GRASS release
175;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
176;GRASS will be installed in the same PATH of the previous installation
177
178;3. downgrade installation = if a newer release of GRASS is already installed
179;call the uninstaller of the currently installed GRASS release
180;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
181;GRASS will be installed in the same PATH of the previous installation
182
183;4. repair installation = if the same release of GRASS is already installed
184;call the uninstaller of the currently installed GRASS release
185;if the uninstall procedure succeeded, call the current installer asking for the install PATH
186
187;the currently installed release of GRASS is defined by the variable $INSTALLED_VERSION = $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
188
189Function .onInit
190
191 Var /GLOBAL ASK_FOR_PATH
192 StrCpy $ASK_FOR_PATH "YES"
193
194 Var /GLOBAL UNINSTALL_STRING
195 Var /GLOBAL INSTALL_PATH
196
197 Var /GLOBAL INSTALLED_VERSION_NUMBER
198 Var /GLOBAL INSTALLED_SVN_REVISION
199 Var /GLOBAL INSTALLED_BINARY_REVISION
200
201 Var /GLOBAL INSTALLED_VERSION
202
203 Var /GLOBAL DISPLAYED_INSTALLED_VERSION
204
205 Var /GLOBAL MESSAGE_0_
206 Var /GLOBAL MESSAGE_1_
207 Var /GLOBAL MESSAGE_2_
208 Var /GLOBAL MESSAGE_3_
209
210 ReadRegStr $UNINSTALL_STRING HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString"
211 ReadRegStr $INSTALL_PATH HKLM "Software\${GRASS_BASE}" "InstallPath"
212 ReadRegStr $INSTALLED_VERSION_NUMBER HKLM "Software\${GRASS_BASE}" "VersionNumber"
213 ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${GRASS_BASE}" "SvnRevision"
214
215 ${If} $INSTALLED_SVN_REVISION == ""
216 ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${GRASS_BASE}" "Revision"
217 ${EndIf}
218
219 ReadRegStr $INSTALLED_BINARY_REVISION HKLM "Software\${GRASS_BASE}" "BinaryRevision"
220
221 StrCpy $MESSAGE_0_ "${CHECK_INSTALL_NAME} is already installed on your system.$\r$\n"
222 StrCpy $MESSAGE_0_ "$MESSAGE_0_$\r$\n"
223
224 !if ${INSTALLER_TYPE} == "Release"
225 ${If} $INSTALLED_BINARY_REVISION == ""
226 StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER"
227 ${Else}
228 StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION"
229 ${EndIf}
230 !else
231 StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_SVN_REVISION-$INSTALLED_BINARY_REVISION"
232 !endif
233
234 StrCpy $MESSAGE_0_ "$MESSAGE_0_The installed release is $DISPLAYED_INSTALLED_VERSION$\r$\n"
235
236 StrCpy $MESSAGE_1_ "$MESSAGE_0_$\r$\n"
237 StrCpy $MESSAGE_1_ "$MESSAGE_1_You are going to install a newer release of ${CHECK_INSTALL_NAME}$\r$\n"
238 StrCpy $MESSAGE_1_ "$MESSAGE_1_$\r$\n"
239 StrCpy $MESSAGE_1_ "$MESSAGE_1_Press OK to uninstall GRASS $DISPLAYED_INSTALLED_VERSION"
240 StrCpy $MESSAGE_1_ "$MESSAGE_1_ and install ${DISPLAYED_NAME} or Cancel to quit."
241
242 StrCpy $MESSAGE_2_ "$MESSAGE_0_$\r$\n"
243 StrCpy $MESSAGE_2_ "$MESSAGE_2_You are going to install an older release of ${CHECK_INSTALL_NAME}$\r$\n"
244 StrCpy $MESSAGE_2_ "$MESSAGE_2_$\r$\n"
245 StrCpy $MESSAGE_2_ "$MESSAGE_2_Press OK to uninstall GRASS $DISPLAYED_INSTALLED_VERSION"
246 StrCpy $MESSAGE_2_ "$MESSAGE_2_ and install ${DISPLAYED_NAME} or Cancel to quit."
247
248 StrCpy $MESSAGE_3_ "$MESSAGE_0_$\r$\n"
249 StrCpy $MESSAGE_3_ "$MESSAGE_3_This is the latest release available.$\r$\n"
250 StrCpy $MESSAGE_3_ "$MESSAGE_3_$\r$\n"
251 StrCpy $MESSAGE_3_ "$MESSAGE_3_Press OK to reinstall ${DISPLAYED_NAME} or Cancel to quit."
252
253 IntOp $INSTALLED_SVN_REVISION $INSTALLED_SVN_REVISION * 1
254 IntOp $INSTALLED_BINARY_REVISION $INSTALLED_BINARY_REVISION * 1
255 IntOp $INSTALLED_VERSION $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
256
257 !define /math VERSION ${SVN_REVISION} + ${BINARY_REVISION}
258
259 ${If} $INSTALLED_VERSION_NUMBER == ""
260 ${Else}
261 ${If} $INSTALLED_VERSION < ${VERSION}
262 MessageBox MB_OKCANCEL "$MESSAGE_1_" IDOK upgrade IDCANCEL quit_upgrade
263 upgrade:
264 StrCpy $ASK_FOR_PATH "NO"
265 ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
266 Goto continue_upgrade
267 quit_upgrade:
268 Abort
269 continue_upgrade:
270 ${ElseIf} $INSTALLED_VERSION > ${VERSION}
271 MessageBox MB_OKCANCEL "$MESSAGE_2_" IDOK downgrade IDCANCEL quit_downgrade
272 downgrade:
273 StrCpy $ASK_FOR_PATH "NO"
274 ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
275 Goto continue_downgrade
276 quit_downgrade:
277 Abort
278 continue_downgrade:
279 ${ElseIf} $INSTALLED_VERSION = ${VERSION}
280 MessageBox MB_OKCANCEL "$MESSAGE_3_" IDOK reinstall IDCANCEL quit_reinstall
281 reinstall:
282 ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
283 Goto continue_reinstall
284 quit_reinstall:
285 Abort
286 continue_reinstall:
287 ${EndIf}
288 ${EndIf}
289
290 ${If} $INSTALLED_VERSION_NUMBER == ""
291 ${Else}
292 ${If} $0 = 0
293 ${Else}
294 Abort
295 ${EndIf}
296 ${EndIf}
297
298FunctionEnd
299
300;----------------------------------------------------------------------------------------------------------------------------
301
302;CheckUpdate Function
303;Check if to show the MUI_PAGE_DIRECTORY during the installation (to ask for the install PATH)
304
305Function CheckUpdate
306
307 ${If} $ASK_FOR_PATH == "NO"
308 Abort
309 ${EndIf}
310
311FunctionEnd
312
313;----------------------------------------------------------------------------------------------------------------------------
314
315;CheckInstDir Function
316;this is commented out, because the installation path should be in $PROGRAMFILES
317;Check if GRASS is going to be installed in a directory containing spaces
318;if yes, show a warning message
319
320;Function CheckInstDir
321; Var /GLOBAL INSTDIR_TEST
322; Var /GLOBAL INSTDIR_LENGTH
323; Var /GLOBAL INSTDIR_TEST_LENGTH
324; Var /GLOBAL MESSAGE_CHKINST_
325;
326; StrCpy $MESSAGE_CHKINST_ "WARNING: you are about to install GRASS into a directory that has spaces$\r$\n"
327; StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_in either its name or the path of directories leading up to it.$\r$\n"
328; StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_Some functionalities of GRASS might be hampered by this. We would highly$\r$\n"
329; StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_appreciate if you tried and reported any problems, so that we can fix them.$\r$\n"
330; StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_However, if you want to avoid any such issues, we recommend that you$\r$\n"
331; StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_choose a simple installation path without spaces, such as: C:\${GRASS_BASE}.$\r$\n"
332;
333; ${StrReplace} "$INSTDIR_TEST" " " "" "$INSTDIR"
334;
335; StrLen $INSTDIR_LENGTH "$INSTDIR"
336; StrLen $INSTDIR_TEST_LENGTH "$INSTDIR_TEST"
337;
338; ${If} $INSTDIR_TEST_LENGTH < $INSTDIR_LENGTH
339; MessageBox MB_OK|MB_ICONEXCLAMATION "$MESSAGE_CHKINST_"
340; ${EndIf}
341;
342;FunctionEnd
343
344;----------------------------------------------------------------------------------------------------------------------------
345;ReplaceLineString Function
346;Replace String in an existing file
347; code taken from http://nsis.sourceforge.net/Replace_line_that_starts_with_specified_string
348
349Function ReplaceLineStr
350 Exch $R0 ; string to replace that whole line with
351 Exch
352 Exch $R1 ; string that line should start with
353 Exch
354 Exch 2
355 Exch $R2 ; file
356 Push $R3 ; file handle
357 Push $R4 ; temp file
358 Push $R5 ; temp file handle
359 Push $R6 ; global
360 Push $R7 ; input string length
361 Push $R8 ; line string length
362 Push $R9 ; global
363
364 StrLen $R7 $R1
365
366 GetTempFileName $R4
367
368 FileOpen $R5 $R4 w
369 FileOpen $R3 $R2 r
370
371 ReadLoop:
372 ClearErrors
373 FileRead $R3 $R6
374 IfErrors Done
375
376 StrLen $R8 $R6
377 StrCpy $R9 $R6 $R7 -$R8
378 StrCmp $R9 $R1 0 +3
379
380 FileWrite $R5 "$R0$\r$\n"
381 Goto ReadLoop
382
383 FileWrite $R5 $R6
384 Goto ReadLoop
385
386 Done:
387
388 FileClose $R3
389 FileClose $R5
390
391 SetDetailsPrint none
392 Delete $R2
393 Rename $R4 $R2
394 SetDetailsPrint both
395
396 Pop $R9
397 Pop $R8
398 Pop $R7
399 Pop $R6
400 Pop $R5
401 Pop $R4
402 Pop $R3
403 Pop $R2
404 Pop $R1
405 Pop $R0
406FunctionEnd
407
408;----------------------------------------------------------------------------------------------------------------------------
409
410;Interface Settings
411
412!define MUI_ABORTWARNING
413!define MUI_ICON ".\Installer-Files\Install_GRASS.ico"
414!define MUI_UNICON ".\Installer-Files\Uninstall_GRASS.ico"
415!define MUI_HEADERIMAGE_BITMAP_NOSTETCH ".\Installer-Files\InstallHeaderImage.bmp"
416!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH ".\Installer-Files\UnInstallHeaderImage.bmp"
417!define MUI_WELCOMEFINISHPAGE_BITMAP ".\Installer-Files\WelcomeFinishPage.bmp"
418!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\Installer-Files\UnWelcomeFinishPage.bmp"
419
420;----------------------------------------------------------------------------------------------------------------------------
421
422;Installer Pages
423
424!insertmacro MUI_PAGE_WELCOME
425
426;These indented statements modify settings for MUI_PAGE_LICENSE
427; (with thanks to Ubuntu)
428 !define MUI_LICENSEPAGE_TEXT_BOTTOM "GRASS is software libre. You are encouraged and legally \
429 entitled to copy, reinstall, modify, and redistribute this program \
430 for yourself and your friends under the terms of the GPL. Happy \
431 mapping!"
432 !define MUI_LICENSEPAGE_BUTTON "Next >"
433!insertmacro MUI_PAGE_LICENSE "${PACKAGE_FOLDER}\GPL.TXT"
434
435!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckUpdate
436!insertmacro MUI_PAGE_DIRECTORY
437
438;Page custom CheckInstDir
439
440!insertmacro MUI_PAGE_COMPONENTS
441!insertmacro MUI_PAGE_INSTFILES
442
443;These indented statements modify settings for MUI_PAGE_FINISH
444 !define MUI_FINISHPAGE_NOAUTOCLOSE
445 !define MUI_FINISHPAGE_RUN
446 !define MUI_FINISHPAGE_RUN_NOTCHECKED
447 !define MUI_FINISHPAGE_RUN_TEXT "Launch GRASS GIS"
448 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchGrass"
449 !define MUI_FINISHPAGE_SHOWREADME
450 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
451 !define MUI_FINISHPAGE_SHOWREADME_TEXT "View the reference manual"
452 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "ViewReadme"
453!insertmacro MUI_PAGE_FINISH
454
455!insertmacro MUI_UNPAGE_WELCOME
456!insertmacro MUI_UNPAGE_CONFIRM
457!insertmacro MUI_UNPAGE_INSTFILES
458!insertmacro MUI_UNPAGE_FINISH
459
460;----------------------------------------------------------------------------------------------------------------------------
461
462;Language files
463
464!insertmacro MUI_LANGUAGE "English"
465
466;----------------------------------------------------------------------------------------------------------------------------
467
468;launch Grass Gis by exit the installation wizard
469
470Function LaunchGrass
471
472 ExecShell "" "$DESKTOP\${GRASS_BASE}.lnk"
473
474FunctionEnd
475
476;----------------------------------------------------------------------------------------------------------------------------
477
478;launch reference manual by exit the installation wizard
479
480Function ViewReadme
481
482 ExecShell "open" "$INSTDIR\docs\html\index.html"
483
484FunctionEnd
485
486;----------------------------------------------------------------------------------------------------------------------------
487
488;Installer Sections
489
490;Declares the variables for optional Sample Data Sections
491Var /GLOBAL HTTP_PATH
492Var /GLOBAL ARCHIVE_NAME
493;Var /GLOBAL ARCHIVE_NAME2005
494Var /GLOBAL ARCHIVE_NAME2008
495Var /GLOBAL ARCHIVE_NAME2010
496!if ${PLATFORM} == "x86_64"
497 Var /GLOBAL ARCHIVE_NAME2012
498!endif
499Var /GLOBAL ARCHIVE_NAME2013
500Var /GLOBAL EXTENDED_ARCHIVE_NAME
501Var /GLOBAL ORIGINAL_UNTAR_FOLDER
502Var /GLOBAL CUSTOM_UNTAR_FOLDER
503Var /GLOBAL ARCHIVE_SIZE_KB
504Var /GLOBAL ARCHIVE_SIZE_MB
505Var /GLOBAL DOWNLOAD_MESSAGE_
506
507Section "GRASS" SecGRASS
508
509 SectionIn RO
510
511 ;Set the INSTALL_DIR variable
512 Var /GLOBAL INSTALL_DIR
513
514 ${If} $ASK_FOR_PATH == "NO"
515 StrCpy $INSTALL_DIR "$INSTALL_PATH"
516 ${Else}
517 StrCpy $INSTALL_DIR "$INSTDIR"
518 ${EndIf}
519
520 ;Set to try to overwrite existing files
521 SetOverwrite try
522
523 ;Set the GIS_DATABASE directory
524 SetShellVarContext current
525 Var /GLOBAL GIS_DATABASE
526 StrCpy $GIS_DATABASE "$DOCUMENTS\grassdata"
527
528 ;Create the GIS_DATABASE directory
529 CreateDirectory "$GIS_DATABASE"
530
531 ;add Installer files
532 SetOutPath "$INSTALL_DIR"
533 File .\Installer-Files\GRASS-WebSite.url
534 File .\Installer-Files\WinGRASS-README.url
535
536 ;add GRASS files
537 SetOutPath "$INSTALL_DIR"
538 File /r ${PACKAGE_FOLDER}\*.*
539
540 ;grant $INSTDIR\etc read write accessible and show if succeeded: error if it failed
541 AccessControl::GrantOnFile "$INSTDIR\etc" "(S-1-5-32-545)" "FullAccess"
542 Pop $R0
543 DetailPrint $R0
544 ;grant modifying/overwriting fontcap file and show if succeeded: error if it failed
545 AccessControl::GrantOnFile "$INSTDIR\etc\fontcap" "(S-1-5-32-545)" "FullAccess"
546 Pop $R0
547 DetailPrint $R0
548
549 ;create run_gmkfontcap.bat
550 ClearErrors
551 FileOpen $0 $INSTALL_DIR\etc\run_gmkfontcap.bat w
552 IfErrors done_create_run_gmkfontcap.bat
553 FileWrite $0 '@echo off$\r$\n'
554 FileWrite $0 'rem #########################################################################$\r$\n'
555 FileWrite $0 'rem #$\r$\n'
556 FileWrite $0 'rem # Run g.mkfontcap outside a grass session during installation$\r$\n'
557 FileWrite $0 'rem #$\r$\n'
558 FileWrite $0 'rem #########################################################################$\r$\n'
559 FileWrite $0 'echo Setup of WinGRASS-${VERSION_NUMBER}$\r$\n'
560 FileWrite $0 'echo Generating the font configuration file by scanning various directories for fonts.$\r$\n'
561 FileWrite $0 'echo Please wait. Console window will close automatically ....$\r$\n'
562 FileWrite $0 '$\r$\n'
563 FileWrite $0 'rem set gisbase$\r$\n'
564 FileWrite $0 'set GISBASE=$INSTALL_DIR$\r$\n'
565 FileWrite $0 '$\r$\n'
566 FileWrite $0 'rem set path to freetype dll$\r$\n'
567 FileWrite $0 'set FREETYPEBASE=$INSTALL_DIR\extrabin;$INSTALL_DIR\lib$\r$\n'
568 FileWrite $0 '$\r$\n'
569 FileWrite $0 'rem set dependencies path$\r$\n'
570 FileWrite $0 'set PATH=%FREETYPEBASE%;%PATH%$\r$\n'
571 FileWrite $0 '$\r$\n'
572 FileWrite $0 'rem GISRC must be set$\r$\n'
573 FileWrite $0 'set GISRC=dummy$\r$\n'
574 FileWrite $0 '$\r$\n'
575 FileWrite $0 'rem run g.mkfontcap outside a grass session$\r$\n'
576 FileWrite $0 '"%GISBASE%\bin\g.mkfontcap.exe" -o$\r$\n'
577 FileWrite $0 'exit$\r$\n'
578 FileClose $0
579 done_create_run_gmkfontcap.bat:
580
581 ;create run_gmkfontcap.bat.manifest
582 ClearErrors
583 FileOpen $0 $INSTALL_DIR\etc\run_gmkfontcap.bat.manifest w
584 IfErrors done_create_run_gmkfontcap.bat.manifest
585 FileWrite $0 ' <?xml version="1.0" encoding="UTF-8" standalone="yes"?>$\r$\n'
586 FileWrite $0 '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">$\r$\n'
587 FileWrite $0 ' <assemblyIdentity version="1.0.0.0"$\r$\n'
588 FileWrite $0 ' processorArchitecture="X86"$\r$\n'
589 FileWrite $0 ' name="run_gmkfontcap"$\r$\n'
590 FileWrite $0 ' type="win32"/>$\r$\n'
591 FileWrite $0 ' <description>GRASS help script:run_gmkfontcap<description>$\r$\n'
592 FileWrite $0 ' <!-- Identify the application security requirements. -->$\r$\n'
593 FileWrite $0 ' <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">$\r$\n'
594 FileWrite $0 ' <security>$\r$\n'
595 FileWrite $0 ' <requestedPrivileges>$\r$\n'
596 FileWrite $0 ' <requestedExecutionLevel$\r$\n'
597 FileWrite $0 ' level="requireAdministrator"$\r$\n'
598 FileWrite $0 ' uiAccess="false"/>$\r$\n'
599 FileWrite $0 ' </requestedPrivileges>$\r$\n'
600 FileWrite $0 ' </security>$\r$\n'
601 FileWrite $0 ' </trustInfo>$\r$\n'
602 FileWrite $0 '</assembly>$\r$\n'
603 FileClose $0
604 done_create_run_gmkfontcap.bat.manifest:
605
606 ;Run g.mkfontcap outside a grass session during installation to catch all fonts
607 ExecWait '"$INSTALL_DIR\etc\run_gmkfontcap.bat"'
608
609 ;set $INSTDIR\etc back to read accessible
610 AccessControl::SetOnFile "$INSTDIR\etc" "(S-1-5-32-545)" "GenericRead + GenericExecute"
611
612 ;Install demolocation into the GIS_DATABASE directory
613 SetOutPath "$GIS_DATABASE\demolocation"
614 File /r ${DEMOLOCATION_PATH}\*.*
615 RMDir /r "$GIS_DATABASE\demolocation\.svn"
616 RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\.svn"
617 RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\vector\.svn"
618 RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\vector\mysites\.svn"
619 RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\vector\point\.svn"
620 RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\dbf\.svn"
621
622 ;Create the Uninstaller
623 WriteUninstaller "$INSTALL_DIR\Uninstall-GRASS.exe"
624
625 ;Registry Key Entries
626
627 ;HKEY_LOCAL_MACHINE Install entries
628 ;Set the Name, Version and Revision of GRASS + PublisherInfo + InstallPath
629 WriteRegStr HKLM "Software\${GRASS_BASE}" "Name" "${GRASS_BASE} (${PLATFORM})"
630 WriteRegStr HKLM "Software\${GRASS_BASE}" "VersionNumber" "${VERSION_NUMBER}"
631 WriteRegStr HKLM "Software\${GRASS_BASE}" "SvnRevision" "${SVN_REVISION}"
632 WriteRegStr HKLM "Software\${GRASS_BASE}" "BinaryRevision" "${BINARY_REVISION}"
633 WriteRegStr HKLM "Software\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
634 WriteRegStr HKLM "Software\${GRASS_BASE}" "WebSite" "${WEB_SITE}"
635 WriteRegStr HKLM "Software\${GRASS_BASE}" "InstallPath" "$INSTALL_DIR"
636
637 ;HKEY_LOCAL_MACHINE Uninstall entries
638 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayName" "GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@ (${PLATFORM})"
639 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString" "$INSTALL_DIR\Uninstall-GRASS.exe"
640
641 !if ${INSTALLER_TYPE} == "Release"
642 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\
643 "DisplayVersion" "${VERSION_NUMBER}-${BINARY_REVISION}"
644 !else
645 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\
646 "DisplayVersion" "${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
647 !endif
648
649 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayIcon" "$INSTALL_DIR\gui\icons\grass.ico"
650 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "EstimatedSize" 1
651 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "HelpLink" "${WIKI_PAGE}"
652 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "URLInfoAbout" "${WEB_SITE}"
653 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
654
655
656 ;Create the Desktop Shortcut
657 SetShellVarContext current
658
659 CreateShortCut "$DESKTOP\${GRASS_BASE}.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "-gui"\
660 "$INSTALL_DIR\gui\icons\grass.ico" "" SW_SHOWNORMAL "" "Launch GRASS GIS ${VERSION_NUMBER}"
661
662 ;Create the Windows Start Menu Shortcuts
663 SetShellVarContext all
664
665 CreateDirectory "$SMPROGRAMS\${GRASS_BASE}"
666
667 CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\${GRASS_BASE}.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "-gui"\
668 "$INSTALL_DIR\gui\icons\grass.ico" "" SW_SHOWNORMAL "" "Launch GRASS GIS ${VERSION_NUMBER}"
669
670 CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\Uninstall ${GRASS_BASE}.lnk" "$INSTALL_DIR\Uninstall-GRASS.exe" ""\
671 "$INSTALL_DIR\Uninstall-GRASS.exe" "" SW_SHOWNORMAL "" "Uninstall GRASS GIS ${VERSION_NUMBER}"
672
673 ;Create the grass_command.bat
674 ClearErrors
675 FileOpen $0 $INSTALL_DIR\${GRASS_COMMAND}.bat w
676 IfErrors done_create_grass_command.bat
677 FileWrite $0 '@echo off$\r$\n'
678 FileWrite $0 'rem #########################################################################$\r$\n'
679 FileWrite $0 'rem #$\r$\n'
680 FileWrite $0 'rem # File dynamically created by NSIS installer script;$\r$\n'
681 FileWrite $0 'rem #$\r$\n'
682 FileWrite $0 'rem #########################################################################$\r$\n'
683 FileWrite $0 'rem #$\r$\n'
684 FileWrite $0 'rem # GRASS initialization bat script$\r$\n'
685 FileWrite $0 'rem #$\r$\n'
686 FileWrite $0 'rem #########################################################################$\r$\n'
687 FileWrite $0 '$\r$\n'
688 FileWrite $0 'set GISBASE=$INSTALL_DIR$\r$\n'
689 FileWrite $0 '$\r$\n'
690 FileWrite $0 'call "%GISBASE%\etc\env.bat"$\r$\n'
691 FileWrite $0 '$\r$\n'
692 FileWrite $0 'cd "%USERPROFILE%"'
693 FileWrite $0 '$\r$\n'
694 FileWrite $0 '"%GRASS_PYTHON%" "%GISBASE%\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" %*'
695 FileWrite $0 '$\r$\n$\r$\n'
696 FileWrite $0 'if %ERRORLEVEL% GEQ 1 pause'
697 FileClose $0
698 done_create_grass_command.bat:
699
700 ;Set the UNIX_LIKE GRASS Path
701 Var /GLOBAL UNIX_LIKE_DRIVE
702 Var /GLOBAL UNIX_LIKE_GRASS_PATH
703
704 StrCpy $UNIX_LIKE_DRIVE "$INSTALL_DIR" 3
705 StrCpy $UNIX_LIKE_GRASS_PATH "$INSTALL_DIR" "" 3
706
707 ;replace "\" with "/" in $UNIX_LIKE_DRIVE
708 ${StrReplace} "$UNIX_LIKE_DRIVE" "\" "/" "$UNIX_LIKE_DRIVE"
709
710 ;replace ":" with "" in $UNIX_LIKE_DRIVE
711 ${StrReplace} "$UNIX_LIKE_DRIVE" ":" "" "$UNIX_LIKE_DRIVE"
712
713 ;replace "\" with "/" in $UNIX_LIKE_GRASS_PATH
714 ${StrReplace} "$UNIX_LIKE_GRASS_PATH" "\" "/" "$UNIX_LIKE_GRASS_PATH"
715
716 ;Set the USERNAME variable
717 Var /GLOBAL USERNAME
718 Var /GLOBAL PROFILE_DRIVE
719 Var /GLOBAL PROFILE_ROOT
720
721 ;It first searches for the Key Regestry value "Logon User Name" in HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer"
722 ReadRegStr $USERNAME HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Logon User Name"
723
724 ;If the Key Registry value is empty, it uses a work around, retrieving the Username string from the System User Profile variable ($PROFILE)
725 ;It first read the $PROFILE variable, to scan the OS version:
726 ;If equal to "drive:\Users\UserName", the OS is Vista, and the $USERNAME variable set to $PROFILE - "drive:\Users\"
727 ;If not, the OS is XP or previous, and the $USERNAME variable set to $PROFILE - "drive:\Documents and Settings\"
728
729 ${If} $USERNAME == ""
730 StrCpy $PROFILE_DRIVE "$PROFILE" 2
731 StrCpy $PROFILE_ROOT "$PROFILE" 5 -3
732 ${If} $USERNAME = "Users"
733 ${StrReplace} "$USERNAME" "$PROFILE_DRIVE\Users\" "" "$PROFILE"
734 ${Else}
735 ${StrReplace} "$USERNAME" "$PROFILE_DRIVE\Documents and Settings\" "" "$PROFILE"
736 ${EndIf}
737 ${EndIf}
738
739 ;Get the short form of the install path (to allow for paths with spaces)
740 VAR /GLOBAL INST_DIR_SHORT
741 GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR
742
743 ;Set the Unix-Like GIS_DATABASE Path
744 ;Var /GLOBAL UNIX_LIKE_GIS_DATABASE_PATH
745
746 ;replace \ with / in $GIS_DATABASE
747 ;${StrReplace} "$UNIX_LIKE_GIS_DATABASE_PATH" "\" "/" "$GIS_DATABASE"
748
749 SetShellVarContext current
750 ${If} ${FileExists} "$APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc"
751 DetailPrint "File $APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc already exists. Skipping."
752 ${Else}
753 ;create $APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc
754 ClearErrors
755 CreateDirectory $APPDATA\GRASS@GRASS_VERSION_MAJOR@
756 FileOpen $0 $APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc w
757 IfErrors done_create_grass_rc
758 FileWrite $0 'GISDBASE: $GIS_DATABASE$\r$\n'
759 FileWrite $0 'LOCATION_NAME: demolocation$\r$\n'
760 FileWrite $0 'MAPSET: PERMANENT$\r$\n'
761 FileClose $0
762 done_create_grass_rc:
763 ${EndIf}
764
765 ;replace gisbase
766 Push "$INSTDIR\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" ; file to modify
767 Push 'gisbase = "/c/OSGeo4W/apps/grass/grass-@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@"' ; string that a line must begin with *WS Sensitive*
768 Push 'gisbase = "$INSTDIR"' ; string to replace whole line with
769 Call ReplaceLineStr
770
771 ;replace config_projshare
772 Push "$INSTDIR\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" ; file to modify
773 Push 'config_projshare = "/c/OSGeo4W/share/proj"' ; string that a line must begin with *WS Sensitive*
774 Push 'config_projshare = "$INSTDIR\share\proj"' ; string to replace whole line with
775 Call ReplaceLineStr
776
777 AccessControl::SetOnFile "$INSTDIR\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" "(BU)" "Execute"
778SectionEnd
779
780;--------------------------------------------------------------------------
781
782Function DownloadInstallMSRuntime
783
784 IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
785
786 StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME.$\r$\n"
787 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
788 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_These system libraries from Microsoft are needed for programs"
789 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ built with Microsoft's Visual C++ compiler, such as Python and"
790 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ GDAL which ship with GRASS, since MS does not include them by"
791 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ default. You might already have them installed by other software,"
792 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ if so you don't need to install them again, but if not GRASS will"
793 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ fail to start and you will see errors like 'Missing MSVCR71.dll"
794 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ or MSVCP100.dll'.$\r$\n"
795 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
796 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
797 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to download.$\r$\n"
798 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
799 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME will be copied to:$\r$\n"
800 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$TEMP\$CUSTOM_UNTAR_FOLDER.$\r$\n"
801 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
802 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue and install the runtimes, or Cancel"
803 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ to skip the download and complete the GRASS"
804 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME.$\r$\n"
805
806 MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
807
808 download:
809 SetShellVarContext current
810 InitPluginsDir
811 NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
812 ;!if ${PLATFORM} == "x86"
813 ; NSISdl::download "$HTTP_PATH/msvcrt2005/$ARCHIVE_NAME2005" "$TEMP\$ARCHIVE_NAME2005"
814 ;!endif
815 NSISdl::download "$HTTP_PATH/msvcrt2008/$ARCHIVE_NAME2008" "$TEMP\$ARCHIVE_NAME2008"
816 NSISdl::download "$HTTP_PATH/msvcrt2010/$ARCHIVE_NAME2010" "$TEMP\$ARCHIVE_NAME2010"
817 !if ${PLATFORM} == "x86_64"
818 NSISdl::download "$HTTP_PATH/msvcrt2012/$ARCHIVE_NAME2012" "$TEMP\$ARCHIVE_NAME2012"
819 !endif
820 NSISdl::download "$HTTP_PATH/msvcrt2013/$ARCHIVE_NAME2013" "$TEMP\$ARCHIVE_NAME2013"
821
822 Pop $0
823 StrCmp $0 "success" download_ok download_failed
824
825 download_ok:
826 InitPluginsDir
827 untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME"
828 ;!if ${PLATFORM} == "x86"
829 ; untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2005"
830 ;!endif
831 untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2008"
832 untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2010"
833 !if ${PLATFORM} == "x86_64"
834 untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2012"
835 !endif
836 untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2013"
837 Pop $0
838 StrCmp $0 "success" untar_ok untar_failed
839
840 download_failed:
841 DetailPrint "$0" ;print error message to log
842 MessageBox MB_OK "Download Failed.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME."
843 Goto end
844
845 cancel_download:
846 MessageBox MB_OK "Download Cancelled.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME."
847 Goto end
848
849 untar_failed:
850 DetailPrint "$0" ;print error message to log
851
852 untar_ok:
853 DetailPrint "Archive successfully unzipped."
854 !if ${PLATFORM} == "x86"
855 ; seems to be not needed, see #2996
856 ;DetailPrint "Installing vcredist_2005_x86.exe ..."
857 ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2005_x86.exe" /q'
858 DetailPrint "Installing vcredist_2008_x86.exe ..."
859 ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2008_x86.exe" /q'
860 DetailPrint "Installing vcredist_2010_x86.exe ..."
861 ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2010_x86.exe" /q'
862 DetailPrint "Installing vcredist_2013_x86.exe ..."
863 ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2013_x86.exe" /q'
864 !else
865 DetailPrint "Installing vcredist_2008_x64.exe ..."
866 ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2008-sp1-x64.exe" /q'
867 DetailPrint "Installing vcredist_2010_x64.exe ..."
868 ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2010-x64.exe" /q'
869 ; msvcrt2012 package contains dll files
870 ;DetailPrint "Installing vcredist_2012_x64.exe ..."
871 ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2012-x64.exe" /q'
872 DetailPrint "Installing vcredist_2013_x64.exe ..."
873 ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2013-x64.exe" /q'
874 !endif
875 DetailPrint "Copying runtime files ..."
876 CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin"
877 DetailPrint "MS runtime files installed."
878 Goto end
879
880 end:
881
882FunctionEnd
883
884Section "Important Microsoft Runtime DLLs" SecMSRuntime
885
886 ;Set the size (in KB) of the archive file
887 StrCpy $ARCHIVE_SIZE_KB 18512
888
889 ;Set the size (in KB) of the unpacked archive file
890 AddSize 13500
891
892 StrCpy $HTTP_PATH "http://download.osgeo.org/osgeo4w/${PLATFORM}/release/msvcrt/"
893 !if ${PLATFORM} == "x86_64"
894 StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-8.tar.bz2"
895 StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0.0-1.tar.bz2"
896 StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0.0-1.tar.bz2"
897 StrCpy $ARCHIVE_NAME2012 "msvcrt2012-1.0.0-1.tar.bz2"
898 StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0.0-1.tar.bz2"
899 !else
900 StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-13.tar.bz2"
901 ;StrCpy $ARCHIVE_NAME2005 "msvcrt2005-1.0-1.tar.bz2"
902 StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0-1.tar.bz2"
903 StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0-1.tar.bz2"
904 StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0-1.tar.bz2"
905 !endif
906 StrCpy $EXTENDED_ARCHIVE_NAME "Microsoft Visual C++ Redistributable Packages"
907 StrCpy $ORIGINAL_UNTAR_FOLDER "install_msruntime"
908
909 Call DownloadInstallMSRuntime
910
911SectionEnd
912
913Function DownloadDataSet
914
915 IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
916
917 StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME sample data set.$\r$\n"
918 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
919 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
920 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to download.$\r$\n"
921 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
922 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME dataset will be copied to:$\r$\n"
923 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER.$\r$\n"
924 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
925 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue or Cancel to skip the download and complete the GRASS"
926 StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME data set.$\r$\n"
927
928 MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
929
930 download:
931 SetShellVarContext current
932 InitPluginsDir
933 NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
934
935 Pop $0
936 StrCmp $0 "success" download_ok download_failed
937
938 download_ok:
939 InitPluginsDir
940 untgz::extract "-d" "$GIS_DATABASE" "$TEMP\$ARCHIVE_NAME"
941 Pop $0
942 StrCmp $0 "success" untar_ok untar_failed
943
944 untar_ok:
945 Rename "$GIS_DATABASE\$ORIGINAL_UNTAR_FOLDER" "$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER"
946 Delete "$TEMP\$ARCHIVE_NAME"
947 Goto end
948
949 download_failed:
950 DetailPrint "$0" ;print error message to log
951 MessageBox MB_OK "Download Failed.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
952 Goto end
953
954 cancel_download:
955 MessageBox MB_OK "Download Cancelled.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
956 Goto end
957
958 untar_failed:
959 DetailPrint "$0" ;print error message to log
960
961 end:
962
963FunctionEnd
964
965Section /O "North Carolina (Wake County) Data Set" SecNorthCarolinaSDB
966
967 ;Set the size (in KB) of the archive file
968 StrCpy $ARCHIVE_SIZE_KB 144213
969
970 ;Set the size (in KB) of the unpacked archive file
971 AddSize 254521
972
973 StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata/north_carolina/"
974 StrCpy $ARCHIVE_NAME "nc_spm_08_grass7.tar.gz"
975 StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina (Wake County)"
976 StrCpy $ORIGINAL_UNTAR_FOLDER "nc_spm_08_grass7"
977 StrCpy $CUSTOM_UNTAR_FOLDER "North_Carolina"
978
979 Call DownloadDataSet
980
981SectionEnd
982
983Section /O "South Dakota (Spearfish County) Data Set" SecSpearfishSDB
984
985 ;Set the size (in KB) of the archive file
986 StrCpy $ARCHIVE_SIZE_KB 20803
987
988 ;Set the size (in KB) of the unpacked archive file
989 AddSize 42171
990
991 StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
992 StrCpy $ARCHIVE_NAME "spearfish_grass70data-0.3.tar.gz"
993 StrCpy $EXTENDED_ARCHIVE_NAME "South Dakota (Spearfish County)"
994 StrCpy $ORIGINAL_UNTAR_FOLDER "spearfish60_grass7"
995 StrCpy $CUSTOM_UNTAR_FOLDER "Spearfish60_grass7"
996
997 Call DownloadDataSet
998
999SectionEnd
1000
1001;--------------------------------------------------------------------------
1002;Clean downloaded MS runtime files by .onInstSuccess
1003
1004Function .onInstSuccess
1005 ${If} ${SectionIsSelected} ${SecMSRuntime}
1006 Delete "$TEMP\$ARCHIVE_NAME"
1007 RMDir /r "$TEMP\$ORIGINAL_UNTAR_FOLDER"
1008 RMDir "$TEMP\$ORIGINAL_UNTAR_FOLDER"
1009 ${EndIf}
1010FunctionEnd
1011
1012;--------------------------------------------------------------------------
1013
1014;Uninstaller Section
1015
1016Section "Uninstall"
1017 ;remove files & folders
1018 RMDir /r "$INSTDIR"
1019
1020 ;remove the Desktop ShortCut
1021 SetShellVarContext current
1022 Delete "$DESKTOP\${GRASS_BASE}.lnk"
1023
1024 ;remove the Programs Start ShortCuts
1025 SetShellVarContext all
1026 RMDir /r "$SMPROGRAMS\${GRASS_BASE}"
1027
1028 ;remove the $APPDATA\GRASS@GRASS_VERSION_MAJOR@ folder
1029 ;disabled, don't remove user settings
1030 ; SetShellVarContext current
1031 ;RMDir /r "$APPDATA\GRASS@GRASS_VERSION_MAJOR@"
1032 ;${If} ${FileExists} "$APPDATA\GRASS@GRASS_VERSION_MAJOR@\addons\*.*"
1033 ; RMDir /r "$APPDATA\GRASS@GRASS_VERSION_MAJOR@\addons"
1034 ;${EndIf}
1035
1036 ;remove the Registry Entries
1037 DeleteRegKey HKLM "Software\${GRASS_BASE}"
1038 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"
1039
1040SectionEnd
1041
1042;--------------------------------------------------------------------------
1043
1044;Installer Section Descriptions
1045!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1046 !insertmacro MUI_DESCRIPTION_TEXT ${SecGRASS} "Install GRASS ${VERSION_NUMBER}"
1047 !insertmacro MUI_DESCRIPTION_TEXT ${SecMSRuntime} "Some software included in this installer (e.g. GDAL, Python) may need Microsoft's Visual C++ redistributable system libraries.$\r$\nDownload and install the Redistributable Package. (12 MB)"
1048 !insertmacro MUI_DESCRIPTION_TEXT ${SecNorthCarolinaSDB} "Download and install the North Carolina (Wake County) sample data set. (141 MB)"
1049 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpearfishSDB} "Download and install the South Dakota (Spearfish County) sample data set. (22 MB)"
1050!insertmacro MUI_FUNCTION_DESCRIPTION_END
1051
1052;--------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.