From 63fdeb14ef74bed9c96092296015e69b6557f3ea Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Oct 2011 23:00:33 -0400 Subject: SH-2515 WIP, STORM-280 WIP - ported over Oz fix for cache overdeletion during uninstall --- .../installers/windows/installer_template.nsi | 134 +++++++++++++++++++-- 1 file changed, 121 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index fcc187dc6f..03280328f3 100755 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -1,6 +1,22 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; secondlife setup.nsi -;; Copyright 2004-2010, Linden Research, Inc. +;; Copyright 2004-2011, Linden Research, Inc. +;; +;; This library is free software; you can redistribute it and/or +;; modify it under the terms of the GNU Lesser General Public +;; License as published by the Free Software Foundation; +;; version 2.1 of the License only. +;; +;; This library is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; Lesser General Public License for more details. +;; +;; You should have received a copy of the GNU Lesser General Public +;; License along with this library; if not, write to the Free Software +;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;; +;; Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA ;; ;; NSIS Unicode 2.38.1 or higher required ;; http://www.scratchpaper.com/ @@ -293,6 +309,97 @@ Function CheckNetworkConnection Return FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Save files from cache +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function PreserveCacheFiles + +Push $0 +Push $1 +Push $2 + + RMDir /r "$TEMP\SecondLifeSettingsBackup" + CreateDirectory "$TEMP\SecondLifeSettingsBackup" + 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 + + CreateDirectory "$TEMP\SecondLifeSettingsBackup\$0" + CopyFiles "$2\Application Data\SecondLife\*" "$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 + CreateDirectory "$TEMP\SecondLifeSettingsBackup\AllUsers\" + CopyFiles "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\" +Pop $0 + +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Restore files from cache +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function RestoreCacheFiles + +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 "$2\Application Data\SecondLifeRestore\" + CreateDirectory "$2\Application Data\SecondLifeRestore\" + CopyFiles "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLifeRestore\" + + 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 "$2\Application Data\SecondLifeRestore\" + CreateDirectory "$2\Application Data\SecondLifeRestore\" + CopyFiles "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLifeRestore\" +Pop $0 + +FunctionEnd + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Delete files in Documents and Settings\\SecondLife\cache ; Delete files in Documents and Settings\All Users\SecondLife\cache @@ -503,18 +610,15 @@ Push $2 ; Required since ProfileImagePath is of type REG_EXPAND_SZ ExpandEnvStrings $2 $2 - ; If uninstalling a normal install remove everything - ; Otherwise (preview/dmz etc) just remove cache - MessageBox MB_OK 'RM_ALL points at "$2\Application Data\SecondLife"' - StrCmp $INSTFLAGS "" RM_ALL RM_CACHE - RM_ALL: - RMDir /r "$2\Application Data\SecondLife" - RM_CACHE: - # Local Settings directory is the cache, there is no "cache" subdir - RMDir /r "$2\Local Settings\Application Data\SecondLife" - # Vista version of the same - RMDir /r "$2\AppData\Local\SecondLife" - Delete "$2\Application Data\SecondLife\user_settings\settings_windlight.xml" + ; Remove all cache and settings files but leave any other .txt files to preserve the chat logs + RMDir /r "$2\Application Data\SecondLife\logs" + RMDir /r "$2\Application Data\SecondLife\browser_profile" + RMDir /r "$2\Application Data\SecondLife\user_settings" + Delete "$2\Application Data\SecondLife\*.xml" + Delete "$2\Application Data\SecondLife\*.bmp" + Delete "$2\Application Data\SecondLife\search_history.txt" + Delete "$2\Application Data\SecondLife\plugin_cookies.txt" + Delete "$2\Application Data\SecondLife\typed_locations.txt" CONTINUE: IntOp $0 $0 + 1 @@ -862,6 +966,10 @@ Call CloseSecondLife ; Make sure we're not running Call CheckNetworkConnection ; ping secondlife.com ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Call PreserveCacheFiles + +Call RestoreCacheFiles + ;;; 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 ; VFS and cache files. -- cgit v1.2.3