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

Last change on this file was 62107, checked in by hellik, 10 years ago

nsis: fix installing MS runtimes

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