| 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 74028 2019-01-26 22:12:05Z 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 |
|
|---|
| 18 | SetCompressor /SOLID lzma
|
|---|
| 19 | SetCompressorDictSize 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@"
|
|---|
| 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}-${SVN_REVISION}-${BINARY_REVISION}-Setup-${PLATFORM}.exe"
|
|---|
| 76 | !define DISPLAYED_NAME "GRASS GIS ${VERSION_NUMBER}-${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
|
|---|
| 97 | Name "${DISPLAYED_NAME}"
|
|---|
| 98 |
|
|---|
| 99 | ;Name of the output file (installer executable)
|
|---|
| 100 | OutFile "${INSTALLER_NAME}"
|
|---|
| 101 |
|
|---|
| 102 | ;Request application privileges for Windows
|
|---|
| 103 | RequestExecutionLevel admin
|
|---|
| 104 |
|
|---|
| 105 | ;Tell the installer to hide Install and Uninstall details as default
|
|---|
| 106 | ShowInstDetails hide
|
|---|
| 107 | ShowUnInstDetails hide
|
|---|
| 108 |
|
|---|
| 109 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 110 |
|
|---|
| 111 | ;StrReplace Function
|
|---|
| 112 | ;Replaces all occurrences of a given needle within a haystack with another string
|
|---|
| 113 | ;Written by dandaman32
|
|---|
| 114 |
|
|---|
| 115 | Var STR_REPLACE_VAR_0
|
|---|
| 116 | Var STR_REPLACE_VAR_1
|
|---|
| 117 | Var STR_REPLACE_VAR_2
|
|---|
| 118 | Var STR_REPLACE_VAR_3
|
|---|
| 119 | Var STR_REPLACE_VAR_4
|
|---|
| 120 | Var STR_REPLACE_VAR_5
|
|---|
| 121 | Var STR_REPLACE_VAR_6
|
|---|
| 122 | Var STR_REPLACE_VAR_7
|
|---|
| 123 | Var STR_REPLACE_VAR_8
|
|---|
| 124 |
|
|---|
| 125 | Function 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
|
|---|
| 151 | FunctionEnd
|
|---|
| 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 |
|
|---|
| 189 | Function .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 |
|
|---|
| 298 | FunctionEnd
|
|---|
| 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 |
|
|---|
| 305 | Function CheckUpdate
|
|---|
| 306 |
|
|---|
| 307 | ${If} $ASK_FOR_PATH == "NO"
|
|---|
| 308 | Abort
|
|---|
| 309 | ${EndIf}
|
|---|
| 310 |
|
|---|
| 311 | FunctionEnd
|
|---|
| 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 |
|
|---|
| 349 | Function 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
|
|---|
| 406 | FunctionEnd
|
|---|
| 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 |
|
|---|
| 470 | Function LaunchGrass
|
|---|
| 471 |
|
|---|
| 472 | ExecShell "" "$DESKTOP\${GRASS_BASE}.lnk"
|
|---|
| 473 |
|
|---|
| 474 | FunctionEnd
|
|---|
| 475 |
|
|---|
| 476 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 477 |
|
|---|
| 478 | ;launch reference manual by exit the installation wizard
|
|---|
| 479 |
|
|---|
| 480 | Function ViewReadme
|
|---|
| 481 |
|
|---|
| 482 | ExecShell "open" "$INSTDIR\docs\html\index.html"
|
|---|
| 483 |
|
|---|
| 484 | FunctionEnd
|
|---|
| 485 |
|
|---|
| 486 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 487 |
|
|---|
| 488 | ;Installer Sections
|
|---|
| 489 |
|
|---|
| 490 | ;Declares the variables for optional Sample Data Sections
|
|---|
| 491 | Var /GLOBAL HTTP_PATH
|
|---|
| 492 | Var /GLOBAL ARCHIVE_NAME
|
|---|
| 493 | ;Var /GLOBAL ARCHIVE_NAME2005
|
|---|
| 494 | Var /GLOBAL ARCHIVE_NAME2008
|
|---|
| 495 | Var /GLOBAL ARCHIVE_NAME2010
|
|---|
| 496 | !if ${PLATFORM} == "x86_64"
|
|---|
| 497 | Var /GLOBAL ARCHIVE_NAME2012
|
|---|
| 498 | !endif
|
|---|
| 499 | Var /GLOBAL ARCHIVE_NAME2013
|
|---|
| 500 | Var /GLOBAL ARCHIVE_NAME2015
|
|---|
| 501 | Var /GLOBAL EXTENDED_ARCHIVE_NAME
|
|---|
| 502 | Var /GLOBAL ORIGINAL_UNTAR_FOLDER
|
|---|
| 503 | Var /GLOBAL CUSTOM_UNTAR_FOLDER
|
|---|
| 504 | Var /GLOBAL ARCHIVE_SIZE_KB
|
|---|
| 505 | Var /GLOBAL ARCHIVE_SIZE_MB
|
|---|
| 506 | Var /GLOBAL DOWNLOAD_MESSAGE_
|
|---|
| 507 |
|
|---|
| 508 | Section "GRASS" SecGRASS
|
|---|
| 509 |
|
|---|
| 510 | SectionIn RO
|
|---|
| 511 |
|
|---|
| 512 | ;Set the INSTALL_DIR variable
|
|---|
| 513 | Var /GLOBAL INSTALL_DIR
|
|---|
| 514 |
|
|---|
| 515 | ${If} $ASK_FOR_PATH == "NO"
|
|---|
| 516 | StrCpy $INSTALL_DIR "$INSTALL_PATH"
|
|---|
| 517 | ${Else}
|
|---|
| 518 | StrCpy $INSTALL_DIR "$INSTDIR"
|
|---|
| 519 | ${EndIf}
|
|---|
| 520 |
|
|---|
| 521 | ;Set to try to overwrite existing files
|
|---|
| 522 | SetOverwrite try
|
|---|
| 523 |
|
|---|
| 524 | ;Set the GIS_DATABASE directory
|
|---|
| 525 | SetShellVarContext current
|
|---|
| 526 | Var /GLOBAL GIS_DATABASE
|
|---|
| 527 | StrCpy $GIS_DATABASE "$DOCUMENTS\grassdata"
|
|---|
| 528 |
|
|---|
| 529 | ;Create the GIS_DATABASE directory
|
|---|
| 530 | CreateDirectory "$GIS_DATABASE"
|
|---|
| 531 |
|
|---|
| 532 | ;add Installer files
|
|---|
| 533 | SetOutPath "$INSTALL_DIR"
|
|---|
| 534 | File .\Installer-Files\GRASS-WebSite.url
|
|---|
| 535 | File .\Installer-Files\WinGRASS-README.url
|
|---|
| 536 |
|
|---|
| 537 | ;add GRASS files
|
|---|
| 538 | SetOutPath "$INSTALL_DIR"
|
|---|
| 539 | File /r ${PACKAGE_FOLDER}\*.*
|
|---|
| 540 |
|
|---|
| 541 | ;grant $INSTDIR\etc read write accessible and show if succeeded: error if it failed
|
|---|
| 542 | AccessControl::GrantOnFile "$INSTDIR\etc" "(S-1-5-32-545)" "FullAccess"
|
|---|
| 543 | Pop $R0
|
|---|
| 544 | DetailPrint $R0
|
|---|
| 545 | ;grant modifying/overwriting fontcap file and show if succeeded: error if it failed
|
|---|
| 546 | AccessControl::GrantOnFile "$INSTDIR\etc\fontcap" "(S-1-5-32-545)" "FullAccess"
|
|---|
| 547 | Pop $R0
|
|---|
| 548 | DetailPrint $R0
|
|---|
| 549 |
|
|---|
| 550 | ;create run_gmkfontcap.bat
|
|---|
| 551 | ClearErrors
|
|---|
| 552 | FileOpen $0 $INSTALL_DIR\etc\run_gmkfontcap.bat w
|
|---|
| 553 | IfErrors done_create_run_gmkfontcap.bat
|
|---|
| 554 | FileWrite $0 '@echo off$\r$\n'
|
|---|
| 555 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 556 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 557 | FileWrite $0 'rem # Run g.mkfontcap outside a grass session during installation$\r$\n'
|
|---|
| 558 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 559 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 560 | FileWrite $0 'echo Setup of WinGRASS-${VERSION_NUMBER}$\r$\n'
|
|---|
| 561 | FileWrite $0 'echo Generating the font configuration file by scanning various directories for fonts.$\r$\n'
|
|---|
| 562 | FileWrite $0 'echo Please wait. Console window will close automatically ....$\r$\n'
|
|---|
| 563 | FileWrite $0 '$\r$\n'
|
|---|
| 564 | FileWrite $0 'rem set gisbase$\r$\n'
|
|---|
| 565 | FileWrite $0 'set GISBASE=$INSTALL_DIR$\r$\n'
|
|---|
| 566 | FileWrite $0 '$\r$\n'
|
|---|
| 567 | FileWrite $0 'rem set path to freetype dll$\r$\n'
|
|---|
| 568 | FileWrite $0 'set FREETYPEBASE=$INSTALL_DIR\extrabin;$INSTALL_DIR\lib$\r$\n'
|
|---|
| 569 | FileWrite $0 '$\r$\n'
|
|---|
| 570 | FileWrite $0 'rem set dependencies path$\r$\n'
|
|---|
| 571 | FileWrite $0 'set PATH=%FREETYPEBASE%;%PATH%$\r$\n'
|
|---|
| 572 | FileWrite $0 '$\r$\n'
|
|---|
| 573 | FileWrite $0 'rem GISRC must be set$\r$\n'
|
|---|
| 574 | FileWrite $0 'set GISRC=dummy$\r$\n'
|
|---|
| 575 | FileWrite $0 '$\r$\n'
|
|---|
| 576 | FileWrite $0 'rem run g.mkfontcap outside a grass session$\r$\n'
|
|---|
| 577 | FileWrite $0 '"%GISBASE%\bin\g.mkfontcap.exe" -o$\r$\n'
|
|---|
| 578 | FileWrite $0 'exit$\r$\n'
|
|---|
| 579 | FileClose $0
|
|---|
| 580 | done_create_run_gmkfontcap.bat:
|
|---|
| 581 |
|
|---|
| 582 | ;create run_gmkfontcap.bat.manifest
|
|---|
| 583 | ClearErrors
|
|---|
| 584 | FileOpen $0 $INSTALL_DIR\etc\run_gmkfontcap.bat.manifest w
|
|---|
| 585 | IfErrors done_create_run_gmkfontcap.bat.manifest
|
|---|
| 586 | FileWrite $0 ' <?xml version="1.0" encoding="UTF-8" standalone="yes"?>$\r$\n'
|
|---|
| 587 | FileWrite $0 '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">$\r$\n'
|
|---|
| 588 | FileWrite $0 ' <assemblyIdentity version="1.0.0.0"$\r$\n'
|
|---|
| 589 | FileWrite $0 ' processorArchitecture="X86"$\r$\n'
|
|---|
| 590 | FileWrite $0 ' name="run_gmkfontcap"$\r$\n'
|
|---|
| 591 | FileWrite $0 ' type="win32"/>$\r$\n'
|
|---|
| 592 | FileWrite $0 ' <description>GRASS help script:run_gmkfontcap<description>$\r$\n'
|
|---|
| 593 | FileWrite $0 ' <!-- Identify the application security requirements. -->$\r$\n'
|
|---|
| 594 | FileWrite $0 ' <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">$\r$\n'
|
|---|
| 595 | FileWrite $0 ' <security>$\r$\n'
|
|---|
| 596 | FileWrite $0 ' <requestedPrivileges>$\r$\n'
|
|---|
| 597 | FileWrite $0 ' <requestedExecutionLevel$\r$\n'
|
|---|
| 598 | FileWrite $0 ' level="requireAdministrator"$\r$\n'
|
|---|
| 599 | FileWrite $0 ' uiAccess="false"/>$\r$\n'
|
|---|
| 600 | FileWrite $0 ' </requestedPrivileges>$\r$\n'
|
|---|
| 601 | FileWrite $0 ' </security>$\r$\n'
|
|---|
| 602 | FileWrite $0 ' </trustInfo>$\r$\n'
|
|---|
| 603 | FileWrite $0 '</assembly>$\r$\n'
|
|---|
| 604 | FileClose $0
|
|---|
| 605 | done_create_run_gmkfontcap.bat.manifest:
|
|---|
| 606 |
|
|---|
| 607 | ;Run g.mkfontcap outside a grass session during installation to catch all fonts
|
|---|
| 608 | ExecWait '"$INSTALL_DIR\etc\run_gmkfontcap.bat"'
|
|---|
| 609 |
|
|---|
| 610 | ;set $INSTDIR\etc back to read accessible
|
|---|
| 611 | AccessControl::SetOnFile "$INSTDIR\etc" "(S-1-5-32-545)" "GenericRead + GenericExecute"
|
|---|
| 612 |
|
|---|
| 613 | ;Install demolocation into the GIS_DATABASE directory
|
|---|
| 614 | SetOutPath "$GIS_DATABASE\demolocation"
|
|---|
| 615 | File /r ${DEMOLOCATION_PATH}\*.*
|
|---|
| 616 | RMDir /r "$GIS_DATABASE\demolocation\.svn"
|
|---|
| 617 | RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\.svn"
|
|---|
| 618 | RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\vector\.svn"
|
|---|
| 619 | RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\vector\mysites\.svn"
|
|---|
| 620 | RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\vector\point\.svn"
|
|---|
| 621 | RMDir /r "$GIS_DATABASE\demolocation\PERMANENT\dbf\.svn"
|
|---|
| 622 |
|
|---|
| 623 | ;Create the Uninstaller
|
|---|
| 624 | WriteUninstaller "$INSTALL_DIR\Uninstall-GRASS.exe"
|
|---|
| 625 |
|
|---|
| 626 | ;Registry Key Entries
|
|---|
| 627 |
|
|---|
| 628 | ;HKEY_LOCAL_MACHINE Install entries
|
|---|
| 629 | ;Set the Name, Version and Revision of GRASS + PublisherInfo + InstallPath
|
|---|
| 630 | WriteRegStr HKLM "Software\${GRASS_BASE}" "Name" "${GRASS_BASE} (${PLATFORM})"
|
|---|
| 631 | WriteRegStr HKLM "Software\${GRASS_BASE}" "VersionNumber" "${VERSION_NUMBER}"
|
|---|
| 632 | WriteRegStr HKLM "Software\${GRASS_BASE}" "SvnRevision" "${SVN_REVISION}"
|
|---|
| 633 | WriteRegStr HKLM "Software\${GRASS_BASE}" "BinaryRevision" "${BINARY_REVISION}"
|
|---|
| 634 | WriteRegStr HKLM "Software\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
|
|---|
| 635 | WriteRegStr HKLM "Software\${GRASS_BASE}" "WebSite" "${WEB_SITE}"
|
|---|
| 636 | WriteRegStr HKLM "Software\${GRASS_BASE}" "InstallPath" "$INSTALL_DIR"
|
|---|
| 637 |
|
|---|
| 638 | ;HKEY_LOCAL_MACHINE Uninstall entries
|
|---|
| 639 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayName" "GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@ (${PLATFORM})"
|
|---|
| 640 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString" "$INSTALL_DIR\Uninstall-GRASS.exe"
|
|---|
| 641 |
|
|---|
| 642 | !if ${INSTALLER_TYPE} == "Release"
|
|---|
| 643 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\
|
|---|
| 644 | "DisplayVersion" "${VERSION_NUMBER}-${BINARY_REVISION}"
|
|---|
| 645 | !else
|
|---|
| 646 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\
|
|---|
| 647 | "DisplayVersion" "${VERSION_NUMBER}-${SVN_REVISION}-${BINARY_REVISION}"
|
|---|
| 648 | !endif
|
|---|
| 649 |
|
|---|
| 650 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayIcon" "$INSTALL_DIR\gui\icons\grass.ico"
|
|---|
| 651 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "EstimatedSize" 1
|
|---|
| 652 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "HelpLink" "${WIKI_PAGE}"
|
|---|
| 653 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "URLInfoAbout" "${WEB_SITE}"
|
|---|
| 654 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
|
|---|
| 655 |
|
|---|
| 656 |
|
|---|
| 657 | ;Create the Desktop Shortcut
|
|---|
| 658 | SetShellVarContext current
|
|---|
| 659 |
|
|---|
| 660 | CreateShortCut "$DESKTOP\${GRASS_BASE}.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "--gui"\
|
|---|
| 661 | "$INSTALL_DIR\gui\icons\grass.ico" "" SW_SHOWNORMAL "" "Launch GRASS GIS ${VERSION_NUMBER}"
|
|---|
| 662 |
|
|---|
| 663 | ;Create the Windows Start Menu Shortcuts
|
|---|
| 664 | SetShellVarContext all
|
|---|
| 665 |
|
|---|
| 666 | CreateDirectory "$SMPROGRAMS\${GRASS_BASE}"
|
|---|
| 667 |
|
|---|
| 668 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\${GRASS_BASE}.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "--gui"\
|
|---|
| 669 | "$INSTALL_DIR\gui\icons\grass.ico" "" SW_SHOWNORMAL "" "Launch GRASS GIS ${VERSION_NUMBER}"
|
|---|
| 670 |
|
|---|
| 671 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\Uninstall ${GRASS_BASE}.lnk" "$INSTALL_DIR\Uninstall-GRASS.exe" ""\
|
|---|
| 672 | "$INSTALL_DIR\Uninstall-GRASS.exe" "" SW_SHOWNORMAL "" "Uninstall GRASS GIS ${VERSION_NUMBER}"
|
|---|
| 673 |
|
|---|
| 674 | ;Create the grass_command.bat
|
|---|
| 675 | ClearErrors
|
|---|
| 676 | FileOpen $0 $INSTALL_DIR\${GRASS_COMMAND}.bat w
|
|---|
| 677 | IfErrors done_create_grass_command.bat
|
|---|
| 678 | FileWrite $0 '@echo off$\r$\n'
|
|---|
| 679 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 680 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 681 | FileWrite $0 'rem # File dynamically created by NSIS installer script;$\r$\n'
|
|---|
| 682 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 683 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 684 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 685 | FileWrite $0 'rem # GRASS initialization bat script$\r$\n'
|
|---|
| 686 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 687 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 688 | FileWrite $0 '$\r$\n'
|
|---|
| 689 | FileWrite $0 'set GISBASE=$INSTALL_DIR$\r$\n'
|
|---|
| 690 | FileWrite $0 '$\r$\n'
|
|---|
| 691 | FileWrite $0 'call "%GISBASE%\etc\env.bat"$\r$\n'
|
|---|
| 692 | FileWrite $0 '$\r$\n'
|
|---|
| 693 | FileWrite $0 'cd "%USERPROFILE%"'
|
|---|
| 694 | FileWrite $0 '$\r$\n'
|
|---|
| 695 | FileWrite $0 '"%GRASS_PYTHON%" "%GISBASE%\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" %*'
|
|---|
| 696 | FileWrite $0 '$\r$\n$\r$\n'
|
|---|
| 697 | FileWrite $0 'if %ERRORLEVEL% GEQ 1 pause'
|
|---|
| 698 | FileClose $0
|
|---|
| 699 | done_create_grass_command.bat:
|
|---|
| 700 |
|
|---|
| 701 | ;Set the UNIX_LIKE GRASS Path
|
|---|
| 702 | Var /GLOBAL UNIX_LIKE_DRIVE
|
|---|
| 703 | Var /GLOBAL UNIX_LIKE_GRASS_PATH
|
|---|
| 704 |
|
|---|
| 705 | StrCpy $UNIX_LIKE_DRIVE "$INSTALL_DIR" 3
|
|---|
| 706 | StrCpy $UNIX_LIKE_GRASS_PATH "$INSTALL_DIR" "" 3
|
|---|
| 707 |
|
|---|
| 708 | ;replace "\" with "/" in $UNIX_LIKE_DRIVE
|
|---|
| 709 | ${StrReplace} "$UNIX_LIKE_DRIVE" "\" "/" "$UNIX_LIKE_DRIVE"
|
|---|
| 710 |
|
|---|
| 711 | ;replace ":" with "" in $UNIX_LIKE_DRIVE
|
|---|
| 712 | ${StrReplace} "$UNIX_LIKE_DRIVE" ":" "" "$UNIX_LIKE_DRIVE"
|
|---|
| 713 |
|
|---|
| 714 | ;replace "\" with "/" in $UNIX_LIKE_GRASS_PATH
|
|---|
| 715 | ${StrReplace} "$UNIX_LIKE_GRASS_PATH" "\" "/" "$UNIX_LIKE_GRASS_PATH"
|
|---|
| 716 |
|
|---|
| 717 | ;Set the USERNAME variable
|
|---|
| 718 | Var /GLOBAL USERNAME
|
|---|
| 719 | Var /GLOBAL PROFILE_DRIVE
|
|---|
| 720 | Var /GLOBAL PROFILE_ROOT
|
|---|
| 721 |
|
|---|
| 722 | ;It first searches for the Key Regestry value "Logon User Name" in HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer"
|
|---|
| 723 | ReadRegStr $USERNAME HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Logon User Name"
|
|---|
| 724 |
|
|---|
| 725 | ;If the Key Registry value is empty, it uses a work around, retrieving the Username string from the System User Profile variable ($PROFILE)
|
|---|
| 726 | ;It first read the $PROFILE variable, to scan the OS version:
|
|---|
| 727 | ;If equal to "drive:\Users\UserName", the OS is Vista, and the $USERNAME variable set to $PROFILE - "drive:\Users\"
|
|---|
| 728 | ;If not, the OS is XP or previous, and the $USERNAME variable set to $PROFILE - "drive:\Documents and Settings\"
|
|---|
| 729 |
|
|---|
| 730 | ${If} $USERNAME == ""
|
|---|
| 731 | StrCpy $PROFILE_DRIVE "$PROFILE" 2
|
|---|
| 732 | StrCpy $PROFILE_ROOT "$PROFILE" 5 -3
|
|---|
| 733 | ${If} $USERNAME = "Users"
|
|---|
| 734 | ${StrReplace} "$USERNAME" "$PROFILE_DRIVE\Users\" "" "$PROFILE"
|
|---|
| 735 | ${Else}
|
|---|
| 736 | ${StrReplace} "$USERNAME" "$PROFILE_DRIVE\Documents and Settings\" "" "$PROFILE"
|
|---|
| 737 | ${EndIf}
|
|---|
| 738 | ${EndIf}
|
|---|
| 739 |
|
|---|
| 740 | ;Get the short form of the install path (to allow for paths with spaces)
|
|---|
| 741 | VAR /GLOBAL INST_DIR_SHORT
|
|---|
| 742 | GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR
|
|---|
| 743 |
|
|---|
| 744 | ;Set the Unix-Like GIS_DATABASE Path
|
|---|
| 745 | ;Var /GLOBAL UNIX_LIKE_GIS_DATABASE_PATH
|
|---|
| 746 |
|
|---|
| 747 | ;replace \ with / in $GIS_DATABASE
|
|---|
| 748 | ;${StrReplace} "$UNIX_LIKE_GIS_DATABASE_PATH" "\" "/" "$GIS_DATABASE"
|
|---|
| 749 |
|
|---|
| 750 | SetShellVarContext current
|
|---|
| 751 | ${If} ${FileExists} "$APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc"
|
|---|
| 752 | DetailPrint "File $APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc already exists. Skipping."
|
|---|
| 753 | ${Else}
|
|---|
| 754 | ;create $APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc
|
|---|
| 755 | ClearErrors
|
|---|
| 756 | CreateDirectory $APPDATA\GRASS@GRASS_VERSION_MAJOR@
|
|---|
| 757 | FileOpen $0 $APPDATA\GRASS@GRASS_VERSION_MAJOR@\rc w
|
|---|
| 758 | IfErrors done_create_grass_rc
|
|---|
| 759 | FileWrite $0 'GISDBASE: $GIS_DATABASE$\r$\n'
|
|---|
| 760 | FileWrite $0 'LOCATION_NAME: demolocation$\r$\n'
|
|---|
| 761 | FileWrite $0 'MAPSET: PERMANENT$\r$\n'
|
|---|
| 762 | FileClose $0
|
|---|
| 763 | done_create_grass_rc:
|
|---|
| 764 | ${EndIf}
|
|---|
| 765 |
|
|---|
| 766 | ;replace gisbase
|
|---|
| 767 | Push "$INSTDIR\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" ; file to modify
|
|---|
| 768 | 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*
|
|---|
| 769 | Push 'gisbase = "$INSTDIR"' ; string to replace whole line with
|
|---|
| 770 | Call ReplaceLineStr
|
|---|
| 771 |
|
|---|
| 772 | ;replace config_projshare
|
|---|
| 773 | Push "$INSTDIR\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" ; file to modify
|
|---|
| 774 | Push 'config_projshare = "/c/OSGeo4W/share/proj"' ; string that a line must begin with *WS Sensitive*
|
|---|
| 775 | Push 'config_projshare = "$INSTDIR\share\proj"' ; string to replace whole line with
|
|---|
| 776 | Call ReplaceLineStr
|
|---|
| 777 |
|
|---|
| 778 | AccessControl::SetOnFile "$INSTDIR\etc\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@.py" "(BU)" "Execute"
|
|---|
| 779 | SectionEnd
|
|---|
| 780 |
|
|---|
| 781 | ;--------------------------------------------------------------------------
|
|---|
| 782 |
|
|---|
| 783 | Function DownloadInstallMSRuntime
|
|---|
| 784 |
|
|---|
| 785 | IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
|
|---|
| 786 |
|
|---|
| 787 | StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME.$\r$\n"
|
|---|
| 788 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 789 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_These system libraries from Microsoft are needed for programs"
|
|---|
| 790 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ built with Microsoft's Visual C++ compiler, such as Python and"
|
|---|
| 791 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ GDAL which ship with GRASS, since MS does not include them by"
|
|---|
| 792 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ default. You might already have them installed by other software,"
|
|---|
| 793 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ if so you don't need to install them again, but if not GRASS will"
|
|---|
| 794 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ fail to start and you will see errors like 'Missing MSVCR71.dll"
|
|---|
| 795 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ or MSVCP100.dll'.$\r$\n"
|
|---|
| 796 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 797 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
|
|---|
| 798 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to download.$\r$\n"
|
|---|
| 799 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 800 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME will be copied to:$\r$\n"
|
|---|
| 801 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$TEMP\$CUSTOM_UNTAR_FOLDER.$\r$\n"
|
|---|
| 802 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 803 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue and install the runtimes, or Cancel"
|
|---|
| 804 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ to skip the download and complete the GRASS"
|
|---|
| 805 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME.$\r$\n"
|
|---|
| 806 |
|
|---|
| 807 | MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
|
|---|
| 808 |
|
|---|
| 809 | download:
|
|---|
| 810 | SetShellVarContext current
|
|---|
| 811 | InitPluginsDir
|
|---|
| 812 | NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
|
|---|
| 813 | ;!if ${PLATFORM} == "x86"
|
|---|
| 814 | ; NSISdl::download "$HTTP_PATH/msvcrt2005/$ARCHIVE_NAME2005" "$TEMP\$ARCHIVE_NAME2005"
|
|---|
| 815 | ;!endif
|
|---|
| 816 | NSISdl::download "$HTTP_PATH/msvcrt2008/$ARCHIVE_NAME2008" "$TEMP\$ARCHIVE_NAME2008"
|
|---|
| 817 | NSISdl::download "$HTTP_PATH/msvcrt2010/$ARCHIVE_NAME2010" "$TEMP\$ARCHIVE_NAME2010"
|
|---|
| 818 | !if ${PLATFORM} == "x86_64"
|
|---|
| 819 | NSISdl::download "$HTTP_PATH/msvcrt2012/$ARCHIVE_NAME2012" "$TEMP\$ARCHIVE_NAME2012"
|
|---|
| 820 | !endif
|
|---|
| 821 | NSISdl::download "$HTTP_PATH/msvcrt2013/$ARCHIVE_NAME2013" "$TEMP\$ARCHIVE_NAME2013"
|
|---|
| 822 | NSISdl::download "$HTTP_PATH/msvcrt2015/$ARCHIVE_NAME2015" "$TEMP\$ARCHIVE_NAME2015"
|
|---|
| 823 |
|
|---|
| 824 | Pop $0
|
|---|
| 825 | StrCmp $0 "success" download_ok download_failed
|
|---|
| 826 |
|
|---|
| 827 | download_ok:
|
|---|
| 828 | InitPluginsDir
|
|---|
| 829 | untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME"
|
|---|
| 830 | ;!if ${PLATFORM} == "x86"
|
|---|
| 831 | ; untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2005"
|
|---|
| 832 | ;!endif
|
|---|
| 833 | untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2008"
|
|---|
| 834 | untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2010"
|
|---|
| 835 | !if ${PLATFORM} == "x86_64"
|
|---|
| 836 | untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2012"
|
|---|
| 837 | !endif
|
|---|
| 838 | untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2013"
|
|---|
| 839 | untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2015"
|
|---|
| 840 | Pop $0
|
|---|
| 841 | StrCmp $0 "success" untar_ok untar_failed
|
|---|
| 842 |
|
|---|
| 843 | download_failed:
|
|---|
| 844 | DetailPrint "$0" ;print error message to log
|
|---|
| 845 | MessageBox MB_OK "Download Failed.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME."
|
|---|
| 846 | Goto end
|
|---|
| 847 |
|
|---|
| 848 | cancel_download:
|
|---|
| 849 | MessageBox MB_OK "Download Cancelled.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME."
|
|---|
| 850 | Goto end
|
|---|
| 851 |
|
|---|
| 852 | untar_failed:
|
|---|
| 853 | DetailPrint "$0" ;print error message to log
|
|---|
| 854 |
|
|---|
| 855 | untar_ok:
|
|---|
| 856 | DetailPrint "Archive successfully unzipped."
|
|---|
| 857 | !if ${PLATFORM} == "x86"
|
|---|
| 858 | ; seems to be not needed, see #2996
|
|---|
| 859 | ;DetailPrint "Installing vcredist_2005_x86.exe ..."
|
|---|
| 860 | ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2005_x86.exe" /q'
|
|---|
| 861 | DetailPrint "Installing vcredist_2008_x86.exe ..."
|
|---|
| 862 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2008_x86.exe" /q'
|
|---|
| 863 | DetailPrint "Installing vcredist_2010_x86.exe ..."
|
|---|
| 864 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2010_x86.exe" /q'
|
|---|
| 865 | DetailPrint "Installing vcredist_2013_x86.exe ..."
|
|---|
| 866 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2013_x86.exe" /q'
|
|---|
| 867 | DetailPrint "Installing vcredist_2015_x86.exe ..."
|
|---|
| 868 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2015_x86.exe" /q'
|
|---|
| 869 | !else
|
|---|
| 870 | DetailPrint "Installing vcredist_2008_x64.exe ..."
|
|---|
| 871 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2008-sp1-x64.exe" /q'
|
|---|
| 872 | DetailPrint "Installing vcredist_2010_x64.exe ..."
|
|---|
| 873 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2010-x64.exe" /q'
|
|---|
| 874 | ; msvcrt2012 package contains dll files
|
|---|
| 875 | ;DetailPrint "Installing vcredist_2012_x64.exe ..."
|
|---|
| 876 | ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2012-x64.exe" /q'
|
|---|
| 877 | DetailPrint "Installing vcredist_2013_x64.exe ..."
|
|---|
| 878 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2013-x64.exe" /q'
|
|---|
| 879 | DetailPrint "Installing vcredist_2015_x64.exe ..."
|
|---|
| 880 | ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2015_x64.exe" /q'
|
|---|
| 881 | !endif
|
|---|
| 882 | DetailPrint "Copying runtime files ..."
|
|---|
| 883 | CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin"
|
|---|
| 884 | DetailPrint "MS runtime files installed."
|
|---|
| 885 | Goto end
|
|---|
| 886 |
|
|---|
| 887 | end:
|
|---|
| 888 |
|
|---|
| 889 | FunctionEnd
|
|---|
| 890 |
|
|---|
| 891 | Section "Important Microsoft Runtime DLLs" SecMSRuntime
|
|---|
| 892 |
|
|---|
| 893 | ;Set the size (in KB) of the archive file
|
|---|
| 894 | StrCpy $ARCHIVE_SIZE_KB 18512
|
|---|
| 895 |
|
|---|
| 896 | ;Set the size (in KB) of the unpacked archive file
|
|---|
| 897 | AddSize 13500
|
|---|
| 898 |
|
|---|
| 899 | StrCpy $HTTP_PATH "http://download.osgeo.org/osgeo4w/${PLATFORM}/release/msvcrt/"
|
|---|
| 900 | !if ${PLATFORM} == "x86_64"
|
|---|
| 901 | StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-9.tar.bz2"
|
|---|
| 902 | StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0.0-1.tar.bz2"
|
|---|
| 903 | StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0.0-1.tar.bz2"
|
|---|
| 904 | StrCpy $ARCHIVE_NAME2012 "msvcrt2012-1.0.0-1.tar.bz2"
|
|---|
| 905 | StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0.0-1.tar.bz2"
|
|---|
| 906 | StrCpy $ARCHIVE_NAME2015 "msvcrt2015-1.0-1.tar.bz2"
|
|---|
| 907 | !else
|
|---|
| 908 | StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-14.tar.bz2"
|
|---|
| 909 | ;StrCpy $ARCHIVE_NAME2005 "msvcrt2005-1.0-1.tar.bz2"
|
|---|
| 910 | StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0-1.tar.bz2"
|
|---|
| 911 | StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0-1.tar.bz2"
|
|---|
| 912 | StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0-1.tar.bz2"
|
|---|
| 913 | StrCpy $ARCHIVE_NAME2015 "msvcrt2015-1.0-1.tar.bz2"
|
|---|
| 914 | !endif
|
|---|
| 915 | StrCpy $EXTENDED_ARCHIVE_NAME "Microsoft Visual C++ Redistributable Packages"
|
|---|
| 916 | StrCpy $ORIGINAL_UNTAR_FOLDER "install_msruntime"
|
|---|
| 917 |
|
|---|
| 918 | Call DownloadInstallMSRuntime
|
|---|
| 919 |
|
|---|
| 920 | SectionEnd
|
|---|
| 921 |
|
|---|
| 922 | Function DownloadDataSet
|
|---|
| 923 |
|
|---|
| 924 | IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
|
|---|
| 925 |
|
|---|
| 926 | StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME sample data set.$\r$\n"
|
|---|
| 927 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 928 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
|
|---|
| 929 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to download.$\r$\n"
|
|---|
| 930 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 931 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME dataset will be copied to:$\r$\n"
|
|---|
| 932 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER.$\r$\n"
|
|---|
| 933 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 934 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue or Cancel to skip the download and complete the GRASS"
|
|---|
| 935 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME data set.$\r$\n"
|
|---|
| 936 |
|
|---|
| 937 | MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
|
|---|
| 938 |
|
|---|
| 939 | download:
|
|---|
| 940 | SetShellVarContext current
|
|---|
| 941 | InitPluginsDir
|
|---|
| 942 | NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
|
|---|
| 943 |
|
|---|
| 944 | Pop $0
|
|---|
| 945 | StrCmp $0 "success" download_ok download_failed
|
|---|
| 946 |
|
|---|
| 947 | download_ok:
|
|---|
| 948 | InitPluginsDir
|
|---|
| 949 | untgz::extract "-d" "$GIS_DATABASE" "$TEMP\$ARCHIVE_NAME"
|
|---|
| 950 | Pop $0
|
|---|
| 951 | StrCmp $0 "success" untar_ok untar_failed
|
|---|
| 952 |
|
|---|
| 953 | untar_ok:
|
|---|
| 954 | Rename "$GIS_DATABASE\$ORIGINAL_UNTAR_FOLDER" "$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER"
|
|---|
| 955 | Delete "$TEMP\$ARCHIVE_NAME"
|
|---|
| 956 | Goto end
|
|---|
| 957 |
|
|---|
| 958 | download_failed:
|
|---|
| 959 | DetailPrint "$0" ;print error message to log
|
|---|
| 960 | MessageBox MB_OK "Download Failed.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
|
|---|
| 961 | Goto end
|
|---|
| 962 |
|
|---|
| 963 | cancel_download:
|
|---|
| 964 | MessageBox MB_OK "Download Cancelled.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
|
|---|
| 965 | Goto end
|
|---|
| 966 |
|
|---|
| 967 | untar_failed:
|
|---|
| 968 | DetailPrint "$0" ;print error message to log
|
|---|
| 969 |
|
|---|
| 970 | end:
|
|---|
| 971 |
|
|---|
| 972 | FunctionEnd
|
|---|
| 973 |
|
|---|
| 974 | Section /O "North Carolina (Wake County) Data Set" SecNorthCarolinaSDB
|
|---|
| 975 |
|
|---|
| 976 | ;Set the size (in KB) of the archive file
|
|---|
| 977 | StrCpy $ARCHIVE_SIZE_KB 144213
|
|---|
| 978 |
|
|---|
| 979 | ;Set the size (in KB) of the unpacked archive file
|
|---|
| 980 | AddSize 254521
|
|---|
| 981 |
|
|---|
| 982 | StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata/north_carolina/"
|
|---|
| 983 | StrCpy $ARCHIVE_NAME "nc_spm_08_grass7.tar.gz"
|
|---|
| 984 | StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina (Wake County)"
|
|---|
| 985 | StrCpy $ORIGINAL_UNTAR_FOLDER "nc_spm_08_grass7"
|
|---|
| 986 | StrCpy $CUSTOM_UNTAR_FOLDER "North_Carolina"
|
|---|
| 987 |
|
|---|
| 988 | Call DownloadDataSet
|
|---|
| 989 |
|
|---|
| 990 | SectionEnd
|
|---|
| 991 |
|
|---|
| 992 | Section /O "South Dakota (Spearfish County) Data Set" SecSpearfishSDB
|
|---|
| 993 |
|
|---|
| 994 | ;Set the size (in KB) of the archive file
|
|---|
| 995 | StrCpy $ARCHIVE_SIZE_KB 20803
|
|---|
| 996 |
|
|---|
| 997 | ;Set the size (in KB) of the unpacked archive file
|
|---|
| 998 | AddSize 42171
|
|---|
| 999 |
|
|---|
| 1000 | StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
|
|---|
| 1001 | StrCpy $ARCHIVE_NAME "spearfish_grass70data-0.3.tar.gz"
|
|---|
| 1002 | StrCpy $EXTENDED_ARCHIVE_NAME "South Dakota (Spearfish County)"
|
|---|
| 1003 | StrCpy $ORIGINAL_UNTAR_FOLDER "spearfish60_grass7"
|
|---|
| 1004 | StrCpy $CUSTOM_UNTAR_FOLDER "Spearfish60_grass7"
|
|---|
| 1005 |
|
|---|
| 1006 | Call DownloadDataSet
|
|---|
| 1007 |
|
|---|
| 1008 | SectionEnd
|
|---|
| 1009 |
|
|---|
| 1010 | ;--------------------------------------------------------------------------
|
|---|
| 1011 | ;Clean downloaded MS runtime files by .onInstSuccess
|
|---|
| 1012 |
|
|---|
| 1013 | Function .onInstSuccess
|
|---|
| 1014 | ${If} ${SectionIsSelected} ${SecMSRuntime}
|
|---|
| 1015 | Delete "$TEMP\$ARCHIVE_NAME"
|
|---|
| 1016 | RMDir /r "$TEMP\$ORIGINAL_UNTAR_FOLDER"
|
|---|
| 1017 | RMDir "$TEMP\$ORIGINAL_UNTAR_FOLDER"
|
|---|
| 1018 | ${EndIf}
|
|---|
| 1019 | FunctionEnd
|
|---|
| 1020 |
|
|---|
| 1021 | ;--------------------------------------------------------------------------
|
|---|
| 1022 |
|
|---|
| 1023 | ;Uninstaller Section
|
|---|
| 1024 |
|
|---|
| 1025 | Section "Uninstall"
|
|---|
| 1026 | ;remove files & folders
|
|---|
| 1027 | RMDir /r "$INSTDIR"
|
|---|
| 1028 |
|
|---|
| 1029 | ;remove the Desktop ShortCut
|
|---|
| 1030 | SetShellVarContext current
|
|---|
| 1031 | Delete "$DESKTOP\${GRASS_BASE}.lnk"
|
|---|
| 1032 |
|
|---|
| 1033 | ;remove the Programs Start ShortCuts
|
|---|
| 1034 | SetShellVarContext all
|
|---|
| 1035 | RMDir /r "$SMPROGRAMS\${GRASS_BASE}"
|
|---|
| 1036 |
|
|---|
| 1037 | ;remove the $APPDATA\GRASS@GRASS_VERSION_MAJOR@ folder
|
|---|
| 1038 | ;disabled, don't remove user settings
|
|---|
| 1039 | ; SetShellVarContext current
|
|---|
| 1040 | ;RMDir /r "$APPDATA\GRASS@GRASS_VERSION_MAJOR@"
|
|---|
| 1041 | ;${If} ${FileExists} "$APPDATA\GRASS@GRASS_VERSION_MAJOR@\addons\*.*"
|
|---|
| 1042 | ; RMDir /r "$APPDATA\GRASS@GRASS_VERSION_MAJOR@\addons"
|
|---|
| 1043 | ;${EndIf}
|
|---|
| 1044 |
|
|---|
| 1045 | ;remove the Registry Entries
|
|---|
| 1046 | DeleteRegKey HKLM "Software\${GRASS_BASE}"
|
|---|
| 1047 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"
|
|---|
| 1048 |
|
|---|
| 1049 | SectionEnd
|
|---|
| 1050 |
|
|---|
| 1051 | ;--------------------------------------------------------------------------
|
|---|
| 1052 |
|
|---|
| 1053 | ;Installer Section Descriptions
|
|---|
| 1054 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|---|
| 1055 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGRASS} "Install GRASS ${VERSION_NUMBER}"
|
|---|
| 1056 | !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)"
|
|---|
| 1057 | !insertmacro MUI_DESCRIPTION_TEXT ${SecNorthCarolinaSDB} "Download and install the North Carolina (Wake County) sample data set. (141 MB)"
|
|---|
| 1058 | !insertmacro MUI_DESCRIPTION_TEXT ${SecSpearfishSDB} "Download and install the South Dakota (Spearfish County) sample data set. (22 MB)"
|
|---|
| 1059 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|---|
| 1060 |
|
|---|
| 1061 | ;--------------------------------------------------------------------------
|
|---|