PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/installers/windows/installer_template.nsi

https://bitbucket.org/lindenlab/viewer-beta/
Unknown | 1036 lines | 849 code | 187 blank | 0 comment | 0 complexity | e29fef6e96b4a72971eb5032ea81bc21 MD5 | raw file
Possible License(s): LGPL-2.1
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;; secondlife setup.nsi
  3. ;; Copyright 2004-2011, Linden Research, Inc.
  4. ;;
  5. ;; This library is free software; you can redistribute it and/or
  6. ;; modify it under the terms of the GNU Lesser General Public
  7. ;; License as published by the Free Software Foundation;
  8. ;; version 2.1 of the License only.
  9. ;;
  10. ;; This library is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. ;; Lesser General Public License for more details.
  14. ;;
  15. ;; You should have received a copy of the GNU Lesser General Public
  16. ;; License along with this library; if not, write to the Free Software
  17. ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. ;;
  19. ;; Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  20. ;;
  21. ;; NSIS Unicode 2.38.1 or higher required
  22. ;; http://www.scratchpaper.com/
  23. ;;
  24. ;; Author: James Cook, Don Kjer, Callum Prentice
  25. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  26. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  27. ;; Compiler flags
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. SetOverwrite on ; overwrite files
  30. SetCompress auto ; compress iff saves space
  31. SetCompressor /solid lzma ; compress whole installer as one block
  32. SetDatablockOptimize off ; only saves us 0.1%, not worth it
  33. XPStyle on ; add an XP manifest to the installer
  34. RequestExecutionLevel admin ; on Vista we must be admin because we write to Program Files
  35. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  36. ;;; Project flags
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. %%VERSION%%
  39. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  40. ;; - language files - one for each language (or flavor thereof)
  41. ;; (these files are in the same place as the nsi template but the python script generates a new nsi file in the
  42. ;; application directory so we have to add a path to these include files)
  43. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44. !include "%%SOURCE%%\installers\windows\lang_da.nsi"
  45. !include "%%SOURCE%%\installers\windows\lang_de.nsi"
  46. !include "%%SOURCE%%\installers\windows\lang_en-us.nsi"
  47. !include "%%SOURCE%%\installers\windows\lang_es.nsi"
  48. !include "%%SOURCE%%\installers\windows\lang_fr.nsi"
  49. !include "%%SOURCE%%\installers\windows\lang_ja.nsi"
  50. !include "%%SOURCE%%\installers\windows\lang_it.nsi"
  51. !include "%%SOURCE%%\installers\windows\lang_pl.nsi"
  52. !include "%%SOURCE%%\installers\windows\lang_pt-br.nsi"
  53. !include "%%SOURCE%%\installers\windows\lang_ru.nsi"
  54. !include "%%SOURCE%%\installers\windows\lang_tr.nsi"
  55. !include "%%SOURCE%%\installers\windows\lang_zh.nsi"
  56. # *TODO: Move these into the language files themselves
  57. LangString LanguageCode ${LANG_DANISH} "da"
  58. LangString LanguageCode ${LANG_GERMAN} "de"
  59. LangString LanguageCode ${LANG_ENGLISH} "en"
  60. LangString LanguageCode ${LANG_SPANISH} "es"
  61. LangString LanguageCode ${LANG_FRENCH} "fr"
  62. LangString LanguageCode ${LANG_JAPANESE} "ja"
  63. LangString LanguageCode ${LANG_ITALIAN} "it"
  64. LangString LanguageCode ${LANG_POLISH} "pl"
  65. LangString LanguageCode ${LANG_PORTUGUESEBR} "pt"
  66. LangString LanguageCode ${LANG_RUSSIAN} "ru"
  67. LangString LanguageCode ${LANG_TURKISH} "tr"
  68. LangString LanguageCode ${LANG_TRADCHINESE} "zh"
  69. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  70. ;; Tweak for different servers/builds (this placeholder is replaced by viewer_manifest.py)
  71. ;; For example:
  72. ;; !define INSTFLAGS "%(flags)s"
  73. ;; !define INSTNAME "SecondLife%(grid_caps)s"
  74. ;; !define SHORTCUT "Second Life (%(grid_caps)s)"
  75. ;; !define URLNAME "secondlife%(grid)s"
  76. ;; !define UNINSTALL_SETTINGS 1
  77. %%GRID_VARS%%
  78. Name ${INSTNAME}
  79. SubCaption 0 $(LicenseSubTitleSetup) ; override "license agreement" text
  80. BrandingText " " ; bottom of window text
  81. Icon %%SOURCE%%\installers\windows\install_icon.ico
  82. UninstallIcon %%SOURCE%%\installers\windows\uninstall_icon.ico
  83. WindowIcon on ; show our icon in left corner
  84. BGGradient off ; no big background window
  85. CRCCheck on ; make sure CRC is OK
  86. InstProgressFlags smooth colored ; new colored smooth look
  87. ShowInstDetails nevershow ; no details, no "show" button
  88. SetOverwrite on ; stomp files by default
  89. AutoCloseWindow true ; after all files install, close window
  90. InstallDir "$PROGRAMFILES\${INSTNAME}"
  91. InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" ""
  92. DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup)
  93. Page directory dirPre
  94. Page instfiles
  95. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  96. ;;; Variables
  97. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  98. Var INSTPROG
  99. Var INSTEXE
  100. Var INSTFLAGS
  101. Var INSTSHORTCUT
  102. Var COMMANDLINE ; command line passed to this installer, set in .onInit
  103. Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer
  104. Var SKIP_DIALOGS ; set from command line in .onInit. autoinstall
  105. ; GUI and the defaults.
  106. Var DO_UNINSTALL_V2 ; If non-null, path to a previous Viewer 2 installation that will be uninstalled.
  107. ;;; Function definitions should go before file includes, because calls to
  108. ;;; DLLs like LangDLL trigger an implicit file include, so if that call is at
  109. ;;; the end of this script NSIS has to decompress the whole installer before
  110. ;;; it can call the DLL function. JC
  111. !include "FileFunc.nsh" ; For GetParameters, GetOptions
  112. !insertmacro GetParameters
  113. !insertmacro GetOptions
  114. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115. ;;; After install completes, launch app
  116. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  117. Function .onInstSuccess
  118. Push $R0 # Option value, unused
  119. StrCmp $SKIP_DIALOGS "true" label_launch
  120. ${GetOptions} $COMMANDLINE "/AUTOSTART" $R0
  121. # If parameter was there (no error) just launch
  122. # Otherwise ask
  123. IfErrors label_ask_launch label_launch
  124. label_ask_launch:
  125. # Don't launch by default when silent
  126. IfSilent label_no_launch
  127. MessageBox MB_YESNO $(InstSuccesssQuestion) \
  128. IDYES label_launch IDNO label_no_launch
  129. label_launch:
  130. # Assumes SetOutPath $INSTDIR
  131. Exec '"$INSTDIR\$INSTEXE" $INSTFLAGS $SHORTCUT_LANG_PARAM'
  132. label_no_launch:
  133. Pop $R0
  134. FunctionEnd
  135. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  136. ;;; Pre-directory page callback
  137. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  138. Function dirPre
  139. StrCmp $SKIP_DIALOGS "true" 0 +2
  140. Abort
  141. FunctionEnd
  142. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  143. ; Make sure we're not on Windows 98 / ME
  144. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  145. Function CheckWindowsVersion
  146. DetailPrint "Checking Windows version..."
  147. Call GetWindowsVersion
  148. Pop $R0
  149. ; Just get first two characters, ignore 4.0 part of "NT 4.0"
  150. StrCpy $R0 $R0 2
  151. ; Blacklist certain OS versions
  152. StrCmp $R0 "95" win_ver_bad
  153. StrCmp $R0 "98" win_ver_bad
  154. StrCmp $R0 "ME" win_ver_bad
  155. StrCmp $R0 "NT" win_ver_bad
  156. Return
  157. win_ver_bad:
  158. StrCmp $SKIP_DIALOGS "true" +2 ; If skip_dialogs is set just install
  159. MessageBox MB_YESNO $(CheckWindowsVersionMB) IDNO win_ver_abort
  160. Return
  161. win_ver_abort:
  162. Quit
  163. FunctionEnd
  164. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  165. ; Make sure the user can install/uninstall
  166. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  167. Function CheckIfAdministrator
  168. DetailPrint $(CheckAdministratorInstDP)
  169. UserInfo::GetAccountType
  170. Pop $R0
  171. StrCmp $R0 "Admin" lbl_is_admin
  172. MessageBox MB_OK $(CheckAdministratorInstMB)
  173. Quit
  174. lbl_is_admin:
  175. Return
  176. FunctionEnd
  177. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  178. ;;
  179. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  180. Function un.CheckIfAdministrator
  181. DetailPrint $(CheckAdministratorUnInstDP)
  182. UserInfo::GetAccountType
  183. Pop $R0
  184. StrCmp $R0 "Admin" lbl_is_admin
  185. MessageBox MB_OK $(CheckAdministratorUnInstMB)
  186. Quit
  187. lbl_is_admin:
  188. Return
  189. FunctionEnd
  190. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  191. ; Checks to see if the current version has already been installed (according to the registry).
  192. ; If it has, allow user to bail out of install process.
  193. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  194. Function CheckIfAlreadyCurrent
  195. Push $0
  196. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version"
  197. StrCmp $0 ${VERSION_LONG} 0 continue_install
  198. StrCmp $SKIP_DIALOGS "true" continue_install
  199. MessageBox MB_OKCANCEL $(CheckIfCurrentMB) /SD IDOK IDOK continue_install
  200. Quit
  201. continue_install:
  202. Pop $0
  203. Return
  204. FunctionEnd
  205. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  206. ; Checks for CPU valid (must have SSE2 support)
  207. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  208. Function CheckCPUFlags
  209. Call GetWindowsVersion
  210. Pop $R0
  211. StrCmp $R0 "2000" OK_SSE ; sse check not available on win2k.
  212. Push $1
  213. System::Call 'kernel32::IsProcessorFeaturePresent(i) i(10) .r1'
  214. IntCmp $1 1 OK_SSE
  215. MessageBox MB_OKCANCEL $(MissingSSE2) /SD IDOK IDOK OK_SSE
  216. Quit
  217. OK_SSE:
  218. Pop $1
  219. Return
  220. FunctionEnd
  221. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  222. ; Close the program, if running. Modifies no variables.
  223. ; Allows user to bail out of install process.
  224. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  225. Function CloseSecondLife
  226. Push $0
  227. FindWindow $0 "Second Life" ""
  228. IntCmp $0 0 DONE
  229. StrCmp $SKIP_DIALOGS "true" CLOSE
  230. MessageBox MB_OKCANCEL $(CloseSecondLifeInstMB) IDOK CLOSE IDCANCEL CANCEL_INSTALL
  231. CANCEL_INSTALL:
  232. Quit
  233. CLOSE:
  234. DetailPrint $(CloseSecondLifeInstDP)
  235. SendMessage $0 16 0 0
  236. LOOP:
  237. FindWindow $0 "Second Life" ""
  238. IntCmp $0 0 DONE
  239. Sleep 500
  240. Goto LOOP
  241. DONE:
  242. Pop $0
  243. Return
  244. FunctionEnd
  245. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  246. ; Test our connection to secondlife.com
  247. ; Also allows us to count attempted installs by examining web logs.
  248. ; *TODO: Return current SL version info and have installer check
  249. ; if it is up to date.
  250. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  251. Function CheckNetworkConnection
  252. Push $0
  253. Push $1
  254. Push $2 # Option value for GetOptions
  255. DetailPrint $(CheckNetworkConnectionDP)
  256. ; Look for a tag value from the stub installer, used for statistics
  257. ; to correlate installs. Default to "" if not found on command line.
  258. StrCpy $2 ""
  259. ${GetOptions} $COMMANDLINE "/STUBTAG=" $2
  260. GetTempFileName $0
  261. !define HTTP_TIMEOUT 5000 ; milliseconds
  262. ; Don't show secondary progress bar, this will be quick.
  263. NSISdl::download_quiet \
  264. /TIMEOUT=${HTTP_TIMEOUT} \
  265. "http://install.secondlife.com/check/?stubtag=$2&version=${VERSION_LONG}" \
  266. $0
  267. Pop $1 ; Return value, either "success", "cancel" or an error message
  268. ; MessageBox MB_OK "Download result: $1"
  269. ; Result ignored for now
  270. ; StrCmp $1 "success" +2
  271. ; DetailPrint "Connection failed: $1"
  272. Delete $0 ; temporary file
  273. Pop $2
  274. Pop $1
  275. Pop $0
  276. Return
  277. FunctionEnd
  278. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  279. ; Function CheckWillUninstallV2
  280. ;
  281. ; If we are being called through auto-update, we need to uninstall any
  282. ; existing V2 installation. Otherwise, we wind up with
  283. ; SecondLifeViewer2 and SecondLifeViewer installations existing side
  284. ; by side no indication which to use.
  285. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  286. Function CheckWillUninstallV2
  287. StrCpy $DO_UNINSTALL_V2 ""
  288. StrCmp $SKIP_DIALOGS "true" 0 CHECKV2_DONE
  289. StrCmp $INSTDIR "$PROGRAMFILES\SecondLifeViewer2" CHECKV2_DONE ; don't uninstall our own install dir.
  290. IfFileExists "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" CHECKV2_FOUND CHECKV2_DONE
  291. CHECKV2_FOUND:
  292. StrCpy $DO_UNINSTALL_V2 "true"
  293. CHECKV2_DONE:
  294. FunctionEnd
  295. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  296. ; Save user files to temp location
  297. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  298. Function PreserveUserFiles
  299. Push $0
  300. Push $1
  301. Push $2
  302. RMDir /r "$TEMP\SecondLifeSettingsBackup"
  303. CreateDirectory "$TEMP\SecondLifeSettingsBackup"
  304. StrCpy $0 0 ; Index number used to iterate via EnumRegKey
  305. LOOP:
  306. EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
  307. StrCmp $1 "" DONE ; no more users
  308. ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
  309. StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
  310. ; Required since ProfileImagePath is of type REG_EXPAND_SZ
  311. ExpandEnvStrings $2 $2
  312. CreateDirectory "$TEMP\SecondLifeSettingsBackup\$0"
  313. CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\$0"
  314. CONTINUE:
  315. IntOp $0 $0 + 1
  316. Goto LOOP
  317. DONE:
  318. Pop $2
  319. Pop $1
  320. Pop $0
  321. ; Copy files in Documents and Settings\All Users\SecondLife
  322. Push $0
  323. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
  324. StrCmp $0 "" +2
  325. CreateDirectory "$TEMP\SecondLifeSettingsBackup\AllUsers\"
  326. CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\"
  327. Pop $0
  328. FunctionEnd
  329. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  330. ; Restore user files from temp location
  331. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  332. Function RestoreUserFiles
  333. Push $0
  334. Push $1
  335. Push $2
  336. StrCpy $0 0 ; Index number used to iterate via EnumRegKey
  337. LOOP:
  338. EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
  339. StrCmp $1 "" DONE ; no more users
  340. ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
  341. StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
  342. ; Required since ProfileImagePath is of type REG_EXPAND_SZ
  343. ExpandEnvStrings $2 $2
  344. CreateDirectory "$2\Application Data\SecondLife\"
  345. CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLife\"
  346. CONTINUE:
  347. IntOp $0 $0 + 1
  348. Goto LOOP
  349. DONE:
  350. Pop $2
  351. Pop $1
  352. Pop $0
  353. ; Copy files in Documents and Settings\All Users\SecondLife
  354. Push $0
  355. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
  356. StrCmp $0 "" +2
  357. CreateDirectory "$2\Application Data\SecondLife\"
  358. CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLife\"
  359. Pop $0
  360. FunctionEnd
  361. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  362. ; Remove temp dirs
  363. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  364. Function RemoveTempUserFiles
  365. Push $0
  366. Push $1
  367. Push $2
  368. StrCpy $0 0 ; Index number used to iterate via EnumRegKey
  369. LOOP:
  370. EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
  371. StrCmp $1 "" DONE ; no more users
  372. ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
  373. StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
  374. ; Required since ProfileImagePath is of type REG_EXPAND_SZ
  375. ExpandEnvStrings $2 $2
  376. RMDir /r "$TEMP\SecondLifeSettingsBackup\$0\*"
  377. CONTINUE:
  378. IntOp $0 $0 + 1
  379. Goto LOOP
  380. DONE:
  381. Pop $2
  382. Pop $1
  383. Pop $0
  384. ; Copy files in Documents and Settings\All Users\SecondLife
  385. Push $0
  386. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
  387. StrCmp $0 "" +2
  388. RMDir /r "$TEMP\SecondLifeSettingsBackup\AllUsers\*"
  389. Pop $0
  390. FunctionEnd
  391. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  392. ; Clobber user files - TEST ONLY
  393. ; This is here for testing, generally not desirable to call it.
  394. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  395. ;Function ClobberUserFilesTESTONLY
  396. ;Push $0
  397. ;Push $1
  398. ;Push $2
  399. ;
  400. ; StrCpy $0 0 ; Index number used to iterate via EnumRegKey
  401. ;
  402. ; LOOP:
  403. ; EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
  404. ; StrCmp $1 "" DONE ; no more users
  405. ;
  406. ; ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
  407. ; StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
  408. ;
  409. ; ; Required since ProfileImagePath is of type REG_EXPAND_SZ
  410. ; ExpandEnvStrings $2 $2
  411. ;
  412. ; RMDir /r "$2\Application Data\SecondLife\"
  413. ;
  414. ; CONTINUE:
  415. ; IntOp $0 $0 + 1
  416. ; Goto LOOP
  417. ; DONE:
  418. ;
  419. ;Pop $2
  420. ;Pop $1
  421. ;Pop $0
  422. ;
  423. ;; Copy files in Documents and Settings\All Users\SecondLife
  424. ;Push $0
  425. ; ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
  426. ; StrCmp $0 "" +2
  427. ; RMDir /r "$2\Application Data\SecondLife\"
  428. ;Pop $0
  429. ;
  430. ;FunctionEnd
  431. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  432. ;;; Delete the installed shader files
  433. ;;; Since shaders are in active development, we'll likely need to shuffle them
  434. ;;; around a bit from build to build. This ensures that shaders that we move
  435. ;;; or rename in the dev tree don't get left behind in the install.
  436. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  437. Function RemoveOldShaders
  438. ;; Remove old shader files first so fallbacks will work. see DEV-5663
  439. RMDir /r "$INSTDIR\app_settings\shaders\*"
  440. FunctionEnd
  441. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  442. ;;; Delete the installed XUI files
  443. ;;; We've changed the directory hierarchy for skins, putting all XUI and texture
  444. ;;; files under a specific skin directory, i.e. skins/default/xui/en-us as opposed
  445. ;;; to skins/xui/en-us. Need to clean up the old path when upgrading
  446. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  447. Function RemoveOldXUI
  448. ;; remove old XUI and texture files
  449. RmDir /r "$INSTDIR\skins\html"
  450. RmDir /r "$INSTDIR\skins\xui"
  451. RmDir /r "$INSTDIR\skins\textures"
  452. Delete "$INSTDIR\skins\*.txt"
  453. FunctionEnd
  454. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  455. ;;; Remove any releasenotes files.
  456. ;;; We are no longer including release notes with the viewer. This will delete
  457. ;;; any that were left behind by an older installer. Delete will not fail if
  458. ;;; the files do not exist
  459. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  460. Function RemoveOldReleaseNotes
  461. ;; remove releasenotes.txt file from application directory, and the shortcut
  462. ;; from the start menu.
  463. Delete "$SMPROGRAMS\$INSTSHORTCUT\SL Release Notes.lnk"
  464. Delete "$INSTDIR\releasenotes.txt"
  465. FunctionEnd
  466. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  467. ; Delete files in Documents and Settings\<user>\SecondLife
  468. ; Delete files in Documents and Settings\All Users\SecondLife
  469. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  470. Function un.DocumentsAndSettingsFolder
  471. ; Delete files in Documents and Settings\<user>\SecondLife
  472. Push $0
  473. Push $1
  474. Push $2
  475. DetailPrint "Deleting files in Documents and Settings folder"
  476. StrCpy $0 0 ; Index number used to iterate via EnumRegKey
  477. LOOP:
  478. EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
  479. StrCmp $1 "" DONE ; no more users
  480. ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
  481. StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
  482. ; Required since ProfileImagePath is of type REG_EXPAND_SZ
  483. ExpandEnvStrings $2 $2
  484. ; Remove all cache and settings files but leave any other .txt files to preserve the chat logs
  485. ; RMDir /r "$2\Application Data\SecondLife\logs"
  486. RMDir /r "$2\Application Data\SecondLife\browser_profile"
  487. RMDir /r "$2\Application Data\SecondLife\user_settings"
  488. Delete "$2\Application Data\SecondLife\*.xml"
  489. Delete "$2\Application Data\SecondLife\*.bmp"
  490. Delete "$2\Application Data\SecondLife\search_history.txt"
  491. Delete "$2\Application Data\SecondLife\plugin_cookies.txt"
  492. Delete "$2\Application Data\SecondLife\typed_locations.txt"
  493. CONTINUE:
  494. IntOp $0 $0 + 1
  495. Goto LOOP
  496. DONE:
  497. Pop $2
  498. Pop $1
  499. Pop $0
  500. ; Delete files in Documents and Settings\All Users\SecondLife
  501. Push $0
  502. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
  503. StrCmp $0 "" +2
  504. RMDir /r "$0\SecondLife"
  505. Pop $0
  506. ; Delete files in C:\Windows\Application Data\SecondLife
  507. ; If the user is running on a pre-NT system, Application Data lives here instead of
  508. ; in Documents and Settings.
  509. RMDir /r "$WINDIR\Application Data\SecondLife"
  510. FunctionEnd
  511. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  512. ; Close the program, if running. Modifies no variables.
  513. ; Allows user to bail out of uninstall process.
  514. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  515. Function un.CloseSecondLife
  516. Push $0
  517. FindWindow $0 "Second Life" ""
  518. IntCmp $0 0 DONE
  519. MessageBox MB_OKCANCEL $(CloseSecondLifeUnInstMB) IDOK CLOSE IDCANCEL CANCEL_UNINSTALL
  520. CANCEL_UNINSTALL:
  521. Quit
  522. CLOSE:
  523. DetailPrint $(CloseSecondLifeUnInstDP)
  524. SendMessage $0 16 0 0
  525. LOOP:
  526. FindWindow $0 "Second Life" ""
  527. IntCmp $0 0 DONE
  528. Sleep 500
  529. Goto LOOP
  530. DONE:
  531. Pop $0
  532. Return
  533. FunctionEnd
  534. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  535. ;
  536. ; Delete the stored password for the current Windows user
  537. ; DEV-10821 -- Unauthorised user can gain access to an SL account after a real user has uninstalled
  538. ;
  539. Function un.RemovePassword
  540. DetailPrint "Removing Second Life password"
  541. SetShellVarContext current
  542. Delete "$APPDATA\SecondLife\user_settings\password.dat"
  543. SetShellVarContext all
  544. FunctionEnd
  545. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  546. ;;; Delete the installed files
  547. ;;; This deletes the uninstall executable, but it works
  548. ;;; because it is copied to temp directory before running
  549. ;;;
  550. ;;; Note: You must list all files here, because we only
  551. ;;; want to delete our files, not things users left in the
  552. ;;; application directories.
  553. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  554. Function un.ProgramFiles
  555. ;; Remove mozilla file first so recursive directory deletion doesn't get hung up
  556. Delete "$INSTDIR\app_settings\mozilla\components"
  557. ;; This placeholder is replaced by the complete list of files to uninstall by viewer_manifest.py
  558. %%DELETE_FILES%%
  559. ;; Optional/obsolete files. Delete won't fail if they don't exist.
  560. Delete "$INSTDIR\dronesettings.ini"
  561. Delete "$INSTDIR\message_template.msg"
  562. Delete "$INSTDIR\newview.pdb"
  563. Delete "$INSTDIR\newview.map"
  564. Delete "$INSTDIR\SecondLife.pdb"
  565. Delete "$INSTDIR\SecondLife.map"
  566. Delete "$INSTDIR\comm.dat"
  567. Delete "$INSTDIR\*.glsl"
  568. Delete "$INSTDIR\motions\*.lla"
  569. Delete "$INSTDIR\trial\*.html"
  570. Delete "$INSTDIR\newview.exe"
  571. ;; Remove entire help directory
  572. Delete "$INSTDIR\help\Advanced\*"
  573. RMDir "$INSTDIR\help\Advanced"
  574. Delete "$INSTDIR\help\basics\*"
  575. RMDir "$INSTDIR\help\basics"
  576. Delete "$INSTDIR\help\Concepts\*"
  577. RMDir "$INSTDIR\help\Concepts"
  578. Delete "$INSTDIR\help\welcome\*"
  579. RMDir "$INSTDIR\help\welcome"
  580. Delete "$INSTDIR\help\*"
  581. RMDir "$INSTDIR\help"
  582. Delete "$INSTDIR\uninst.exe"
  583. RMDir "$INSTDIR"
  584. IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER
  585. FOLDERFOUND:
  586. ; Silent uninstall always removes all files (/SD IDYES)
  587. MessageBox MB_YESNO $(DeleteProgramFilesMB) /SD IDYES IDNO NOFOLDER
  588. RMDir /r "$INSTDIR"
  589. NOFOLDER:
  590. FunctionEnd
  591. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  592. ;;; Uninstall settings
  593. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  594. UninstallText $(UninstallTextMsg)
  595. ShowUninstDetails show
  596. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  597. ;;; Uninstall section
  598. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  599. Section Uninstall
  600. ; Start with some default values.
  601. StrCpy $INSTFLAGS ""
  602. StrCpy $INSTPROG "${INSTNAME}"
  603. StrCpy $INSTEXE "${INSTEXE}"
  604. StrCpy $INSTSHORTCUT "${SHORTCUT}"
  605. Call un.CheckIfAdministrator ; Make sure the user can install/uninstall
  606. ; uninstall for all users (if you change this, change it in the install as well)
  607. SetShellVarContext all
  608. ; Make sure we're not running
  609. Call un.CloseSecondLife
  610. ; Clean up registry keys and subkeys (these should all be !defines somewhere)
  611. DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG"
  612. DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG"
  613. ; Clean up shortcuts
  614. Delete "$SMPROGRAMS\$INSTSHORTCUT\*.*"
  615. RMDir "$SMPROGRAMS\$INSTSHORTCUT"
  616. Delete "$DESKTOP\$INSTSHORTCUT.lnk"
  617. Delete "$INSTDIR\$INSTSHORTCUT.lnk"
  618. Delete "$INSTDIR\Uninstall $INSTSHORTCUT.lnk"
  619. ; Clean up cache and log files.
  620. ; Leave them in-place for non AGNI installs.
  621. !ifdef UNINSTALL_SETTINGS
  622. Call un.DocumentsAndSettingsFolder
  623. !endif
  624. ; remove stored password on uninstall
  625. Call un.RemovePassword
  626. Call un.ProgramFiles
  627. SectionEnd ; end of uninstall section
  628. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  629. ; (From the NSIS documentation, JC)
  630. ; GetWindowsVersion
  631. ;
  632. ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
  633. ; Updated by Joost Verburg
  634. ;
  635. ; Returns on top of stack
  636. ;
  637. ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
  638. ; or
  639. ; '' (Unknown Windows Version)
  640. ;
  641. ; Usage:
  642. ; Call GetWindowsVersion
  643. ; Pop $R0
  644. ; ; at this point $R0 is "NT 4.0" or whatnot
  645. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  646. Function GetWindowsVersion
  647. Push $R0
  648. Push $R1
  649. ReadRegStr $R0 HKLM \
  650. "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  651. IfErrors 0 lbl_winnt
  652. ; we are not NT
  653. ReadRegStr $R0 HKLM \
  654. "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
  655. StrCpy $R1 $R0 1
  656. StrCmp $R1 '4' 0 lbl_error
  657. StrCpy $R1 $R0 3
  658. StrCmp $R1 '4.0' lbl_win32_95
  659. StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
  660. lbl_win32_95:
  661. StrCpy $R0 '95'
  662. Goto lbl_done
  663. lbl_win32_98:
  664. StrCpy $R0 '98'
  665. Goto lbl_done
  666. lbl_win32_ME:
  667. StrCpy $R0 'ME'
  668. Goto lbl_done
  669. lbl_winnt:
  670. StrCpy $R1 $R0 1
  671. StrCmp $R1 '3' lbl_winnt_x
  672. StrCmp $R1 '4' lbl_winnt_x
  673. StrCpy $R1 $R0 3
  674. StrCmp $R1 '5.0' lbl_winnt_2000
  675. StrCmp $R1 '5.1' lbl_winnt_XP
  676. StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
  677. lbl_winnt_x:
  678. StrCpy $R0 "NT $R0" 6
  679. Goto lbl_done
  680. lbl_winnt_2000:
  681. Strcpy $R0 '2000'
  682. Goto lbl_done
  683. lbl_winnt_XP:
  684. Strcpy $R0 'XP'
  685. Goto lbl_done
  686. lbl_winnt_2003:
  687. Strcpy $R0 '2003'
  688. Goto lbl_done
  689. lbl_error:
  690. Strcpy $R0 ''
  691. lbl_done:
  692. Pop $R1
  693. Exch $R0
  694. FunctionEnd
  695. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  696. ;; Note: to add new languages, add a language file include to the list
  697. ;; at the top of this file, add an entry to the menu and then add an
  698. ;; entry to the language ID selector below
  699. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  700. Function .onInit
  701. Push $0
  702. ${GetParameters} $COMMANDLINE ; get our command line
  703. ${GetOptions} $COMMANDLINE "/SKIP_DIALOGS" $0
  704. IfErrors +2 0 ; If error jump past setting SKIP_DIALOGS
  705. StrCpy $SKIP_DIALOGS "true"
  706. ${GetOptions} $COMMANDLINE "/LANGID=" $0 ; /LANGID=1033 implies US English
  707. ; If no language (error), then proceed
  708. IfErrors lbl_configure_default_lang
  709. ; No error means we got a language, so use it
  710. StrCpy $LANGUAGE $0
  711. Goto lbl_return
  712. lbl_configure_default_lang:
  713. ; If we currently have a version of SL installed, default to the language of that install
  714. ; Otherwise don't change $LANGUAGE and it will default to the OS UI language.
  715. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage"
  716. IfErrors +2 0 ; If error skip the copy instruction
  717. StrCpy $LANGUAGE $0
  718. ; For silent installs, no language prompt, use default
  719. IfSilent lbl_return
  720. StrCmp $SKIP_DIALOGS "true" lbl_return
  721. lbl_build_menu:
  722. Push ""
  723. # Use separate file so labels can be UTF-16 but we can still merge changes
  724. # into this ASCII file. JC
  725. !include "%%SOURCE%%\installers\windows\language_menu.nsi"
  726. Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain
  727. LangDLL::LangDialog $(InstallerLanguageTitle) $(SelectInstallerLanguage)
  728. Pop $0
  729. StrCmp $0 "cancel" 0 +2
  730. Abort
  731. StrCpy $LANGUAGE $0
  732. ; save language in registry
  733. WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" $LANGUAGE
  734. lbl_return:
  735. Pop $0
  736. Return
  737. FunctionEnd
  738. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  739. Function un.onInit
  740. ; read language from registry and set for uninstaller
  741. ; Key will be removed on successful uninstall
  742. ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage"
  743. IfErrors lbl_end
  744. StrCpy $LANGUAGE $0
  745. lbl_end:
  746. Return
  747. FunctionEnd
  748. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  749. ;;; MAIN SECTION
  750. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  751. Section "" ; (default section)
  752. SetShellVarContext all ; install for all users (if you change this, change it in the uninstall as well)
  753. ; Start with some default values.
  754. StrCpy $INSTFLAGS "${INSTFLAGS}"
  755. StrCpy $INSTPROG "${INSTNAME}"
  756. StrCpy $INSTEXE "${INSTEXE}"
  757. StrCpy $INSTSHORTCUT "${SHORTCUT}"
  758. Call CheckWindowsVersion ; warn if on Windows 98/ME
  759. Call CheckCPUFlags ; Make sure we have SSE2 support
  760. Call CheckIfAdministrator ; Make sure the user can install/uninstall
  761. Call CheckIfAlreadyCurrent ; Make sure that we haven't already installed this version
  762. Call CloseSecondLife ; Make sure we're not running
  763. Call CheckNetworkConnection ; ping secondlife.com
  764. Call CheckWillUninstallV2 ; See if a V2 install exists and will be removed.
  765. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  766. StrCmp $DO_UNINSTALL_V2 "" PRESERVE_DONE
  767. Call PreserveUserFiles
  768. PRESERVE_DONE:
  769. ;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers.
  770. ;Call RemoveCacheFiles ; Installing over removes potentially corrupted
  771. ; VFS and cache files.
  772. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  773. ;;; Need to clean out shader files from previous installs to fix DEV-5663
  774. Call RemoveOldShaders
  775. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  776. ;;; Need to clean out old XUI files that predate skinning
  777. Call RemoveOldXUI
  778. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  779. ;;; Clear out old releasenotes.txt files. These are now on the public wiki.
  780. Call RemoveOldReleaseNotes
  781. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  782. ;;; Files
  783. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  784. ;; This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py
  785. %%INSTALL_FILES%%
  786. # Pass the installer's language to the client to use as a default
  787. StrCpy $SHORTCUT_LANG_PARAM "--set InstallLanguage $(LanguageCode)"
  788. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  789. ; Shortcuts in start menu
  790. CreateDirectory "$SMPROGRAMS\$INSTSHORTCUT"
  791. SetOutPath "$INSTDIR"
  792. CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT.lnk" \
  793. "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM"
  794. WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Create Account.url" \
  795. "InternetShortcut" "URL" \
  796. "http://join.secondlife.com/"
  797. WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Your Account.url" \
  798. "InternetShortcut" "URL" \
  799. "http://www.secondlife.com/account/"
  800. WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Scripting Language Help.url" \
  801. "InternetShortcut" "URL" \
  802. "http://wiki.secondlife.com/wiki/LSL_Portal"
  803. CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\Uninstall $INSTSHORTCUT.lnk" \
  804. '"$INSTDIR\uninst.exe"' ''
  805. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  806. ; Other shortcuts
  807. SetOutPath "$INSTDIR"
  808. CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" \
  809. "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM"
  810. CreateShortCut "$INSTDIR\$INSTSHORTCUT.lnk" \
  811. "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM"
  812. CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" \
  813. '"$INSTDIR\uninst.exe"' ''
  814. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  815. ; Write registry
  816. WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "" "$INSTDIR"
  817. WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version" "${VERSION_LONG}"
  818. WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags" "$INSTFLAGS"
  819. WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut" "$INSTSHORTCUT"
  820. WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe" "$INSTEXE"
  821. WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTPROG (remove only)"
  822. WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" '"$INSTDIR\uninst.exe"'
  823. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  824. ; Write URL registry info
  825. WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "(default)" "URL:Second Life"
  826. WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "URL Protocol" ""
  827. WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
  828. ;; URL param must be last item passed to viewer, it ignores subsequent params
  829. ;; to avoid parameter injection attacks.
  830. WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
  831. WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info"(default)" "URL:Second Life"
  832. WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" ""
  833. WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
  834. ;; URL param must be last item passed to viewer, it ignores subsequent params
  835. ;; to avoid parameter injection attacks.
  836. WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
  837. ; write out uninstaller
  838. WriteUninstaller "$INSTDIR\uninst.exe"
  839. ; Uninstall existing "Second Life Viewer 2" install if needed.
  840. StrCmp $DO_UNINSTALL_V2 "" REMOVE_SLV2_DONE
  841. ExecWait '"$PROGRAMFILES\SecondLifeViewer2\uninst.exe" /S _?=$PROGRAMFILES\SecondLifeViewer2'
  842. Delete "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" ; with _? option above, uninst.exe will be left behind.
  843. RMDir "$PROGRAMFILES\SecondLifeViewer2" ; will remove only if empty.
  844. Call RestoreUserFiles
  845. Call RemoveTempUserFiles
  846. REMOVE_SLV2_DONE:
  847. ; end of default section
  848. SectionEnd
  849. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EOF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;