| 1 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 2 |
|
|---|
| 3 | ;GRASS Installer for Windows
|
|---|
| 4 | ;Written by Marco Pasetti
|
|---|
| 5 | ;Updated for OSGeo4W by Colin Nielsen
|
|---|
| 6 | ;Last Update: 30 March 2009
|
|---|
| 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\grass-6.4.0RC4\demolocation"
|
|---|
| 14 |
|
|---|
| 15 | ;Select if you are building a "Development Version" or a "Release Version" of the GRASS Installer
|
|---|
| 16 | ;Change the INSTALLER_TYPE variable to Release, Dev6 or Dev7
|
|---|
| 17 |
|
|---|
| 18 | !define INSTALLER_TYPE "Release"
|
|---|
| 19 |
|
|---|
| 20 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 | ;Version variables
|
|---|
| 23 |
|
|---|
| 24 | !define RELEASE_VERSION_NUMBER "6.4.0RC4"
|
|---|
| 25 | !define RELEASE_SVN_REVISION "36599"
|
|---|
| 26 | !define RELEASE_BINARY_REVISION "1"
|
|---|
| 27 | !define RELEASE_GRASS_COMMAND "grass64"
|
|---|
| 28 | !define RELEASE_GRASS_BASE "GRASS"
|
|---|
| 29 |
|
|---|
| 30 | !define DEV6_VERSION_NUMBER "6.5.SVN"
|
|---|
| 31 | !define DEV6_SVN_REVISION "36599"
|
|---|
| 32 | !define DEV6_BINARY_REVISION "1"
|
|---|
| 33 | !define DEV6_GRASS_COMMAND "grass65"
|
|---|
| 34 | !define DEV6_GRASS_BASE "GRASS-6-SVN"
|
|---|
| 35 |
|
|---|
| 36 | !define DEV7_VERSION_NUMBER "7.0.SVN"
|
|---|
| 37 | !define DEV7_SVN_REVISION ""
|
|---|
| 38 | !define DEV7_BINARY_REVISION "1"
|
|---|
| 39 | !define DEV7_GRASS_COMMAND "grass7"
|
|---|
| 40 | !define DEV7_GRASS_BASE"GRASS-7-SVN"
|
|---|
| 41 |
|
|---|
| 42 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 43 |
|
|---|
| 44 | ;Don't modify the following lines
|
|---|
| 45 |
|
|---|
| 46 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 47 |
|
|---|
| 48 | ;NSIS Includes
|
|---|
| 49 |
|
|---|
| 50 | !include "MUI2.nsh"
|
|---|
| 51 | !include "LogicLib.nsh"
|
|---|
| 52 |
|
|---|
| 53 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 54 |
|
|---|
| 55 | ;Set the installer variables, depending on the selected version to build
|
|---|
| 56 |
|
|---|
| 57 | !if ${INSTALLER_TYPE} == "Release"
|
|---|
| 58 | !define VERSION_NUMBER "${RELEASE_VERSION_NUMBER}"
|
|---|
| 59 | !define SVN_REVISION "${RELEASE_SVN_REVISION}"
|
|---|
| 60 | !define BINARY_REVISION "${RELEASE_BINARY_REVISION}"
|
|---|
| 61 | !define GRASS_COMMAND "${RELEASE_GRASS_COMMAND}"
|
|---|
| 62 | !define GRASS_BASE "${RELEASE_GRASS_BASE}"
|
|---|
| 63 | !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-${BINARY_REVISION}-Setup.exe"
|
|---|
| 64 | !define DISPLAYED_NAME "GRASS ${VERSION_NUMBER}-${BINARY_REVISION}"
|
|---|
| 65 | !define CHECK_INSTALL_NAME "GRASS"
|
|---|
| 66 | !define PACKAGE_FOLDER ".\GRASS-Release-Package"
|
|---|
| 67 | !else if ${INSTALLER_TYPE} == "Dev6"
|
|---|
| 68 | !define VERSION_NUMBER "${DEV6_VERSION_NUMBER}"
|
|---|
| 69 | !define SVN_REVISION "${DEV6_SVN_REVISION}"
|
|---|
| 70 | !define BINARY_REVISION "${DEV6_BINARY_REVISION}"
|
|---|
| 71 | !define GRASS_COMMAND "${DEV6_GRASS_COMMAND}"
|
|---|
| 72 | !define GRASS_BASE "${DEV6_GRASS_BASE}"
|
|---|
| 73 | !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}-Setup.exe"
|
|---|
| 74 | !define DISPLAYED_NAME "GRASS ${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
|
|---|
| 75 | !define CHECK_INSTALL_NAME "GRASS 6 SVN"
|
|---|
| 76 | !define PACKAGE_FOLDER ".\GRASS-6-Dev-Package"
|
|---|
| 77 | !else if ${INSTALLER_TYPE} == "Dev7"
|
|---|
| 78 | !define VERSION_NUMBER "${DV7_VERSION_NUMBER}"
|
|---|
| 79 | !define SVN_REVISION "${DV7_SVN_REVISION}"
|
|---|
| 80 | !define BINARY_REVISION "${DV7_BINARY_REVISION}"
|
|---|
| 81 | !define GRASS_COMMAND "${DEV7_GRASS_COMMAND}"
|
|---|
| 82 | !define GRASS_BASE "${DEV7_GRASS_BASE}"
|
|---|
| 83 | !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}-Setup.exe"
|
|---|
| 84 | !define DISPLAYED_NAME "GRASS ${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
|
|---|
| 85 | !define CHECK_INSTALL_NAME "GRASS 7 SVN"
|
|---|
| 86 | !define PACKAGE_FOLDER ".\GRASS-7-Dev-Package"
|
|---|
| 87 | !endif
|
|---|
| 88 |
|
|---|
| 89 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 90 |
|
|---|
| 91 | ;Publisher variables
|
|---|
| 92 |
|
|---|
| 93 | !define PUBLISHER "GRASS Development Team"
|
|---|
| 94 | !define WEB_SITE "http://grass.osgeo.org/"
|
|---|
| 95 | !define WIKI_PAGE "http://grass.osgeo.org/wiki/Main_Page"
|
|---|
| 96 |
|
|---|
| 97 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 98 |
|
|---|
| 99 | ;General Definitions
|
|---|
| 100 |
|
|---|
| 101 | ;Name of the application shown during install
|
|---|
| 102 | Name "${DISPLAYED_NAME}"
|
|---|
| 103 |
|
|---|
| 104 | ;Name of the output file (installer executable)
|
|---|
| 105 | OutFile "${INSTALLER_NAME}"
|
|---|
| 106 |
|
|---|
| 107 | ;Define installation folder
|
|---|
| 108 | InstallDir "C:\${GRASS_BASE}"
|
|---|
| 109 |
|
|---|
| 110 | ;Request application privileges for Windows Vista
|
|---|
| 111 | RequestExecutionLevel user
|
|---|
| 112 |
|
|---|
| 113 | ;Tell the installer to show Install and Uninstall details as default
|
|---|
| 114 | ShowInstDetails show
|
|---|
| 115 | ShowUnInstDetails show
|
|---|
| 116 |
|
|---|
| 117 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 118 |
|
|---|
| 119 | ;StrReplace Function
|
|---|
| 120 | ;Replaces all ocurrences of a given needle within a haystack with another string
|
|---|
| 121 | ;Written by dandaman32
|
|---|
| 122 |
|
|---|
| 123 | Var STR_REPLACE_VAR_0
|
|---|
| 124 | Var STR_REPLACE_VAR_1
|
|---|
| 125 | Var STR_REPLACE_VAR_2
|
|---|
| 126 | Var STR_REPLACE_VAR_3
|
|---|
| 127 | Var STR_REPLACE_VAR_4
|
|---|
| 128 | Var STR_REPLACE_VAR_5
|
|---|
| 129 | Var STR_REPLACE_VAR_6
|
|---|
| 130 | Var STR_REPLACE_VAR_7
|
|---|
| 131 | Var STR_REPLACE_VAR_8
|
|---|
| 132 |
|
|---|
| 133 | Function StrReplace
|
|---|
| 134 | Exch $STR_REPLACE_VAR_2
|
|---|
| 135 | Exch 1
|
|---|
| 136 | Exch $STR_REPLACE_VAR_1
|
|---|
| 137 | Exch 2
|
|---|
| 138 | Exch $STR_REPLACE_VAR_0
|
|---|
| 139 | StrCpy $STR_REPLACE_VAR_3 -1
|
|---|
| 140 | StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
|
|---|
| 141 | StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
|
|---|
| 142 | loop:
|
|---|
| 143 | IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
|
|---|
| 144 | StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
|
|---|
| 145 | StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
|
|---|
| 146 | StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
|
|---|
| 147 | Goto loop
|
|---|
| 148 | found:
|
|---|
| 149 | StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
|
|---|
| 150 | IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
|
|---|
| 151 | StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
|
|---|
| 152 | StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
|
|---|
| 153 | StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
|
|---|
| 154 | Goto loop
|
|---|
| 155 | done:
|
|---|
| 156 | Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
|
|---|
| 157 | Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
|
|---|
| 158 | Exch $STR_REPLACE_VAR_0
|
|---|
| 159 | FunctionEnd
|
|---|
| 160 |
|
|---|
| 161 | !macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
|
|---|
| 162 | Push "${HAYSTACK}"
|
|---|
| 163 | Push "${NEEDLE}"
|
|---|
| 164 | Push "${NEEDLE2}"
|
|---|
| 165 | Call StrReplace
|
|---|
| 166 | Pop "${OUT}"
|
|---|
| 167 | !macroend
|
|---|
| 168 |
|
|---|
| 169 | !define StrReplace '!insertmacro "_strReplaceConstructor"'
|
|---|
| 170 |
|
|---|
| 171 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 172 |
|
|---|
| 173 | ;.onInit Function (called when the installer is nearly finished initializing)
|
|---|
| 174 |
|
|---|
| 175 | ;Check if GRASS is already installed on the system and, if yes, what version and binary release;
|
|---|
| 176 | ;depending on that, select the install procedure:
|
|---|
| 177 |
|
|---|
| 178 | ;1. first installation = if GRASS is not already installed
|
|---|
| 179 | ;install GRASS asking for the install PATH
|
|---|
| 180 |
|
|---|
| 181 | ;2. upgrade installation = if an older release of GRASS is already installed
|
|---|
| 182 | ;call the uninstaller of the currently installed GRASS release
|
|---|
| 183 | ;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
|
|---|
| 184 | ;GRASS will be installed in the same PATH of the previous installation
|
|---|
| 185 |
|
|---|
| 186 | ;3. downgrade installation = if a newer release of GRASS is already installed
|
|---|
| 187 | ;call the uninstaller of the currently installed GRASS release
|
|---|
| 188 | ;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
|
|---|
| 189 | ;GRASS will be installed in the same PATH of the previous installation
|
|---|
| 190 |
|
|---|
| 191 | ;4. repair installation = if the same release of GRASS is already installed
|
|---|
| 192 | ;call the uninstaller of the currently installed GRASS release
|
|---|
| 193 | ;if the uninstall procedure succeeded, call the current installer asking for the install PATH
|
|---|
| 194 |
|
|---|
| 195 | ;the currently installed release of GRASS is defined by the variable $INSTALLED_VERSION = $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
|
|---|
| 196 |
|
|---|
| 197 | Function .onInit
|
|---|
| 198 |
|
|---|
| 199 | Var /GLOBAL ASK_FOR_PATH
|
|---|
| 200 | StrCpy $ASK_FOR_PATH "YES"
|
|---|
| 201 |
|
|---|
| 202 | Var /GLOBAL UNINSTALL_STRING
|
|---|
| 203 | Var /GLOBAL INSTALL_PATH
|
|---|
| 204 |
|
|---|
| 205 | Var /GLOBAL INSTALLED_VERSION_NUMBER
|
|---|
| 206 | Var /GLOBAL INSTALLED_SVN_REVISION
|
|---|
| 207 | Var /GLOBAL INSTALLED_BINARY_REVISION
|
|---|
| 208 |
|
|---|
| 209 | Var /GLOBAL INSTALLED_VERSION
|
|---|
| 210 |
|
|---|
| 211 | Var /GLOBAL DISPLAYED_INSTALLED_VERSION
|
|---|
| 212 |
|
|---|
| 213 | Var /GLOBAL MESSAGE_0_
|
|---|
| 214 | Var /GLOBAL MESSAGE_1_
|
|---|
| 215 | Var /GLOBAL MESSAGE_2_
|
|---|
| 216 | Var /GLOBAL MESSAGE_3_
|
|---|
| 217 |
|
|---|
| 218 | ReadRegStr $UNINSTALL_STRING HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString"
|
|---|
| 219 | ReadRegStr $INSTALL_PATH HKLM "Software\${GRASS_BASE}" "InstallPath"
|
|---|
| 220 | ReadRegStr $INSTALLED_VERSION_NUMBER HKLM "Software\${GRASS_BASE}" "VersionNumber"
|
|---|
| 221 | ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${GRASS_BASE}" "SvnRevision"
|
|---|
| 222 |
|
|---|
| 223 | ${If} $INSTALLED_SVN_REVISION == ""
|
|---|
| 224 | ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${GRASS_BASE}" "Revision"
|
|---|
| 225 | ${EndIf}
|
|---|
| 226 |
|
|---|
| 227 | ReadRegStr $INSTALLED_BINARY_REVISION HKLM "Software\${GRASS_BASE}" "BinaryRevision"
|
|---|
| 228 |
|
|---|
| 229 | StrCpy $MESSAGE_0_ "${CHECK_INSTALL_NAME} is already installed on your system.$\r$\n"
|
|---|
| 230 | StrCpy $MESSAGE_0_ "$MESSAGE_0_$\r$\n"
|
|---|
| 231 |
|
|---|
| 232 | !if ${INSTALLER_TYPE} == "Release"
|
|---|
| 233 | ${If} $INSTALLED_BINARY_REVISION == ""
|
|---|
| 234 | StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER"
|
|---|
| 235 | ${Else}
|
|---|
| 236 | StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION"
|
|---|
| 237 | ${EndIf}
|
|---|
| 238 | !else
|
|---|
| 239 | StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_SVN_REVISION-$INSTALLED_BINARY_REVISION"
|
|---|
| 240 | !endif
|
|---|
| 241 |
|
|---|
| 242 | StrCpy $MESSAGE_0_ "$MESSAGE_0_The installed release is $DISPLAYED_INSTALLED_VERSION$\r$\n"
|
|---|
| 243 |
|
|---|
| 244 | StrCpy $MESSAGE_1_ "$MESSAGE_0_$\r$\n"
|
|---|
| 245 | StrCpy $MESSAGE_1_ "$MESSAGE_1_You are going to install a newer release of ${CHECK_INSTALL_NAME}$\r$\n"
|
|---|
| 246 | StrCpy $MESSAGE_1_ "$MESSAGE_1_$\r$\n"
|
|---|
| 247 | StrCpy $MESSAGE_1_ "$MESSAGE_1_Press OK to uninstall GRASS $DISPLAYED_INSTALLED_VERSION"
|
|---|
| 248 | StrCpy $MESSAGE_1_ "$MESSAGE_1_ and install ${DISPLAYED_NAME} or Cancel to quit."
|
|---|
| 249 |
|
|---|
| 250 | StrCpy $MESSAGE_2_ "$MESSAGE_0_$\r$\n"
|
|---|
| 251 | StrCpy $MESSAGE_2_ "$MESSAGE_2_You are going to install an older release of ${CHECK_INSTALL_NAME}$\r$\n"
|
|---|
| 252 | StrCpy $MESSAGE_2_ "$MESSAGE_2_$\r$\n"
|
|---|
| 253 | StrCpy $MESSAGE_2_ "$MESSAGE_2_Press OK to uninstall GRASS $DISPLAYED_INSTALLED_VERSION"
|
|---|
| 254 | StrCpy $MESSAGE_2_ "$MESSAGE_2_ and install ${DISPLAYED_NAME} or Cancel to quit."
|
|---|
| 255 |
|
|---|
| 256 | StrCpy $MESSAGE_3_ "$MESSAGE_0_$\r$\n"
|
|---|
| 257 | StrCpy $MESSAGE_3_ "$MESSAGE_3_This is the latest release available.$\r$\n"
|
|---|
| 258 | StrCpy $MESSAGE_3_ "$MESSAGE_3_$\r$\n"
|
|---|
| 259 | StrCpy $MESSAGE_3_ "$MESSAGE_3_Press OK to reinstall ${DISPLAYED_NAME} or Cancel to quit."
|
|---|
| 260 |
|
|---|
| 261 | IntOp $INSTALLED_SVN_REVISION $INSTALLED_SVN_REVISION * 1
|
|---|
| 262 | IntOp $INSTALLED_BINARY_REVISION $INSTALLED_BINARY_REVISION * 1
|
|---|
| 263 | IntOp $INSTALLED_VERSION $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION
|
|---|
| 264 |
|
|---|
| 265 | !define /math VERSION ${SVN_REVISION} + ${BINARY_REVISION}
|
|---|
| 266 |
|
|---|
| 267 | ${If} $INSTALLED_VERSION_NUMBER == ""
|
|---|
| 268 | ${Else}
|
|---|
| 269 | ${If} $INSTALLED_VERSION < ${VERSION}
|
|---|
| 270 | MessageBox MB_OKCANCEL "$MESSAGE_1_" IDOK upgrade IDCANCEL quit_upgrade
|
|---|
| 271 | upgrade:
|
|---|
| 272 | StrCpy $ASK_FOR_PATH "NO"
|
|---|
| 273 | ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
|
|---|
| 274 | Goto continue_upgrade
|
|---|
| 275 | quit_upgrade:
|
|---|
| 276 | Abort
|
|---|
| 277 | continue_upgrade:
|
|---|
| 278 | ${ElseIf} $INSTALLED_VERSION > ${VERSION}
|
|---|
| 279 | MessageBox MB_OKCANCEL "$MESSAGE_2_" IDOK downgrade IDCANCEL quit_downgrade
|
|---|
| 280 | downgrade:
|
|---|
| 281 | StrCpy $ASK_FOR_PATH "NO"
|
|---|
| 282 | ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
|
|---|
| 283 | Goto continue_downgrade
|
|---|
| 284 | quit_downgrade:
|
|---|
| 285 | Abort
|
|---|
| 286 | continue_downgrade:
|
|---|
| 287 | ${ElseIf} $INSTALLED_VERSION = ${VERSION}
|
|---|
| 288 | MessageBox MB_OKCANCEL "$MESSAGE_3_" IDOK reinstall IDCANCEL quit_reinstall
|
|---|
| 289 | reinstall:
|
|---|
| 290 | ExecWait '"$UNINSTALL_STRING" _?=$INSTALL_PATH' $0
|
|---|
| 291 | Goto continue_reinstall
|
|---|
| 292 | quit_reinstall:
|
|---|
| 293 | Abort
|
|---|
| 294 | continue_reinstall:
|
|---|
| 295 | ${EndIf}
|
|---|
| 296 | ${EndIf}
|
|---|
| 297 |
|
|---|
| 298 | ${If} $INSTALLED_VERSION_NUMBER == ""
|
|---|
| 299 | ${Else}
|
|---|
| 300 | ${If} $0 = 0
|
|---|
| 301 | ${Else}
|
|---|
| 302 | Abort
|
|---|
| 303 | ${EndIf}
|
|---|
| 304 | ${EndIf}
|
|---|
| 305 |
|
|---|
| 306 | FunctionEnd
|
|---|
| 307 |
|
|---|
| 308 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 309 |
|
|---|
| 310 | ;CheckUpdate Function
|
|---|
| 311 | ;Check if to show the MUI_PAGE_DIRECTORY during the installation (to ask for the install PATH)
|
|---|
| 312 |
|
|---|
| 313 | Function CheckUpdate
|
|---|
| 314 |
|
|---|
| 315 | ${If} $ASK_FOR_PATH == "NO"
|
|---|
| 316 | Abort
|
|---|
| 317 | ${EndIf}
|
|---|
| 318 |
|
|---|
| 319 | FunctionEnd
|
|---|
| 320 |
|
|---|
| 321 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 322 |
|
|---|
| 323 | ;CheckInstDir Function
|
|---|
| 324 | ;Check if GRASS is going to be installed in a directory containing spaces
|
|---|
| 325 | ;if yes, show a warning message
|
|---|
| 326 |
|
|---|
| 327 | Function CheckInstDir
|
|---|
| 328 |
|
|---|
| 329 | Var /GLOBAL INSTDIR_TEST
|
|---|
| 330 | Var /GLOBAL INSTDIR_LENGHT
|
|---|
| 331 | Var /GLOBAL INSTDIR_TEST_LENGHT
|
|---|
| 332 | Var /GLOBAL MESSAGE_CHKINST_
|
|---|
| 333 |
|
|---|
| 334 | StrCpy $MESSAGE_CHKINST_ "WARNING: you are about to install GRASS into a directory that has spaces$\r$\n"
|
|---|
| 335 | StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_in either its name or the path of directories leading up to it.$\r$\n"
|
|---|
| 336 | StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_Some functionalities of GRASS might be hampered by this. We would highly$\r$\n"
|
|---|
| 337 | StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_appreciate if you tried and reported any problems, so that we can fix them.$\r$\n"
|
|---|
| 338 | StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_However, if you want to avoid any such issues, we recommend that you$\r$\n"
|
|---|
| 339 | StrCpy $MESSAGE_CHKINST_ "$MESSAGE_CHKINST_choose a simple installation path without spaces, such as: C:\${GRASS_BASE}.$\r$\n"
|
|---|
| 340 |
|
|---|
| 341 | ${StrReplace} "$INSTDIR_TEST" " " "" "$INSTDIR"
|
|---|
| 342 |
|
|---|
| 343 | StrLen $INSTDIR_LENGHT "$INSTDIR"
|
|---|
| 344 | StrLen $INSTDIR_TEST_LENGHT "$INSTDIR_TEST"
|
|---|
| 345 |
|
|---|
| 346 | ${If} $INSTDIR_TEST_LENGHT < $INSTDIR_LENGHT
|
|---|
| 347 | MessageBox MB_OK|MB_ICONEXCLAMATION "$MESSAGE_CHKINST_"
|
|---|
| 348 | ${EndIf}
|
|---|
| 349 |
|
|---|
| 350 | FunctionEnd
|
|---|
| 351 |
|
|---|
| 352 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 353 |
|
|---|
| 354 | ;Interface Settings
|
|---|
| 355 |
|
|---|
| 356 | !define MUI_ABORTWARNING
|
|---|
| 357 | !define MUI_ICON ".\Installer-Files\Install_GRASS.ico"
|
|---|
| 358 | !define MUI_UNICON ".\Installer-Files\Uninstall_GRASS.ico"
|
|---|
| 359 | !define MUI_HEADERIMAGE_BITMAP_NOSTETCH ".\Installer-Files\InstallHeaderImage.bmp"
|
|---|
| 360 | !define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH ".\Installer-Files\UnInstallHeaderImage.bmp"
|
|---|
| 361 | !define MUI_WELCOMEFINISHPAGE_BITMAP ".\Installer-Files\WelcomeFinishPage.bmp"
|
|---|
| 362 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\Installer-Files\UnWelcomeFinishPage.bmp"
|
|---|
| 363 |
|
|---|
| 364 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 365 |
|
|---|
| 366 | ;Installer Pages
|
|---|
| 367 |
|
|---|
| 368 | !insertmacro MUI_PAGE_WELCOME
|
|---|
| 369 | !insertmacro MUI_PAGE_LICENSE "${PACKAGE_FOLDER}\GPL.TXT"
|
|---|
| 370 |
|
|---|
| 371 | !define MUI_PAGE_CUSTOMFUNCTION_PRE CheckUpdate
|
|---|
| 372 | !insertmacro MUI_PAGE_DIRECTORY
|
|---|
| 373 |
|
|---|
| 374 | Page custom CheckInstDir
|
|---|
| 375 |
|
|---|
| 376 | !insertmacro MUI_PAGE_COMPONENTS
|
|---|
| 377 | !insertmacro MUI_PAGE_INSTFILES
|
|---|
| 378 | !insertmacro MUI_PAGE_FINISH
|
|---|
| 379 |
|
|---|
| 380 | !insertmacro MUI_UNPAGE_WELCOME
|
|---|
| 381 | !insertmacro MUI_UNPAGE_CONFIRM
|
|---|
| 382 | !insertmacro MUI_UNPAGE_INSTFILES
|
|---|
| 383 | !insertmacro MUI_UNPAGE_FINISH
|
|---|
| 384 |
|
|---|
| 385 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 386 |
|
|---|
| 387 | ;Language files
|
|---|
| 388 |
|
|---|
| 389 | !insertmacro MUI_LANGUAGE "English"
|
|---|
| 390 |
|
|---|
| 391 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 392 |
|
|---|
| 393 | ;Installer Sections
|
|---|
| 394 |
|
|---|
| 395 | ;Declares the variables for optional Sample Data Sections
|
|---|
| 396 | Var /GLOBAL HTTP_PATH
|
|---|
| 397 | Var /GLOBAL ARCHIVE_NAME
|
|---|
| 398 | Var /GLOBAL EXTENDED_ARCHIVE_NAME
|
|---|
| 399 | Var /GLOBAL ORIGINAL_UNTAR_FOLDER
|
|---|
| 400 | Var /GLOBAL CUSTOM_UNTAR_FOLDER
|
|---|
| 401 | Var /GLOBAL ARCHIVE_SIZE_KB
|
|---|
| 402 | Var /GLOBAL ARCHIVE_SIZE_MB
|
|---|
| 403 | Var /GLOBAL DOWNLOAD_MESSAGE_
|
|---|
| 404 |
|
|---|
| 405 | Section "GRASS" SecGRASS
|
|---|
| 406 |
|
|---|
| 407 | SectionIn RO
|
|---|
| 408 |
|
|---|
| 409 | ;Set the INSTALL_DIR variable
|
|---|
| 410 | Var /GLOBAL INSTALL_DIR
|
|---|
| 411 |
|
|---|
| 412 | ${If} $ASK_FOR_PATH == "NO"
|
|---|
| 413 | StrCpy $INSTALL_DIR "$INSTALL_PATH"
|
|---|
| 414 | ${Else}
|
|---|
| 415 | StrCpy $INSTALL_DIR "$INSTDIR"
|
|---|
| 416 | ${EndIf}
|
|---|
| 417 |
|
|---|
| 418 | ;Set to try to overwrite existing files
|
|---|
| 419 | SetOverwrite try
|
|---|
| 420 |
|
|---|
| 421 | ;Set the GIS_DATABASE directory
|
|---|
| 422 | SetShellVarContext current
|
|---|
| 423 | Var /GLOBAL GIS_DATABASE
|
|---|
| 424 | StrCpy $GIS_DATABASE "$DOCUMENTS\GIS DataBase"
|
|---|
| 425 |
|
|---|
| 426 | ;Create the GIS_DATABASE directory
|
|---|
| 427 | CreateDirectory "$GIS_DATABASE"
|
|---|
| 428 |
|
|---|
| 429 | ;add Installer files
|
|---|
| 430 | SetOutPath "$INSTALL_DIR\icons"
|
|---|
| 431 | File .\Installer-Files\GRASS.ico
|
|---|
| 432 | File .\Installer-Files\GRASS_Web.ico
|
|---|
| 433 | File .\Installer-Files\GRASS_tcltk.ico
|
|---|
| 434 | File .\Installer-Files\GRASS_MSys.ico
|
|---|
| 435 | File .\Installer-Files\GRASS_CMD.ico
|
|---|
| 436 | File .\Installer-Files\MSYS_Custom_Icon.ico
|
|---|
| 437 | File .\Installer-Files\WinGRASS.ico
|
|---|
| 438 | SetOutPath "$INSTALL_DIR"
|
|---|
| 439 | File .\Installer-Files\GRASS-WebSite.url
|
|---|
| 440 | File .\Installer-Files\WinGRASS-README.url
|
|---|
| 441 |
|
|---|
| 442 | ;add GRASS files
|
|---|
| 443 | SetOutPath "$INSTALL_DIR"
|
|---|
| 444 | File /r ${PACKAGE_FOLDER}\*.*
|
|---|
| 445 |
|
|---|
| 446 | ;Install demolocation into the GIS_DATABASE directory
|
|---|
| 447 | SetOutPath "$GIS_DATABASE\demolocation"
|
|---|
| 448 | File /r ${DEMOLOCATION_PATH}\*.*
|
|---|
| 449 |
|
|---|
| 450 | ;Create the Uninstaller
|
|---|
| 451 | WriteUninstaller "$INSTALL_DIR\Uninstall-GRASS.exe"
|
|---|
| 452 |
|
|---|
| 453 | ;Registry Key Entries
|
|---|
| 454 |
|
|---|
| 455 | ;HKEY_LOCAL_MACHINE Install entries
|
|---|
| 456 | ;Set the Name, Version and Revision of GRASS + PublisherInfo + InstallPath
|
|---|
| 457 | WriteRegStr HKLM "Software\${GRASS_BASE}" "Name" "GRASS"
|
|---|
| 458 | WriteRegStr HKLM "Software\${GRASS_BASE}" "VersionNumber" "${VERSION_NUMBER}"
|
|---|
| 459 | WriteRegStr HKLM "Software\${GRASS_BASE}" "SvnRevision" "${SVN_REVISION}"
|
|---|
| 460 | WriteRegStr HKLM "Software\${GRASS_BASE}" "BinaryRevision" "${BINARY_REVISION}"
|
|---|
| 461 | WriteRegStr HKLM "Software\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
|
|---|
| 462 | WriteRegStr HKLM "Software\${GRASS_BASE}" "WebSite" "${WEB_SITE}"
|
|---|
| 463 | WriteRegStr HKLM "Software\${GRASS_BASE}" "InstallPath" "$INSTALL_DIR"
|
|---|
| 464 |
|
|---|
| 465 | ;HKEY_LOCAL_MACHINE Uninstall entries
|
|---|
| 466 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayName" "GRASS"
|
|---|
| 467 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString" "$INSTALL_DIR\Uninstall-GRASS.exe"
|
|---|
| 468 |
|
|---|
| 469 | !if ${INSTALLER_TYPE} == "Release"
|
|---|
| 470 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\
|
|---|
| 471 | "DisplayVersion" "${VERSION_NUMBER}-${BINARY_REVISION}"
|
|---|
| 472 | !else
|
|---|
| 473 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\
|
|---|
| 474 | "DisplayVersion" "${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
|
|---|
| 475 | !endif
|
|---|
| 476 |
|
|---|
| 477 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayIcon" "$INSTALL_DIR\icons\GRASS.ico"
|
|---|
| 478 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "EstimatedSize" 1
|
|---|
| 479 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "HelpLink" "${WIKI_PAGE}"
|
|---|
| 480 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "URLInfoAbout" "${WEB_SITE}"
|
|---|
| 481 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
|
|---|
| 482 |
|
|---|
| 483 | ;Create the Desktop Shortcut
|
|---|
| 484 | SetShellVarContext current
|
|---|
| 485 |
|
|---|
| 486 | CreateShortCut "$DESKTOP\GRASS ${VERSION_NUMBER}.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "-wxpython"\
|
|---|
| 487 | "$INSTALL_DIR\icons\GRASS.ico" "" SW_SHOWMINIMIZED "" "Launch GRASS ${VERSION_NUMBER} with the new wxPython GUI"
|
|---|
| 488 |
|
|---|
| 489 | CreateShortCut "$DESKTOP\GRASS ${VERSION_NUMBER} with MSYS.lnk" "$INSTALL_DIR\msys\msys.bat" "/grass/bin/${GRASS_COMMAND} -wxpython"\
|
|---|
| 490 | "$INSTALL_DIR\icons\GRASS_MSys.ico" "" SW_SHOWNORMAL "" "Launch GRASS ${VERSION_NUMBER} with the new wxPython GUI and a MSYS UNIX terminal"
|
|---|
| 491 |
|
|---|
| 492 | ;Create the Windows Start Menu Shortcuts
|
|---|
| 493 | SetShellVarContext all
|
|---|
| 494 |
|
|---|
| 495 | CreateDirectory "$SMPROGRAMS\${GRASS_BASE}"
|
|---|
| 496 |
|
|---|
| 497 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\GRASS Old TclTk GUI.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "-tcltk"\
|
|---|
| 498 | "$INSTALL_DIR\icons\GRASS_tcltk.ico" "" SW_SHOWMINIMIZED "" "Launch GRASS ${VERSION_NUMBER} with the old TclTk GUI"
|
|---|
| 499 |
|
|---|
| 500 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\GRASS ${VERSION_NUMBER}.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "-wxpython"\
|
|---|
| 501 | "$INSTALL_DIR\icons\GRASS.ico" "" SW_SHOWMINIMIZED "" "Launch GRASS ${VERSION_NUMBER} with the new wxPython GUI"
|
|---|
| 502 |
|
|---|
| 503 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\GRASS Command Line.lnk" "$INSTALL_DIR\${GRASS_COMMAND}.bat" "-text"\
|
|---|
| 504 | "$INSTALL_DIR\icons\GRASS_CMD.ico" "" SW_SHOWNORMAL "" "Launch GRASS in text mode"
|
|---|
| 505 |
|
|---|
| 506 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\MSYS UNIX Console.lnk" "$INSTALL_DIR\msys\msys.bat" ""\
|
|---|
| 507 | "$INSTALL_DIR\icons\MSYS_Custom_Icon.ico" "" SW_SHOWNORMAL "" "Open a MSYS UNIX console"
|
|---|
| 508 |
|
|---|
| 509 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\GRASS Web Site.lnk" "$INSTALL_DIR\GRASS-WebSite.url" ""\
|
|---|
| 510 | "$INSTALL_DIR\icons\GRASS_Web.ico" "" SW_SHOWNORMAL "" "Visit the GRASS website"
|
|---|
| 511 |
|
|---|
| 512 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\GRASS ${VERSION_NUMBER} with MSYS.lnk" "$INSTALL_DIR\msys\msys.bat" "/grass/bin/${GRASS_COMMAND} -wxpython"\
|
|---|
| 513 | "$INSTALL_DIR\icons\GRASS_MSys.ico" "" SW_SHOWNORMAL "" "Launch GRASS ${VERSION_NUMBER} with the new wxPython GUI and a MSYS UNIX terminal"
|
|---|
| 514 |
|
|---|
| 515 | ; FIXME: ship the WinGrass release notes .html file instead of URL
|
|---|
| 516 | ; http://trac.osgeo.org/grass/browser/grass-web/trunk/grass64/binary/mswindows/native/README.html?format=raw
|
|---|
| 517 | ; probably ship with devel versions too? ie Release Notes, not the Release Announcement press release.
|
|---|
| 518 | !if ${INSTALLER_TYPE} == "Release"
|
|---|
| 519 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\Release Notes.lnk" "$INSTALL_DIR\WinGRASS-README.url" ""\
|
|---|
| 520 | "$INSTALL_DIR\icons\WinGRASS.ico" "" SW_SHOWNORMAL "" "Visit the WinGRASS Project Web Page"
|
|---|
| 521 | !endif
|
|---|
| 522 |
|
|---|
| 523 | CreateShortCut "$SMPROGRAMS\${GRASS_BASE}\Uninstall GRASS.lnk" "$INSTALL_DIR\Uninstall-GRASS.exe" ""\
|
|---|
| 524 | "$INSTALL_DIR\Uninstall-GRASS.exe" "" SW_SHOWNORMAL "" "Uninstall GRASS ${VERSION_NUMBER}"
|
|---|
| 525 |
|
|---|
| 526 | ;Create the grass_command.bat
|
|---|
| 527 | ClearErrors
|
|---|
| 528 | FileOpen $0 $INSTALL_DIR\${GRASS_COMMAND}.bat w
|
|---|
| 529 | IfErrors done_create_grass_command.bat
|
|---|
| 530 | FileWrite $0 '@echo off$\r$\n'
|
|---|
| 531 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 532 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 533 | FileWrite $0 'rem # File dynamically created by NSIS installer script;$\r$\n'
|
|---|
| 534 | FileWrite $0 'rem # Written by Marco Pasetti;$\r$\n'
|
|---|
| 535 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 536 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 537 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 538 | FileWrite $0 'rem # GRASS Initialization$\r$\n'
|
|---|
| 539 | FileWrite $0 'rem #$\r$\n'
|
|---|
| 540 | FileWrite $0 'rem #########################################################################$\r$\n'
|
|---|
| 541 | FileWrite $0 '$\r$\n'
|
|---|
| 542 | FileWrite $0 'rem *******Environment variables***********$\r$\n'
|
|---|
| 543 | FileWrite $0 '$\r$\n'
|
|---|
| 544 | FileWrite $0 'rem Set GRASS Installation Directory Variable$\r$\n'
|
|---|
| 545 | FileWrite $0 'set GRASSDIR=$INSTALL_DIR$\r$\n'
|
|---|
| 546 | FileWrite $0 '$\r$\n'
|
|---|
| 547 | FileWrite $0 'rem Directory where your .grassrc6 file will be stored$\r$\n'
|
|---|
| 548 | FileWrite $0 'set HOME=%USERPROFILE%$\r$\n'
|
|---|
| 549 | FileWrite $0 '$\r$\n'
|
|---|
| 550 | FileWrite $0 'rem Name of the wish (Tk) executable$\r$\n'
|
|---|
| 551 | FileWrite $0 'set GRASS_WISH=wish.exe$\r$\n'
|
|---|
| 552 | FileWrite $0 '$\r$\n'
|
|---|
| 553 | FileWrite $0 'rem Path to the shell command$\r$\n'
|
|---|
| 554 | FileWrite $0 'set GRASS_SH=%GRASSDIR%\msys\bin\sh.exe$\r$\n'
|
|---|
| 555 | FileWrite $0 '$\r$\n'
|
|---|
| 556 | FileWrite $0 'rem Set Path to utilities (libraries and bynaries) used by GRASS$\r$\n'
|
|---|
| 557 | FileWrite $0 'set PATH=%GRASSDIR%\msys\bin;%PATH%$\r$\n'
|
|---|
| 558 | FileWrite $0 'set PATH=%GRASSDIR%\extrabin;%GRASSDIR%\extralib;%PATH%$\r$\n'
|
|---|
| 559 | FileWrite $0 'set PATH=%GRASSDIR%\tcl-tk\bin;%GRASSDIR%\sqlite\bin;%GRASSDIR%\gpsbabel;%PATH%$\r$\n'
|
|---|
| 560 | FileWrite $0 '$\r$\n'
|
|---|
| 561 | FileWrite $0 'rem Set Path to MSIE web browser$\r$\n'
|
|---|
| 562 | ; FIXME
|
|---|
| 563 | ; ${If} exist %PROGRAMFILES%/Mozilla Firefox/firefox.exe
|
|---|
| 564 | ;FileWrite $0 'set GRASS_HTML_BROWSER=%PROGRAMFILES%/Mozilla Firefox/firefox.exe$\r$\n'
|
|---|
| 565 | ; ${Else}
|
|---|
| 566 | FileWrite $0 'set GRASS_HTML_BROWSER=%PROGRAMFILES%/Internet Explorer/iexplore.exe$\r$\n'
|
|---|
| 567 | ; ${EndIf}
|
|---|
| 568 | FileWrite $0 '$\r$\n'
|
|---|
| 569 | FileWrite $0 'rem Path to the proj files (notably the epsg projection list)$\r$\n'
|
|---|
| 570 | FileWrite $0 'set GRASS_PROJSHARE=%GRASSDIR%\proj$\r$\n'
|
|---|
| 571 | FileWrite $0 '$\r$\n'
|
|---|
| 572 | FileWrite $0 'rem Path to the python directory$\r$\n'
|
|---|
| 573 | FileWrite $0 'set PYTHONHOME=%GRASSDIR%\Python25$\r$\n'
|
|---|
| 574 | FileWrite $0 '$\r$\n'
|
|---|
| 575 | FileWrite $0 'set WINGISBASE=%GRASSDIR%$\r$\n'
|
|---|
| 576 | FileWrite $0 '"%WINGISBASE%\etc\Init.bat" %*'
|
|---|
| 577 | FileClose $0
|
|---|
| 578 | done_create_grass_command.bat:
|
|---|
| 579 |
|
|---|
| 580 | ;Set the UNIX_LIKE GRASS Path
|
|---|
| 581 | Var /GLOBAL UNIX_LIKE_DRIVE
|
|---|
| 582 | Var /GLOBAL UNIX_LIKE_GRASS_PATH
|
|---|
| 583 |
|
|---|
| 584 | StrCpy $UNIX_LIKE_DRIVE "$INSTALL_DIR" 3
|
|---|
| 585 | StrCpy $UNIX_LIKE_GRASS_PATH "$INSTALL_DIR" "" 3
|
|---|
| 586 |
|
|---|
| 587 | ;replace "\" with "/" in $UNIX_LIKE_DRIVE
|
|---|
| 588 | ${StrReplace} "$UNIX_LIKE_DRIVE" "\" "/" "$UNIX_LIKE_DRIVE"
|
|---|
| 589 |
|
|---|
| 590 | ;replace ":" with "" in $UNIX_LIKE_DRIVE
|
|---|
| 591 | ${StrReplace} "$UNIX_LIKE_DRIVE" ":" "" "$UNIX_LIKE_DRIVE"
|
|---|
| 592 |
|
|---|
| 593 | ;replace "\" with "/" in $UNIX_LIKE_GRASS_PATH
|
|---|
| 594 | ${StrReplace} "$UNIX_LIKE_GRASS_PATH" "\" "/" "$UNIX_LIKE_GRASS_PATH"
|
|---|
| 595 |
|
|---|
| 596 | ;Set the USERNAME variable
|
|---|
| 597 | Var /GLOBAL USERNAME
|
|---|
| 598 | Var /GLOBAL PROFILE_DRIVE
|
|---|
| 599 | Var /GLOBAL PROFILE_ROOT
|
|---|
| 600 |
|
|---|
| 601 | ;It first searches for the Key Regestry value "Logon User Name" in HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer"
|
|---|
| 602 | ReadRegStr $USERNAME HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Logon User Name"
|
|---|
| 603 |
|
|---|
| 604 | ;If the Key Registry value is empty, it uses a work around, retrieving the Username string from the System User Profile variable ($PROFILE)
|
|---|
| 605 | ;It first read the $PROFILE variable, to scan the OS version:
|
|---|
| 606 | ;If equal to "drive:\Users\UserName", the OS is Vista, and the $USERNAME variable set to $PROFILE - "drive:\Users\"
|
|---|
| 607 | ;If not, the OS is XP or previous, and the $USERNAME variable set to $PROFILE - "drive:\Documents and Settings\"
|
|---|
| 608 |
|
|---|
| 609 | ${If} $USERNAME = ""
|
|---|
| 610 | StrCpy $PROFILE_DRIVE "$PROFILE" 2
|
|---|
| 611 | StrCpy $PROFILE_ROOT "$PROFILE" 5 -3
|
|---|
| 612 | ${If} $USERNAME = "Users"
|
|---|
| 613 | ${StrReplace} "$USERNAME" "$PROFILE_DRIVE\Users\" "" "$PROFILE"
|
|---|
| 614 | ${Else}
|
|---|
| 615 | ${StrReplace} "$USERNAME" "$PROFILE_DRIVE\Documents and Settings\" "" "$PROFILE"
|
|---|
| 616 | ${EndIf}
|
|---|
| 617 | ${EndIf}
|
|---|
| 618 |
|
|---|
| 619 | ;Create the $INSTALL_DIR\msys\home and the $INSTALL_DIR\msys\home\$USERNAME directories
|
|---|
| 620 | CreateDirectory $INSTALL_DIR\msys\home
|
|---|
| 621 | CreateDirectory $INSTALL_DIR\msys\home\$USERNAME
|
|---|
| 622 |
|
|---|
| 623 | ;create the $INSTALL_DIR\bin grass_command
|
|---|
| 624 | ClearErrors
|
|---|
| 625 | FileOpen $0 $INSTALL_DIR\bin\${GRASS_COMMAND} w
|
|---|
| 626 | IfErrors done_create_grass_command
|
|---|
| 627 | FileWrite $0 '#! /bin/sh$\r$\n'
|
|---|
| 628 | FileWrite $0 '#########################################################################$\r$\n'
|
|---|
| 629 | FileWrite $0 '#$\r$\n'
|
|---|
| 630 | FileWrite $0 '# File dynamically created by NSIS installer script;$\r$\n'
|
|---|
| 631 | FileWrite $0 '# Written by Marco Pasetti;$\r$\n'
|
|---|
| 632 | FileWrite $0 '#$\r$\n'
|
|---|
| 633 | FileWrite $0 '#########################################################################$\r$\n'
|
|---|
| 634 | FileWrite $0 '#$\r$\n'
|
|---|
| 635 | FileWrite $0 '# MODULE: GRASS Initialization$\r$\n'
|
|---|
| 636 | FileWrite $0 '# AUTHOR(S): Justin Hickey - Thailand - jhickey@hpcc.nectec.or.th$\r$\n'
|
|---|
| 637 | FileWrite $0 '# PURPOSE: The source file for this shell script is in$\r$\n'
|
|---|
| 638 | FileWrite $0 '# lib/init/grass.src and is the grass startup script. It$\r$\n'
|
|---|
| 639 | FileWrite $0 '# requires a source file because the definition of GISBASE$\r$\n'
|
|---|
| 640 | FileWrite $0 '# is not known until compile time and is substituted from the$\r$\n'
|
|---|
| 641 | FileWrite $0 '# Makefile. Any command line options are passed to Init.sh.$\r$\n'
|
|---|
| 642 | FileWrite $0 '# COPYRIGHT: (C) 2000-2009 by the GRASS Development Team$\r$\n'
|
|---|
| 643 | FileWrite $0 '#$\r$\n'
|
|---|
| 644 | FileWrite $0 '# This program is free software under the GNU General Public$\r$\n'
|
|---|
| 645 | FileWrite $0 '# License (>=v2). Read the file COPYING that comes with GRASS$\r$\n'
|
|---|
| 646 | FileWrite $0 '# for details.$\r$\n'
|
|---|
| 647 | FileWrite $0 '#$\r$\n'
|
|---|
| 648 | FileWrite $0 '#########################################################################$\r$\n'
|
|---|
| 649 | FileWrite $0 '#$\r$\n'
|
|---|
| 650 | FileWrite $0 '# Modified by Marco Pasetti$\r$\n'
|
|---|
| 651 | FileWrite $0 '# added the export PATH instruction to let GRASS work from$\r$\n'
|
|---|
| 652 | FileWrite $0 '# the MSYS environment in the dynamic NSIS installation$\r$\n'
|
|---|
| 653 | FileWrite $0 '#$\r$\n'
|
|---|
| 654 | FileWrite $0 '#########################################################################$\r$\n'
|
|---|
| 655 | FileWrite $0 '$\r$\n'
|
|---|
| 656 | FileWrite $0 'trap "echo '
|
|---|
| 657 | FileWrite $0 "'User break!' ; "
|
|---|
| 658 | FileWrite $0 'exit" 2 3 9 15$\r$\n'
|
|---|
| 659 | FileWrite $0 '$\r$\n'
|
|---|
| 660 | FileWrite $0 '# Set the GISBASE variable$\r$\n'
|
|---|
| 661 | FileWrite $0 'GISBASE="/$UNIX_LIKE_DRIVE$UNIX_LIKE_GRASS_PATH"$\r$\n'
|
|---|
| 662 | FileWrite $0 'export GISBASE$\r$\n'
|
|---|
| 663 | FileWrite $0 '$\r$\n'
|
|---|
| 664 | FileWrite $0 '# Set the PATH variable$\r$\n'
|
|---|
| 665 | FileWrite $0 'PATH="$$GISBASE/extrabin:$$GISBASE/extralib:$$PATH"$\r$\n'
|
|---|
| 666 | FileWrite $0 'PATH="$$GISBASE/tcl-tk/bin:$$GISBASE/sqlite/bin:$$GISBASE/gpsbabel:$$PATH"$\r$\n'
|
|---|
| 667 | FileWrite $0 'export PATH$\r$\n'
|
|---|
| 668 | FileWrite $0 '# Set the PYTHONPATH variable$\r$\n'
|
|---|
| 669 | FileWrite $0 'PYTHONPATH="$$GISBASE/etc/python:$$GISBASE/Python25:$$PYTHONPATH"$\r$\n'
|
|---|
| 670 | FileWrite $0 'export PYTHONPATH$\r$\n'
|
|---|
| 671 | FileWrite $0 'PYTHONHOME="$INSTALL_DIR\Python25"$\r$\n'
|
|---|
| 672 | FileWrite $0 'export PYTHONHOME$\r$\n'
|
|---|
| 673 | FileWrite $0 '$\r$\n'
|
|---|
| 674 | FileWrite $0 '# Set the GRASS_PROJSHARE variable$\r$\n'
|
|---|
| 675 | FileWrite $0 'GRASS_PROJSHARE="$INSTALL_DIR\proj"$\r$\n'
|
|---|
| 676 | FileWrite $0 'export GRASS_PROJSHARE$\r$\n'
|
|---|
| 677 | FileWrite $0 '$\r$\n'
|
|---|
| 678 | FileWrite $0 'exec "$$GISBASE/etc/Init.sh" "$$@"'
|
|---|
| 679 | FileClose $0
|
|---|
| 680 | done_create_grass_command:
|
|---|
| 681 |
|
|---|
| 682 | ;Create the $INSTALL_DIR\msys\grass link directory
|
|---|
| 683 | CreateDirectory $INSTALL_DIR\msys\grass
|
|---|
| 684 |
|
|---|
| 685 | ;Get the short form of the install path (to allow for paths with spaces)
|
|---|
| 686 | VAR /GLOBAL INST_DIR_SHORT
|
|---|
| 687 | GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR
|
|---|
| 688 |
|
|---|
| 689 | ;create the $INSTALL_DIR\msys\etc\fstab with the main grass dir mount info
|
|---|
| 690 | ClearErrors
|
|---|
| 691 | FileOpen $0 $INSTALL_DIR\msys\etc\fstab w
|
|---|
| 692 | IfErrors done_create_fstab
|
|---|
| 693 | FileWrite $0 '$INST_DIR_SHORT /grass$\r$\n'
|
|---|
| 694 | FileClose $0
|
|---|
| 695 | done_create_fstab:
|
|---|
| 696 |
|
|---|
| 697 | ;Set the Unix-Like GIS_DATABASE Path
|
|---|
| 698 | Var /GLOBAL UNIX_LIKE_GIS_DATABASE_PATH
|
|---|
| 699 |
|
|---|
| 700 | ;replace \ with / in $GIS_DATABASE
|
|---|
| 701 | ${StrReplace} "$UNIX_LIKE_GIS_DATABASE_PATH" "\" "/" "$GIS_DATABASE"
|
|---|
| 702 |
|
|---|
| 703 | ;create $PROFILE\.grassrc6
|
|---|
| 704 | SetShellVarContext current
|
|---|
| 705 | ClearErrors
|
|---|
| 706 | FileOpen $0 $PROFILE\.grassrc6 w
|
|---|
| 707 | IfErrors done_create_.grassrc6
|
|---|
| 708 | FileWrite $0 'GISDBASE: $UNIX_LIKE_GIS_DATABASE_PATH$\r$\n'
|
|---|
| 709 | FileWrite $0 'LOCATION_NAME: demolocation$\r$\n'
|
|---|
| 710 | FileWrite $0 'MAPSET: PERMANENT$\r$\n'
|
|---|
| 711 | FileClose $0
|
|---|
| 712 | done_create_.grassrc6:
|
|---|
| 713 |
|
|---|
| 714 | CopyFiles $PROFILE\.grassrc6 $INSTALL_DIR\msys\home\$USERNAME
|
|---|
| 715 |
|
|---|
| 716 | SectionEnd
|
|---|
| 717 |
|
|---|
| 718 | Function DownloadDataSet
|
|---|
| 719 |
|
|---|
| 720 | IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024
|
|---|
| 721 |
|
|---|
| 722 | StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME sample data set.$\r$\n"
|
|---|
| 723 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 724 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take"
|
|---|
| 725 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to be downloaded.$\r$\n"
|
|---|
| 726 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 727 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME will be copyed to:$\r$\n"
|
|---|
| 728 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER.$\r$\n"
|
|---|
| 729 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n"
|
|---|
| 730 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_Press OK to continue or Cancel to skip the download and complete the GRASS"
|
|---|
| 731 | StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ installation without the $EXTENDED_ARCHIVE_NAME data set.$\r$\n"
|
|---|
| 732 |
|
|---|
| 733 | MessageBox MB_OKCANCEL "$DOWNLOAD_MESSAGE_" IDOK download IDCANCEL cancel_download
|
|---|
| 734 |
|
|---|
| 735 | download:
|
|---|
| 736 | SetShellVarContext current
|
|---|
| 737 | InitPluginsDir
|
|---|
| 738 | NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
|
|---|
| 739 | Pop $0
|
|---|
| 740 | StrCmp $0 "success" download_ok download_failed
|
|---|
| 741 |
|
|---|
| 742 | download_ok:
|
|---|
| 743 | InitPluginsDir
|
|---|
| 744 | untgz::extract "-d" "$GIS_DATABASE" "$TEMP\$ARCHIVE_NAME"
|
|---|
| 745 | Pop $0
|
|---|
| 746 | StrCmp $0 "success" untar_ok untar_failed
|
|---|
| 747 |
|
|---|
| 748 | untar_ok:
|
|---|
| 749 | Rename "$GIS_DATABASE\$ORIGINAL_UNTAR_FOLDER" "$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER"
|
|---|
| 750 | Delete "$TEMP\$ARCHIVE_NAME"
|
|---|
| 751 | Goto end
|
|---|
| 752 |
|
|---|
| 753 | download_failed:
|
|---|
| 754 | DetailPrint "$0" ;print error message to log
|
|---|
| 755 | MessageBox MB_OK "Download Failed.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
|
|---|
| 756 | Goto end
|
|---|
| 757 |
|
|---|
| 758 | cancel_download:
|
|---|
| 759 | MessageBox MB_OK "Download Cancelled.$\r$\nGRASS will be installed without the $EXTENDED_ARCHIVE_NAME sample data set."
|
|---|
| 760 | Goto end
|
|---|
| 761 |
|
|---|
| 762 | untar_failed:
|
|---|
| 763 | DetailPrint "$0" ;print error message to log
|
|---|
| 764 |
|
|---|
| 765 | end:
|
|---|
| 766 |
|
|---|
| 767 | FunctionEnd
|
|---|
| 768 |
|
|---|
| 769 | Section /O "North Carolina (Wake County) Data Set" SecNorthCarolinaSDB
|
|---|
| 770 |
|
|---|
| 771 | ;Set the size (in KB) of the archive file
|
|---|
| 772 | StrCpy $ARCHIVE_SIZE_KB 138629
|
|---|
| 773 |
|
|---|
| 774 | ;Set the size (in KB) of the unpacked archive file
|
|---|
| 775 | AddSize 293314
|
|---|
| 776 |
|
|---|
| 777 | StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
|
|---|
| 778 | StrCpy $ARCHIVE_NAME "nc_spm_latest.tar.gz"
|
|---|
| 779 | StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina (Wake County)"
|
|---|
| 780 | StrCpy $ORIGINAL_UNTAR_FOLDER "nc_spm_08"
|
|---|
| 781 | StrCpy $CUSTOM_UNTAR_FOLDER "North-Carolina"
|
|---|
| 782 |
|
|---|
| 783 | Call DownloadDataSet
|
|---|
| 784 |
|
|---|
| 785 | SectionEnd
|
|---|
| 786 |
|
|---|
| 787 | Section /O "South Dakota (Spearfish County) Data Set" SecSpearfishSDB
|
|---|
| 788 |
|
|---|
| 789 | ;Set the size (in KB) of the archive file
|
|---|
| 790 | StrCpy $ARCHIVE_SIZE_KB 20803
|
|---|
| 791 |
|
|---|
| 792 | ;Set the size (in KB) of the unpacked archive file
|
|---|
| 793 | AddSize 42171
|
|---|
| 794 |
|
|---|
| 795 | StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
|
|---|
| 796 | StrCpy $ARCHIVE_NAME "spearfish_grass60data-0.3.tar.gz"
|
|---|
| 797 | StrCpy $EXTENDED_ARCHIVE_NAME "South Dakota (Spearfish County)"
|
|---|
| 798 | StrCpy $ORIGINAL_UNTAR_FOLDER "spearfish60"
|
|---|
| 799 | StrCpy $CUSTOM_UNTAR_FOLDER "Spearfish60"
|
|---|
| 800 |
|
|---|
| 801 | Call DownloadDataSet
|
|---|
| 802 |
|
|---|
| 803 | SectionEnd
|
|---|
| 804 |
|
|---|
| 805 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 806 |
|
|---|
| 807 | ;Uninstaller Section
|
|---|
| 808 |
|
|---|
| 809 | Section "Uninstall"
|
|---|
| 810 |
|
|---|
| 811 | ;remove files
|
|---|
| 812 | Delete "$INSTDIR\Uninstall-GRASS.exe"
|
|---|
| 813 | Delete "$INSTDIR\GPL.TXT"
|
|---|
| 814 | Delete "$INSTDIR\AUTHORS"
|
|---|
| 815 | Delete "$INSTDIR\CHANGES"
|
|---|
| 816 | Delete "$INSTDIR\COPYING"
|
|---|
| 817 | Delete "$INSTDIR\${GRASS_COMMAND}.bat"
|
|---|
| 818 | Delete "$INSTDIR\GRASS-WebSite.url"
|
|---|
| 819 | Delete "$INSTDIR\WinGRASS-README.url"
|
|---|
| 820 | Delete "$INSTDIR\REQUIREMENTS.html"
|
|---|
| 821 |
|
|---|
| 822 | ;remove folders
|
|---|
| 823 | RMDir /r "$INSTDIR\bin"
|
|---|
| 824 | RMDir /r "$INSTDIR\bwidget"
|
|---|
| 825 | RMDir /r "$INSTDIR\docs"
|
|---|
| 826 | RMDir /r "$INSTDIR\driver"
|
|---|
| 827 | RMDir /r "$INSTDIR\etc"
|
|---|
| 828 | RMDir /r "$INSTDIR\extrabin"
|
|---|
| 829 | RMDir /r "$INSTDIR\extralib"
|
|---|
| 830 | RMDir /r "$INSTDIR\fonts"
|
|---|
| 831 | RMDir /r "$INSTDIR\gpsbabel"
|
|---|
| 832 | RMDir /r "$INSTDIR\icons"
|
|---|
| 833 | RMDir /r "$INSTDIR\include"
|
|---|
| 834 | RMDir /r "$INSTDIR\lib"
|
|---|
| 835 | RMDir /r "$INSTDIR\locale"
|
|---|
| 836 | RMDir /r "$INSTDIR\msys"
|
|---|
| 837 | RMDir /r "$INSTDIR\proj"
|
|---|
| 838 | RMDir /r "$INSTDIR\Python25"
|
|---|
| 839 | RMDir /r "$INSTDIR\scripts"
|
|---|
| 840 | RMDir /r "$INSTDIR\sqlite"
|
|---|
| 841 | RMDir /r "$INSTDIR\tcl-tk"
|
|---|
| 842 |
|
|---|
| 843 | ;if empty, remove the install folder
|
|---|
| 844 | RMDir "$INSTDIR"
|
|---|
| 845 |
|
|---|
| 846 | ;remove the Desktop ShortCut
|
|---|
| 847 | SetShellVarContext current
|
|---|
| 848 | Delete "$DESKTOP\GRASS ${VERSION_NUMBER}.lnk"
|
|---|
| 849 | Delete "$DESKTOP\GRASS ${VERSION_NUMBER} msys.lnk"
|
|---|
| 850 |
|
|---|
| 851 | ;remove the Programs Start ShortCuts
|
|---|
| 852 | SetShellVarContext all
|
|---|
| 853 | RMDir /r "$SMPROGRAMS\${GRASS_BASE}"
|
|---|
| 854 |
|
|---|
| 855 | ;remove the .grassrc6 file
|
|---|
| 856 | SetShellVarContext current
|
|---|
| 857 | Delete "$PROFILE\.grassrc6"
|
|---|
| 858 |
|
|---|
| 859 | ;remove the Registry Entries
|
|---|
| 860 | DeleteRegKey HKLM "Software\${GRASS_BASE}"
|
|---|
| 861 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"
|
|---|
| 862 |
|
|---|
| 863 | SectionEnd
|
|---|
| 864 |
|
|---|
| 865 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|
| 866 |
|
|---|
| 867 | ;Installer Section Descriptions
|
|---|
| 868 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|---|
| 869 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGRASS} "Install GRASS ${VERSION_NUMBER}"
|
|---|
| 870 | !insertmacro MUI_DESCRIPTION_TEXT ${SecNorthCarolinaSDB} "Download and install the North Carolina (Wake County) sample data set"
|
|---|
| 871 | !insertmacro MUI_DESCRIPTION_TEXT ${SecSpearfishSDB} "Download and install the South Dakota (Spearfish County) sample data set"
|
|---|
| 872 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|---|
| 873 |
|
|---|
| 874 | ;----------------------------------------------------------------------------------------------------------------------------
|
|---|