mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
installer allows /nSandboxIfNew command line switch, which defaults
sandbox to off if this is a new install
This commit is contained in:
parent
ea5b074f6e
commit
8f51beda17
1 changed files with 72 additions and 1 deletions
|
@ -29,6 +29,63 @@
|
||||||
!include "WinVer.nsh"
|
!include "WinVer.nsh"
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
; Utilities and Functions
|
||||||
|
;--------------------------------
|
||||||
|
; START String Contains Macro
|
||||||
|
; Taken from http://nsis.sourceforge.net/StrContains
|
||||||
|
;--------------------------------
|
||||||
|
; StrContains
|
||||||
|
; This function does a case sensitive searches for an occurrence of a substring in a string.
|
||||||
|
; It returns the substring if it is found.
|
||||||
|
; Otherwise it returns null("").
|
||||||
|
; Written by kenglish_hi
|
||||||
|
; Adapted from StrReplace written by dandaman32
|
||||||
|
|
||||||
|
|
||||||
|
Var STR_HAYSTACK
|
||||||
|
Var STR_NEEDLE
|
||||||
|
Var STR_CONTAINS_VAR_1
|
||||||
|
Var STR_CONTAINS_VAR_2
|
||||||
|
Var STR_CONTAINS_VAR_3
|
||||||
|
Var STR_CONTAINS_VAR_4
|
||||||
|
Var STR_RETURN_VAR
|
||||||
|
|
||||||
|
Function StrContains
|
||||||
|
Exch $STR_NEEDLE
|
||||||
|
Exch 1
|
||||||
|
Exch $STR_HAYSTACK
|
||||||
|
; Uncomment to debug
|
||||||
|
;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
|
||||||
|
StrCpy $STR_RETURN_VAR ""
|
||||||
|
StrCpy $STR_CONTAINS_VAR_1 -1
|
||||||
|
StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
|
||||||
|
StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
|
||||||
|
loop:
|
||||||
|
IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
|
||||||
|
StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
|
||||||
|
StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
|
||||||
|
StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
|
||||||
|
Goto loop
|
||||||
|
found:
|
||||||
|
StrCpy $STR_RETURN_VAR $STR_NEEDLE
|
||||||
|
Goto done
|
||||||
|
done:
|
||||||
|
Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
|
||||||
|
Exch $STR_RETURN_VAR
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
!macro _StrContainsConstructor OUT NEEDLE HAYSTACK
|
||||||
|
Push `${HAYSTACK}`
|
||||||
|
Push `${NEEDLE}`
|
||||||
|
Call StrContains
|
||||||
|
Pop `${OUT}`
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!define StrContains '!insertmacro "_StrContainsConstructor"'
|
||||||
|
;--------------------------------
|
||||||
|
; END String Contains Macro
|
||||||
|
;--------------------------------
|
||||||
|
;--------------------------------
|
||||||
;General
|
;General
|
||||||
; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges
|
; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges
|
||||||
!include UAC.nsh
|
!include UAC.nsh
|
||||||
|
@ -119,9 +176,11 @@ Var AR_RegFlags
|
||||||
ClearErrors
|
ClearErrors
|
||||||
;Reading component status from registry
|
;Reading component status from registry
|
||||||
ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
|
ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
|
||||||
IfErrors "default_${SecName}"
|
IfErrors "checkBeforeDefault_${SecName}"
|
||||||
;Status will stay default if registry value not found
|
;Status will stay default if registry value not found
|
||||||
;(component was never installed)
|
;(component was never installed)
|
||||||
|
|
||||||
|
"set_initSection_${SecName}:"
|
||||||
IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
|
IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
|
||||||
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
|
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
|
||||||
IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
|
IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
|
||||||
|
@ -137,6 +196,18 @@ Var AR_RegFlags
|
||||||
"default_${SecName}:"
|
"default_${SecName}:"
|
||||||
|
|
||||||
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
|
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
|
||||||
|
Goto "end_initSection_${SecName}"
|
||||||
|
|
||||||
|
"checkBeforeDefault_${SecName}:"
|
||||||
|
${StrContains} $AR_RegFlags "/nSandboxIfNew" $CMDLINE
|
||||||
|
${If} "${SecName}" == "server"
|
||||||
|
${AndIfNot} $AR_RegFlags == ""
|
||||||
|
StrCpy $AR_RegFlags 0
|
||||||
|
Goto "set_initSection_${SecName}"
|
||||||
|
${Else}
|
||||||
|
Goto "default_${SecName}"
|
||||||
|
${EndIf}
|
||||||
|
"end_initSection_${SecName}:"
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!macro FinishSection SecName
|
!macro FinishSection SecName
|
||||||
|
|
Loading…
Reference in a new issue