1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-19 04:11:46 +02:00

Merge branch 'master' of https://github.com/stever/tomahawk into stever-master

This commit is contained in:
Christian Muehlhaeuser
2010-11-24 08:35:18 +01:00

View File

@@ -4,6 +4,7 @@
; Some installer script options (comment-out options not required) ; Some installer script options (comment-out options not required)
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
;!define OPTION_LICENSE_AGREEMENT ;!define OPTION_LICENSE_AGREEMENT
;!define OPTION_UAC_ENHANCED
!define OPTION_SECTION_SC_START_MENU !define OPTION_SECTION_SC_START_MENU
!define OPTION_SECTION_SC_DESKTOP !define OPTION_SECTION_SC_DESKTOP
!define OPTION_SECTION_SC_QUICK_LAUNCH !define OPTION_SECTION_SC_QUICK_LAUNCH
@@ -57,10 +58,17 @@ InstType Full
InstType Minimal InstType Minimal
CRCCheck On CRCCheck On
SetCompressor /SOLID lzma SetCompressor /SOLID lzma
;RequestExecutionLevel user ;Using the UAC plugin.
ReserveFile tomahawk.ini ReserveFile tomahawk.ini
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll" ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
;The UAC plugin provides an elevated user.
;Otherwise request admin level here.
!ifdef OPTION_UAC_PLUGIN_ENHANCED
RequestExecutionLevel user
!else
RequestExecutionLevel admin
!endif
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Include some required header files. ; Include some required header files.
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@@ -71,7 +79,9 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
!include Memento.nsh ;Remember user selections. !include Memento.nsh ;Remember user selections.
!include WinVer.nsh ;Windows version detection. !include WinVer.nsh ;Windows version detection.
!include WordFunc.nsh ;Used by VersionCompare macro function. !include WordFunc.nsh ;Used by VersionCompare macro function.
;!include UAC.nsh ;Used by the UAC elevation to install as user or admin. !ifdef OPTION_UAC_PLUGIN_ENHANCED
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
!endif
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Memento selections stored in registry. ; Memento selections stored in registry.
@@ -136,12 +146,18 @@ UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
############################################################################## ##############################################################################
Function LaunchTomahawk Function LaunchTomahawk
;${UAC.CallFunctionAsUser} LaunchTomahawkAsUser !ifdef OPTION_UAC_PLUGIN_ENHANCED
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
!else
Exec "$INSTDIR\tomahawk.exe"
!endif
FunctionEnd FunctionEnd
!ifdef OPTION_UAC_PLUGIN_ENHANCED
Function LaunchTomahawkAsUser Function LaunchTomahawkAsUser
Exec "$INSTDIR\tomahawk.exe" Exec "$INSTDIR\tomahawk.exe"
FunctionEnd FunctionEnd
!endif
############################################################################## ##############################################################################
# # # #
@@ -210,10 +226,12 @@ Function PageLeaveReinstall
Delete $R1 Delete $R1
RMDir $INSTDIR RMDir $INSTDIR
no_remove_uninstaller: no_remove_uninstaller:
StrCmp $R0 "2" 0 +3 StrCmp $R0 "2" +2 0
;UAC::Unload
Quit
BringToFront BringToFront
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload
Quit
!endif
reinst_done: reinst_done:
FunctionEnd FunctionEnd
@@ -473,25 +491,27 @@ Function .onInit
${MementoSectionRestore} ${MementoSectionRestore}
;UAC_Elevate: !ifdef OPTION_UAC_PLUGIN_ENHANCED
;UAC::RunElevated UAC_Elevate:
;StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user? UAC::RunElevated
;StrCmp 0 $0 0 UAC_Err ; Error? StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
;StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper? StrCmp 0 $0 0 UAC_Err ; Error?
;Quit StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
;UAC_Err:
;MessageBox MB_ICONSTOP "Unable to elevate, error $0" UAC_Err:
;Abort MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort
;UAC_ElevationAborted:
;Abort UAC_ElevationAborted:
Abort
;UAC_Success:
;StrCmp 1 $3 +4 ;Admin? UAC_Success:
;StrCmp 3 $1 0 UAC_ElevationAborted ;Try again? StrCmp 1 $3 +4 ;Admin?
;MessageBox MB_ICONSTOP "This installer requires admin access, try again" StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
;goto UAC_Elevate MessageBox MB_ICONSTOP "This installer requires admin access, try again"
goto UAC_Elevate
!endif
;Prevent multiple instances. ;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
@@ -503,11 +523,15 @@ FunctionEnd
Function .onInstSuccess Function .onInstSuccess
${MementoSectionSave} ${MementoSectionSave}
;UAC::Unload ;Must call unload! !ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd
Function .onInstFailed Function .onInstFailed
;UAC::Unload ;Must call unload! !ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd
############################################################################## ##############################################################################
@@ -517,26 +541,27 @@ FunctionEnd
############################################################################## ##############################################################################
Function un.onInit Function un.onInit
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
;UAC_Elevate: UAC_Err:
;UAC::RunElevated MessageBox MB_ICONSTOP "Unable to elevate, error $0"
;StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user? Abort
;StrCmp 0 $0 0 UAC_Err ; Error?
;StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper? UAC_ElevationAborted:
;Quit Abort
;UAC_Err: UAC_Success:
;MessageBox MB_ICONSTOP "Unable to elevate, error $0" StrCmp 1 $3 +4 ;Admin?
;Abort StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
;UAC_ElevationAborted: goto UAC_Elevate
;Abort !endif
;UAC_Success:
;StrCmp 1 $3 +4 ;Admin?
;StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
;MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
;goto UAC_Elevate
;Prevent multiple instances. ;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
@@ -547,9 +572,13 @@ Function un.onInit
FunctionEnd FunctionEnd
Function un.onUnInstSuccess Function un.onUnInstSuccess
;UAC::Unload ;Must call unload! !ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd
Function un.onUnInstFailed Function un.onUnInstFailed
;UAC::Unload ;Must call unload! !ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd