aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/installers/windows
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/installers/windows
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/installers/windows')
-rw-r--r--linden/indra/newview/installers/windows/installer_template.nsi862
1 files changed, 862 insertions, 0 deletions
diff --git a/linden/indra/newview/installers/windows/installer_template.nsi b/linden/indra/newview/installers/windows/installer_template.nsi
new file mode 100644
index 0000000..8ab7c4f
--- /dev/null
+++ b/linden/indra/newview/installers/windows/installer_template.nsi
@@ -0,0 +1,862 @@
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2;;; @file viewer_manifest.py
3;;; @author James Cook, Don Kjer
4;;; @brief NSIS script for creating a Windows installer.
5;;; This file has variables expanded by viewer_manifest.py
6;;; to produce the complete nsi script file.
7;;; For info, see http://www.nullsoft.com/free/nsis/
8;;; NSIS 2.02 or higher required
9;;;
10;;; Copyright (c) 2006-$CurrentYear$, Linden Research, Inc.
11;;; $License$
12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15;;; Compiler flags
16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17
18;;; Detect NSIS compiler version
19!define "NSIS${NSIS_VERSION}"
20!ifdef "NSISv2.02" | "NSISv2.03" | "NSISv2.04" | "NSISv2.05" | "NSISv2.06"
21 ;;; before 2.07 defaulted lzma to solid (whole file)
22 SetCompressor lzma
23!else
24 ;;; after 2.07 required /solid for whole file compression
25 SetCompressor /solid lzma
26!endif
27
28SetOverwrite on ; overwrite files
29SetCompress auto ; compress iff saves space
30SetDatablockOptimize off ; only saves us 0.1%, not worth it
31XPStyle on ; add an XP manifest to the installer
32
33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34;;; Project flags
35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
36
37%%VERSION%%
38
39;;; Tweak for different servers/builds (this placeholder is replaced by viewer_manifest.py)
40%%GRID_VARS%%
41
42Name ${INSTNAME}
43
44SubCaption 0 " Setup" ; override "license agreement" text
45
46BrandingText " " ; bottom of window text
47Icon res\install_icon.ico ; our custom icon
48UninstallIcon res\uninstall_icon.ico ; our custom icon
49WindowIcon on ; show our icon in left corner
50BGGradient off ; no big background window
51CRCCheck on ; make sure CRC is OK
52InstProgressFlags smooth colored ; new colored smooth look
53ShowInstDetails nevershow ; no details, no "show" button
54SetOverwrite on ; stomp files by default
55AutoCloseWindow true ; after all files install, close window
56
57!ifdef UPDATE
58LicenseText "This package will update Second Life to version ${VERSION_LONG}." "Next >"
59!else
60LicenseText "This package will install Second Life on your computer." "Next >"
61!endif
62
63LicenseData "releasenotes.txt"
64
65InstallDir "$PROGRAMFILES\${INSTNAME}"
66InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" ""
67!ifdef UPDATE
68DirText "Installation Directory" "Select the Second Life directory to update:"
69!else
70DirText "Installation Directory" "Select the directory to install Second Life in:"
71!endif
72
73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74;;; Variables
75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
76Var INSTPROG
77Var INSTEXE
78Var INSTFLAGS
79Var INSTSHORTCUT
80
81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82;;; Sections
83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84
85Section "" ; (default section)
86
87SetShellVarContext all ; install for all users (if you change this, change it in the uninstall as well)
88
89
90; Start with some default values.
91StrCpy $INSTFLAGS "${INSTFLAGS}"
92StrCpy $INSTPROG "${INSTNAME}"
93StrCpy $INSTEXE "${INSTEXE}"
94StrCpy $INSTSHORTCUT "${SHORTCUT}"
95
96IfSilent +2
97Goto NOT_SILENT
98 Call CheckStartupParams ; Figure out where, what and how to install.
99NOT_SILENT:
100Call CheckWindowsVersion ; warn if on Windows 98/ME
101Call CheckIfAdministrator ; Make sure the user can install/uninstall
102Call CheckIfAlreadyCurrent ; Make sure that we haven't already installed this version
103Call CloseSecondLife ; Make sure we're not running
104Call RemoveNSIS ; Check for old NSIS install to remove
105
106;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers.
107;Call RemoveCacheFiles ; Installing over removes potentially corrupted
108 ; VFS and cache files.
109
110
111;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
112;;; Files
113;;;
114;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115;; This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py
116%%INSTALL_FILES%%
117
118; If this is a silent update, we don't need to re-create these shortcuts or registry entries.
119IfSilent POST_INSTALL
120
121; Shortcuts in start menu
122CreateDirectory "$SMPROGRAMS\$INSTSHORTCUT"
123SetOutPath "$INSTDIR"
124CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT.lnk" \
125 "$INSTDIR\$INSTEXE" "$INSTFLAGS"
126
127!ifdef MUSEUM
128CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT Museum.lnk" \
129
130 "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple"
131CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT Museum Spanish.lnk" \
132
133 "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple -spanish"
134!endif
135
136WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Create Trial Account.url" \
137 "InternetShortcut" "URL" \
138 "http://www.secondlife.com/registration/"
139WriteINIStr "$SMPROGRAMS\$INSTSHORTCUT\SL Your Account.url" \
140 "InternetShortcut" "URL" \
141 "http://www.secondlife.com/account/"
142CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\SL Release Notes.lnk" \
143 "$INSTDIR\releasenotes.txt"
144CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\SL Scripting Language Help.lnk" \
145 "$INSTDIR\lsl_guide.html"
146CreateShortCut "$SMPROGRAMS\$INSTSHORTCUT\Uninstall $INSTSHORTCUT.lnk" \
147 '"$INSTDIR\uninst.exe"' '/P="$INSTPROG"'
148
149; Other shortcuts
150SetOutPath "$INSTDIR"
151CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS"
152CreateShortCut "$INSTDIR\$INSTSHORTCUT.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS"
153CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" \
154 '"$INSTDIR\uninst.exe"' '/P="$INSTPROG"'
155
156!ifdef MUSEUM
157CreateShortCut "$DESKTOP\$INSTSHORTCUT Museum.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple"
158
159CreateShortCut "$DESKTOP\$INSTSHORTCUT Museum Spanish.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple -spanish"
160
161CreateShortCut "$INSTDIR\$INSTSHORTCUT Museum.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple"
162
163CreateShortCut "$INSTDIR\$INSTSHORTCUT Museum Spanish.lnk" "$INSTDIR\$INSTEXE" "$INSTFLAGS -simple -spanish"
164
165!endif
166
167; Write registry
168WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "" "$INSTDIR"
169WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version" "${VERSION_LONG}"
170WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags" "$INSTFLAGS"
171WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut" "$INSTSHORTCUT"
172WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe" "$INSTEXE"
173WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTPROG (remove only)"
174WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" '"$INSTDIR\uninst.exe" /P="$INSTPROG"'
175
176; Write URL registry info
177WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "(default)" "URL:Second Life"
178WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "URL Protocol" ""
179WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
180WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
181
182Goto WRITE_UNINST
183
184POST_INSTALL:
185; Run a post-executable script if necessary.
186Call PostInstallExe
187
188WRITE_UNINST:
189; write out uninstaller
190WriteUninstaller "$INSTDIR\uninst.exe"
191
192; end of default section
193SectionEnd
194
195;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
196; PostInstallExe
197; This just runs any post installation scripts.
198;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
199Function PostInstallExe
200push $0
201 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "PostInstallExe"
202 ;MessageBox MB_OK '$0'
203 ExecWait '$0'
204pop $0
205FunctionEnd
206
207
208;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
209; CheckStartupParameters
210; Sets INSTFLAGS, INSTPROG, and INSTEXE.
211;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
212Function CheckStartupParams
213push $0
214push $R0
215
216 ; Look for a registry entry with info about where to update.
217 Call GetProgramName
218 pop $R0
219 StrCpy $INSTPROG "$R0"
220 StrCpy $INSTEXE "$R0.exe"
221
222 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" ""
223 ; If key doesn't exist, skip install
224 IfErrors ABORT
225 StrCpy $INSTDIR "$0"
226
227 ; We now have a directory to install to. Get the startup parameters and shortcut as well.
228 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags"
229 IfErrors +2
230 StrCpy $INSTFLAGS "$0"
231 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut"
232 IfErrors +2
233 StrCpy $INSTSHORTCUT "$0"
234 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe"
235 IfErrors +2
236 StrCpy $INSTEXE "$0"
237 Goto FINISHED
238
239ABORT:
240 MessageBox MB_OK "Could not find the program '$INSTPROG'. Silent update failed."
241 Quit
242
243FINISHED:
244 ;MessageBox MB_OK "INSTPROG: $INSTPROG, INSTEXE: $INSTEXE, INSTFLAGS: $INSTFLAGS"
245pop $R0
246pop $0
247FunctionEnd
248
249Function un.CheckStartupParams
250push $0
251push $R0
252
253 ; Look for a registry entry with info about where to update.
254 Call un.GetProgramName
255 pop $R0
256 StrCpy $INSTPROG "$R0"
257 StrCpy $INSTEXE "$R0.exe"
258
259 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" ""
260 ; If key doesn't exist, skip install
261 IfErrors ABORT
262 StrCpy $INSTDIR "$0"
263
264 ; We now have a directory to install to. Get the startup parameters and shortcut as well.
265 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags"
266 IfErrors +2
267 StrCpy $INSTFLAGS "$0"
268 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut"
269 IfErrors +2
270 StrCpy $INSTSHORTCUT "$0"
271 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe"
272 IfErrors +2
273 StrCpy $INSTEXE "$0"
274 Goto FINISHED
275
276ABORT:
277 MessageBox MB_OK "Could not find the program '$INSTPROG'. Silent update failed."
278 Quit
279
280FINISHED:
281 ;MessageBox MB_OK "INSTPROG: $INSTPROG, INSTEXE: $INSTEXE, INSTFLAGS: $INSTFLAGS"
282pop $R0
283pop $0
284FunctionEnd
285
286;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
287;;; After install completes, offer readme file
288;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
289Function .onInstSuccess
290 MessageBox MB_YESNO \
291 "Start Second Life now?" /SD IDYES IDNO NoReadme
292 ; Assumes SetOutPath $INSTDIR
293 Exec '"$INSTDIR\$INSTEXE" $INSTFLAGS'
294 NoReadme:
295FunctionEnd
296
297;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
298; Remove old NSIS version. Modifies no variables.
299; Does NOT delete the LindenWorld directory, or any
300; user files in that directory.
301;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
302Function RemoveNSIS
303 Push $0
304 ; Grab the installation directory of the old version
305 DetailPrint "Checking for old version..."
306 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" ""
307
308 ; If key doesn't exist, skip uninstall
309 IfErrors NO_NSIS
310
311 ; Clean up legacy beta shortcuts
312 Delete "$SMPROGRAMS\Second Life Beta.lnk"
313 Delete "$DESKTOP\Second Life Beta.lnk"
314 Delete "$SMPROGRAMS\Second Life.lnk"
315
316 ; Clean up old newview.exe file
317 Delete "$INSTDIR\newview.exe"
318
319 ; Intentionally don't delete the stuff in
320 ; Documents and Settings, so we keep the user's settings
321
322 NO_NSIS:
323 Pop $0
324FunctionEnd
325
326;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
327; Make sure we're not on Windows 98 / ME
328;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
329Function CheckWindowsVersion
330 DetailPrint "Checking Windows version..."
331 Call GetWindowsVersion
332 Pop $R0
333 ; Just get first two characters, ignore 4.0 part of "NT 4.0"
334 StrCpy $R0 $R0 2
335 ; Blacklist certain OS versions
336 StrCmp $R0 "95" win_ver_bad
337 StrCmp $R0 "98" win_ver_bad
338 StrCmp $R0 "ME" win_ver_bad
339 StrCmp $R0 "NT" win_ver_bad
340 Return
341win_ver_bad:
342 MessageBox MB_YESNO 'Second Life only supports Windows XP, Windows 2000, and Mac OS X.$\n$\nAttempting to install on Windows $R0 can result in crashes and data loss.$\n$\nInstall anyway?' IDNO win_ver_abort
343 Return
344win_ver_abort:
345 Quit
346FunctionEnd
347
348;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
349; Make sure the user can install/uninstall
350;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
351Function CheckIfAdministrator
352 DetailPrint "Checking for permission to install..."
353 UserInfo::GetAccountType
354 Pop $R0
355 StrCmp $R0 "Admin" is_admin
356 MessageBox MB_OK 'You appear to be using a "limited" account.$\nYou must be an "administrator" to install Second Life.'
357 Quit
358is_admin:
359 Return
360FunctionEnd
361
362Function un.CheckIfAdministrator
363 DetailPrint "Checking for permission to uninstall..."
364 UserInfo::GetAccountType
365 Pop $R0
366 StrCmp $R0 "Admin" is_admin
367 MessageBox MB_OK 'You appear to be using a "limited" account.$\nYou must be an "administrator" to uninstall Second Life.'
368 Quit
369is_admin:
370 Return
371FunctionEnd
372
373;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
374; Checks to see if the current version has already been installed (according to the registry).
375; If it has, allow user to bail out of install process.
376;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
377Function CheckIfAlreadyCurrent
378 Push $0
379 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version"
380 StrCmp $0 ${VERSION_LONG} 0 DONE
381 MessageBox MB_OKCANCEL "It appears that Second Life ${VERSION_LONG} is already installed.$\n$\nWould you like to install it again?" /SD IDOK IDOK DONE
382 Quit
383
384 DONE:
385 Pop $0
386 Return
387FunctionEnd
388
389
390;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
391; Close the program, if running. Modifies no variables.
392; Allows user to bail out of install process.
393;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
394Function CloseSecondLife
395 Push $0
396 FindWindow $0 "Second Life" ""
397 IntCmp $0 0 DONE
398 MessageBox MB_OKCANCEL "Second Life can't be installed while it is already running.$\n$\nFinish what you're doing then select OK to close Second Life and continue.$\nSelect CANCEL to cancel installation." IDOK CLOSE IDCANCEL CANCEL_INSTALL
399
400 CANCEL_INSTALL:
401 Quit
402
403 CLOSE:
404 DetailPrint "Waiting for Second Life to shut down..."
405 SendMessage $0 16 0 0
406
407 LOOP:
408 FindWindow $0 "Second Life" ""
409 IntCmp $0 0 DONE
410 Sleep 500
411 Goto LOOP
412
413 DONE:
414 Pop $0
415 Return
416FunctionEnd
417
418
419;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
420; Delete files in Documents and Settings\<user>\SecondLife\cache
421; Delete files in Documents and Settings\All Users\SecondLife\cache
422;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
423Function RemoveCacheFiles
424
425; Delete files in Documents and Settings\<user>\SecondLife
426Push $0
427Push $1
428Push $2
429 DetailPrint "Deleting cache files in Documents and Settings folder"
430
431 StrCpy $0 0 ; Index number used to iterate via EnumRegKey
432
433 LOOP:
434 EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
435 StrCmp $1 "" DONE ; no more users
436
437 ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
438 StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
439
440 ; Required since ProfileImagePath is of type REG_EXPAND_SZ
441 ExpandEnvStrings $2 $2
442
443 ; When explicitly uninstalling, everything goes away
444 RMDir /r "$2\Application Data\SecondLife\cache"
445
446 CONTINUE:
447 IntOp $0 $0 + 1
448 Goto LOOP
449 DONE:
450Pop $2
451Pop $1
452Pop $0
453
454; Delete files in Documents and Settings\All Users\SecondLife
455Push $0
456 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
457 StrCmp $0 "" +2
458 RMDir /r "$0\SecondLife\cache"
459Pop $0
460
461; Delete filse in C:\Windows\Application Data\SecondLife
462; If the user is running on a pre-NT system, Application Data lives here instead of
463; in Documents and Settings.
464RMDir /r "$WINDIR\Application Data\SecondLife\cache"
465
466FunctionEnd
467
468;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
469; Delete files in Documents and Settings\<user>\SecondLife
470; Delete files in Documents and Settings\All Users\SecondLife
471;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
472Function un.DocumentsAndSettingsFolder
473
474; Delete files in Documents and Settings\<user>\SecondLife
475Push $0
476Push $1
477Push $2
478
479 DetailPrint "Deleting files in Documents and Settings folder"
480
481 StrCpy $0 0 ; Index number used to iterate via EnumRegKey
482
483 LOOP:
484 EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
485 StrCmp $1 "" DONE ; no more users
486
487 ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
488 StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
489
490 ; Required since ProfileImagePath is of type REG_EXPAND_SZ
491 ExpandEnvStrings $2 $2
492
493 ; If uninstalling a normal install remove everything
494 ; Otherwise (preview/dmz etc) just remove cache
495 StrCmp $INSTFLAGS "" RM_ALL RM_CACHE
496 RM_ALL:
497 RMDir /r "$2\Application Data\SecondLife"
498 GoTo CONTINUE
499 RM_CACHE:
500 RMDir /r "$2\Application Data\SecondLife\Cache"
501
502 CONTINUE:
503 IntOp $0 $0 + 1
504 Goto LOOP
505 DONE:
506
507Pop $2
508Pop $1
509Pop $0
510
511; Delete files in Documents and Settings\All Users\SecondLife
512Push $0
513 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
514 StrCmp $0 "" +2
515 RMDir /r "$0\SecondLife"
516Pop $0
517
518; Delete filse in C:\Windows\Application Data\SecondLife
519; If the user is running on a pre-NT system, Application Data lives here instead of
520; in Documents and Settings.
521RMDir /r "$WINDIR\Application Data\SecondLife"
522
523FunctionEnd
524
525;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
526; Close the program, if running. Modifies no variables.
527; Allows user to bail out of uninstall process.
528;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
529Function un.CloseSecondLife
530 Push $0
531 FindWindow $0 "Second Life" ""
532 IntCmp $0 0 DONE
533 MessageBox MB_OKCANCEL "Second Life can't be uninstalled while it is already running.$\n$\nFinish what you're doing then select OK to close Second Life and continue.$\nSelect CANCEL to cancel installation." IDOK CLOSE IDCANCEL CANCEL_UNINSTALL
534
535 CANCEL_UNINSTALL:
536 Quit
537
538 CLOSE:
539 DetailPrint "Waiting for Second Life to shut down..."
540 SendMessage $0 16 0 0
541
542 LOOP:
543 FindWindow $0 "Second Life" ""
544 IntCmp $0 0 DONE
545 Sleep 500
546 Goto LOOP
547
548 DONE:
549 Pop $0
550 Return
551FunctionEnd
552
553;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
554;;; Delete the installed files
555;;; This deletes the uninstall executable, but it works
556;;; because it is copied to temp directory before running
557;;;
558;;; Note: You must list all files here, because we only
559;;; want to delete our files, not things users left in the
560;;; application directories.
561;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
562Function un.ProgramFiles
563
564;; Remove mozilla file first so recursive directory deletion doesn't get hung up
565Delete "$INSTDIR\app_settings\mozilla\components"
566
567;; This placeholder is replaced by the complete list of files to uninstall by viewer_manifest.py
568%%DELETE_FILES%%
569
570;; Optional/obsolete files. Delete won't fail if they don't exist.
571Delete "$INSTDIR\dronesettings.ini"
572Delete "$INSTDIR\message_template.msg"
573Delete "$INSTDIR\newview.pdb"
574Delete "$INSTDIR\newview.map"
575Delete "$INSTDIR\SecondLife.pdb"
576Delete "$INSTDIR\SecondLife.map"
577Delete "$INSTDIR\comm.dat"
578Delete "$INSTDIR\*.glsl"
579Delete "$INSTDIR\motions\*.lla"
580Delete "$INSTDIR\trial\*.html"
581Delete "$INSTDIR\newview.exe"
582;; Remove entire help directory
583Delete "$INSTDIR\help\Advanced\*"
584RMDir "$INSTDIR\help\Advanced"
585Delete "$INSTDIR\help\basics\*"
586RMDir "$INSTDIR\help\basics"
587Delete "$INSTDIR\help\Concepts\*"
588RMDir "$INSTDIR\help\Concepts"
589Delete "$INSTDIR\help\welcome\*"
590RMDir "$INSTDIR\help\welcome"
591Delete "$INSTDIR\help\*"
592RMDir "$INSTDIR\help"
593
594Delete "$INSTDIR\uninst.exe"
595RMDir "$INSTDIR"
596
597IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER
598
599FOLDERFOUND:
600 MessageBox MB_YESNO "There are still files in your SecondLife program directory.$\n$\nThese are possibly files you created or moved to:$\n$INSTDIR$\n$\nDo you want to remove them?" IDNO NOFOLDER
601 RMDir /r "$INSTDIR"
602
603NOFOLDER:
604
605FunctionEnd
606
607;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
608;;; Uninstall settings
609;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
610UninstallText "This will uninstall Second Life ${VERSION_LONG} from your system."
611ShowUninstDetails show
612
613;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
614;;; Uninstall section
615;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
616Section Uninstall
617
618; Start with some default values.
619StrCpy $INSTFLAGS "${INSTFLAGS}"
620StrCpy $INSTPROG "${INSTNAME}"
621StrCpy $INSTEXE "${INSTEXE}"
622StrCpy $INSTSHORTCUT "${SHORTCUT}"
623Call un.CheckStartupParams ; Figure out where, what and how to uninstall.
624Call un.CheckIfAdministrator ; Make sure the user can install/uninstall
625
626; uninstall for all users (if you change this, change it in the install as well)
627SetShellVarContext all
628
629; Make sure we're not running
630Call un.CloseSecondLife
631
632; Clean up registry keys
633DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG"
634DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG"
635
636; Clean up shortcuts
637Delete "$SMPROGRAMS\$INSTSHORTCUT\*.*"
638RMDir "$SMPROGRAMS\$INSTSHORTCUT"
639
640Delete "$DESKTOP\$INSTSHORTCUT.lnk"
641Delete "$INSTDIR\$INSTSHORTCUT.lnk"
642Delete "$INSTDIR\Uninstall $INSTSHORTCUT.lnk"
643
644; Clean up cache and log files.
645; Leave them in-place for non AGNI installs.
646
647!ifdef UNINSTALL_SETTINGS
648Call un.DocumentsAndSettingsFolder
649!endif
650
651Call un.ProgramFiles
652
653SectionEnd ; end of uninstall section
654
655;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
656; (From the NSIS wiki, DK)
657; GetParameterValue
658;
659; Usage:
660; !insertmacro GetParameterValue "/L=" "1033"
661; pop $R0
662;
663; Returns on top of stack
664;
665; Example command lines:
666; foo.exe /S /L=1033 /D=C:\Program Files\Foo
667; or:
668; foo.exe /S "/L=1033" /D="C:\Program Files\Foo"
669; gpv "/L=" "1033"
670;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
671
672 !macro GetParameterValue SWITCH DEFAULT
673 Push $0
674 Push $1
675 Push $2
676 Push $3
677 Push $4
678
679 ;$CMDLINE='"My Setup\Setup.exe" /L=1033 /S'
680 Push "$CMDLINE"
681 Push '${SWITCH}"'
682 !insertmacro StrStr
683 Pop $0
684 StrCmp "$0" "" gpv_notquoted
685 ;$0='/L="1033" /S'
686 StrLen $2 "$0"
687 Strlen $1 "${SWITCH}"
688 IntOp $1 $1 + 1
689 StrCpy $0 "$0" $2 $1
690 ;$0='1033" /S'
691 Push "$0"
692 Push '"'
693 !insertmacro StrStr
694 Pop $1
695 StrLen $2 "$0"
696 StrLen $3 "$1"
697 IntOp $4 $2 - $3
698 StrCpy $0 $0 $4 0
699 Goto gpv_done
700
701 gpv_notquoted:
702 Push "$CMDLINE"
703 Push "${SWITCH}"
704 !insertmacro StrStr
705 Pop $0
706 StrCmp "$0" "" gpv_done
707 ;$0='/L="1033" /S'
708 StrLen $2 "$0"
709 Strlen $1 "${SWITCH}"
710 StrCpy $0 "$0" $2 $1
711 ;$0=1033 /S'
712 Push "$0"
713 Push ' '
714 !insertmacro StrStr
715 Pop $1
716 StrLen $2 "$0"
717 StrLen $3 "$1"
718 IntOp $4 $2 - $3
719 StrCpy $0 $0 $4 0
720 Goto gpv_done
721
722 gpv_done:
723 StrCmp "$0" "" 0 +2
724 StrCpy $0 "${DEFAULT}"
725
726 Pop $4
727 Pop $3
728 Pop $2
729 Pop $1
730 Exch $0
731 !macroend
732
733; And I had to modify StrStr a tiny bit.
734; Possible upgrade switch the goto's to use ${__LINE__}
735
736!macro STRSTR
737 Exch $R1 ; st=haystack,old$R1, $R1=needle
738 Exch ; st=old$R1,haystack
739 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
740 Push $R3
741 Push $R4
742 Push $R5
743 StrLen $R3 $R1
744 StrCpy $R4 0
745 ; $R1=needle
746 ; $R2=haystack
747 ; $R3=len(needle)
748 ; $R4=cnt
749 ; $R5=tmp
750 ; loop;
751 StrCpy $R5 $R2 $R3 $R4
752 StrCmp $R5 $R1 +4
753 StrCmp $R5 "" +3
754 IntOp $R4 $R4 + 1
755 Goto -4
756 ; done;
757 StrCpy $R1 $R2 "" $R4
758 Pop $R5
759 Pop $R4
760 Pop $R3
761 Pop $R2
762 Exch $R1
763!macroend
764
765Function GetProgramName
766 !insertmacro GetParameterValue "/P=" "SecondLife"
767FunctionEnd
768
769Function un.GetProgramName
770 !insertmacro GetParameterValue "/P=" "SecondLife"
771FunctionEnd
772
773;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
774; (From the NSIS documentation, JC)
775; GetWindowsVersion
776;
777; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
778; Updated by Joost Verburg
779;
780; Returns on top of stack
781;
782; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
783; or
784; '' (Unknown Windows Version)
785;
786; Usage:
787; Call GetWindowsVersion
788; Pop $R0
789; ; at this point $R0 is "NT 4.0" or whatnot
790;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
791
792Function GetWindowsVersion
793
794 Push $R0
795 Push $R1
796
797 ReadRegStr $R0 HKLM \
798 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
799
800 IfErrors 0 lbl_winnt
801
802 ; we are not NT
803 ReadRegStr $R0 HKLM \
804 "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
805
806 StrCpy $R1 $R0 1
807 StrCmp $R1 '4' 0 lbl_error
808
809 StrCpy $R1 $R0 3
810
811 StrCmp $R1 '4.0' lbl_win32_95
812 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
813
814 lbl_win32_95:
815 StrCpy $R0 '95'
816 Goto lbl_done
817
818 lbl_win32_98:
819 StrCpy $R0 '98'
820 Goto lbl_done
821
822 lbl_win32_ME:
823 StrCpy $R0 'ME'
824 Goto lbl_done
825
826 lbl_winnt:
827
828 StrCpy $R1 $R0 1
829
830 StrCmp $R1 '3' lbl_winnt_x
831 StrCmp $R1 '4' lbl_winnt_x
832
833 StrCpy $R1 $R0 3
834
835 StrCmp $R1 '5.0' lbl_winnt_2000
836 StrCmp $R1 '5.1' lbl_winnt_XP
837 StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
838
839 lbl_winnt_x:
840 StrCpy $R0 "NT $R0" 6
841 Goto lbl_done
842
843 lbl_winnt_2000:
844 Strcpy $R0 '2000'
845 Goto lbl_done
846
847 lbl_winnt_XP:
848 Strcpy $R0 'XP'
849 Goto lbl_done
850
851 lbl_winnt_2003:
852 Strcpy $R0 '2003'
853 Goto lbl_done
854
855 lbl_error:
856 Strcpy $R0 ''
857 lbl_done:
858
859 Pop $R1
860 Exch $R0
861
862FunctionEnd