Skip to content
Snippets Groups Projects
Commit 0559c2c2 authored by Brad Payne (Vir Linden)'s avatar Brad Payne (Vir Linden)
Browse files

SH-2663 WIP, SH-2667 FIX - better logic for when to copy temp files, only...

SH-2663 WIP, SH-2667 FIX - better logic for when to copy temp files, only uninstall V2 when called from auto-update, clean temp files when done
parent 0bfc95fe
No related branches found
No related tags found
No related merge requests found
...@@ -115,6 +115,7 @@ Var COMMANDLINE ; command line passed to this installer, set in .onInit ...@@ -115,6 +115,7 @@ Var COMMANDLINE ; command line passed to this installer, set in .onInit
Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer
Var SKIP_DIALOGS ; set from command line in .onInit. autoinstall Var SKIP_DIALOGS ; set from command line in .onInit. autoinstall
; GUI and the defaults. ; GUI and the defaults.
Var DO_UNINSTALL_V2 ; If non-null, path to a previous Viewer 2 installation that will be uninstalled.
;;; Function definitions should go before file includes, because calls to ;;; Function definitions should go before file includes, because calls to
;;; DLLs like LangDLL trigger an implicit file include, so if that call is at ;;; DLLs like LangDLL trigger an implicit file include, so if that call is at
...@@ -310,6 +311,29 @@ Function CheckNetworkConnection ...@@ -310,6 +311,29 @@ Function CheckNetworkConnection
FunctionEnd FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Function CheckWillUninstallV2
;
; If we are being called through auto-update, we need to uninstall any
; existing V2 installation. Otherwise, we wind up with
; SecondLifeViewer2 and SecondLifeViewer installations existing side
; by side no indication which to use.
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function CheckWillUninstallV2
StrCpy $DO_UNINSTALL_V2 ""
StrCmp $SKIP_DIALOGS "true" 0 CHECKV2_DONE
StrCmp $INSTDIR "$PROGRAMFILES\SecondLifeViewer2" CHECKV2_DONE ; don't uninstall our own install dir.
IfFileExists "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" CHECKV2_FOUND CHECKV2_DONE
CHECKV2_FOUND:
StrCpy $DO_UNINSTALL_V2 "true"
CHECKV2_DONE:
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Save user files to temp location ; Save user files to temp location
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
...@@ -334,7 +358,7 @@ Push $2 ...@@ -334,7 +358,7 @@ Push $2
ExpandEnvStrings $2 $2 ExpandEnvStrings $2 $2
CreateDirectory "$TEMP\SecondLifeSettingsBackup\$0" CreateDirectory "$TEMP\SecondLifeSettingsBackup\$0"
CopyFiles "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\$0" CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\$0"
CONTINUE: CONTINUE:
IntOp $0 $0 + 1 IntOp $0 $0 + 1
...@@ -350,7 +374,7 @@ Push $0 ...@@ -350,7 +374,7 @@ Push $0
ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData" ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
StrCmp $0 "" +2 StrCmp $0 "" +2
CreateDirectory "$TEMP\SecondLifeSettingsBackup\AllUsers\" CreateDirectory "$TEMP\SecondLifeSettingsBackup\AllUsers\"
CopyFiles "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\" CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\"
Pop $0 Pop $0
FunctionEnd FunctionEnd
...@@ -377,7 +401,7 @@ Push $2 ...@@ -377,7 +401,7 @@ Push $2
ExpandEnvStrings $2 $2 ExpandEnvStrings $2 $2
CreateDirectory "$2\Application Data\SecondLife\" CreateDirectory "$2\Application Data\SecondLife\"
CopyFiles "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLife\" CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLife\"
CONTINUE: CONTINUE:
IntOp $0 $0 + 1 IntOp $0 $0 + 1
...@@ -393,11 +417,53 @@ Push $0 ...@@ -393,11 +417,53 @@ Push $0
ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData" ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
StrCmp $0 "" +2 StrCmp $0 "" +2
CreateDirectory "$2\Application Data\SecondLife\" CreateDirectory "$2\Application Data\SecondLife\"
CopyFiles "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLife\" CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLife\"
Pop $0
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Remove temp dirs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function RemoveTempUserFiles
Push $0
Push $1
Push $2
StrCpy $0 0 ; Index number used to iterate via EnumRegKey
LOOP:
EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
StrCmp $1 "" DONE ; no more users
ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath"
StrCmp $2 "" CONTINUE 0 ; "ProfileImagePath" value is missing
; Required since ProfileImagePath is of type REG_EXPAND_SZ
ExpandEnvStrings $2 $2
RMDir /r "$TEMP\SecondLifeSettingsBackup\$0\*"
CONTINUE:
IntOp $0 $0 + 1
Goto LOOP
DONE:
Pop $2
Pop $1
Pop $0
; Copy files in Documents and Settings\All Users\SecondLife
Push $0
ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
StrCmp $0 "" +2
RMDir /r "$TEMP\SecondLifeSettingsBackup\AllUsers\*"
Pop $0 Pop $0
FunctionEnd FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Clobber user files - TEST ONLY ; Clobber user files - TEST ONLY
; This is here for testing, generally not desirable to call it. ; This is here for testing, generally not desirable to call it.
...@@ -864,9 +930,12 @@ Call CheckIfAdministrator ; Make sure the user can install/uninstall ...@@ -864,9 +930,12 @@ Call CheckIfAdministrator ; Make sure the user can install/uninstall
Call CheckIfAlreadyCurrent ; Make sure that we haven't already installed this version Call CheckIfAlreadyCurrent ; Make sure that we haven't already installed this version
Call CloseSecondLife ; Make sure we're not running Call CloseSecondLife ; Make sure we're not running
Call CheckNetworkConnection ; ping secondlife.com Call CheckNetworkConnection ; ping secondlife.com
Call CheckWillUninstallV2 ; See if a V2 install exists and will be removed.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Call PreserveUserFiles StrCmp $DO_UNINSTALL_V2 "" PRESERVE_DONE
Call PreserveUserFiles
PRESERVE_DONE:
;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers. ;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers.
;Call RemoveCacheFiles ; Installing over removes potentially corrupted ;Call RemoveCacheFiles ; Installing over removes potentially corrupted
...@@ -951,17 +1020,15 @@ WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" ...@@ -951,17 +1020,15 @@ WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" ""
; write out uninstaller ; write out uninstaller
WriteUninstaller "$INSTDIR\uninst.exe" WriteUninstaller "$INSTDIR\uninst.exe"
; Remove existing "Second Life Viewer 2" install if any. ; Uninstall existing "Second Life Viewer 2" install if needed.
StrCmp $INSTDIR "$PROGRAMFILES\SecondLifeViewer2" SLV2_DONE ; unless that's the install directory StrCmp $DO_UNINSTALL_V2 "" REMOVE_SLV2_DONE
IfFileExists "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" SLV2_FOUND SLV2_DONE ExecWait '"$PROGRAMFILES\SecondLifeViewer2\uninst.exe" /S _?=$PROGRAMFILES\SecondLifeViewer2'
Delete "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" ; with _? option above, uninst.exe will be left behind.
SLV2_FOUND: RMDir "$PROGRAMFILES\SecondLifeViewer2" ; will remove only if empty.
ExecWait '"$PROGRAMFILES\SecondLifeViewer2\uninst.exe" /S _?=$PROGRAMFILES\SecondLifeViewer2'
Delete "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" ; with _? option above, uninst.exe will be left behind.
RMDir "$PROGRAMFILES\SecondLifeViewer2" ; will remove only if empty.
SLV2_DONE: Call RestoreUserFiles
Call RestoreUserFiles Call RemoveTempUserFiles
REMOVE_SLV2_DONE:
; end of default section ; end of default section
SectionEnd SectionEnd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment