From 5d50a660bc6ac480b1f92db47bcb3974104bf4d1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 27 Aug 2025 22:03:32 +0300 Subject: #4588 Unable to direct silent installation --- .../installers/windows/installer_template.nsi | 86 +++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) (limited to 'indra/newview/installers') diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 77f24ac6a6..0e36698018 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -163,6 +163,74 @@ Var DO_UNINSTALL_V2 # If non-null, path to a previous Viewer 2 installation !include 'LogicLib.nsh' # for value comparison !include "x64.nsh" # for 64bit detection +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Substring function +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +!define StrStr "!insertmacro StrStr" + +!macro StrStr ResultVar String SubString + Push `${String}` + Push `${SubString}` + Call StrStr + Pop `${ResultVar}` +!macroend + +Function StrStr + +# After this point: +# ------------------------------------------ +# $R0 = SubString (input) +# $R1 = String (input) +# $R2 = SubStringLen (temp) +# $R3 = StrLen (temp) +# $R4 = StartCharPos (temp) +# $R5 = TempStr (temp) +# function from nsis.sourceforge.io/StrStr + + ;Get input from user + Exch $R0 + Exch + Exch $R1 + Push $R2 + Push $R3 + Push $R4 + Push $R5 + + ;Get "String" and "SubString" length + StrLen $R2 $R0 + StrLen $R3 $R1 + ;Start "StartCharPos" counter + StrCpy $R4 0 + + ;Loop until "SubString" is found or "String" reaches its end + ${Do} + ;Remove everything before and after the searched part ("TempStr") + StrCpy $R5 $R1 $R2 $R4 + + ;Compare "TempStr" with "SubString" + ${IfThen} $R5 == $R0 ${|} ${ExitDo} ${|} + ;If not "SubString", this could be "String"'s end + ${IfThen} $R4 >= $R3 ${|} ${ExitDo} ${|} + ;If not, continue the loop + IntOp $R4 $R4 + 1 + ${Loop} + +# After this point: +# ------------------------------------------ +# $R0 = ResultVar (output) + + ;Remove part before "SubString" on "String" (if there has one) + StrCpy $R0 $R1 `` $R4 + + ;Return output to user + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Pre-directory page callback ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -190,15 +258,31 @@ Function .onInit # However, SL-10506 complains about the resulting behavior, so the logic below # is adapted from before we introduced MultiUser.nsh. +# Check if user specified /D= on the command line +System::Call 'kernel32::GetCommandLine()t .r0' +Push $0 +Push " /D=" +Call StrStr +Pop $1 +${If} $1 != "" + # /D= was specified, extract the path + # spaces are allowed in path after /D=, it's expected to be the last parameter + StrLen $2 $1 + StrCpy $INSTDIR $1 $2 4 # Skip over " /D=" + Goto after_instdir +${EndIf} + # if $0 is empty, this is the first time for this viewer name ReadRegStr $0 SHELL_CONTEXT "${INSTNAME_KEY}" "" # viewer with this name was installed before ${If} $0 != "" - # use the value we got from registry as install location + # use the value we got from registry as install location StrCpy $INSTDIR $0 ${EndIf} +after_instdir: + Call CheckCPUFlags # Make sure we have SSE2 support Call CheckWindowsVersion # Don't install On unsupported systems Push $0 -- cgit v1.2.3