mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-22 07:51:11 +00:00
Significantly improved install script:
- Defaulted to single-user installation. - Fixed detection and uninstallation previous versions. - Made installation of source code and OpenAL drivers optional. - Reduced size by using a solid archive. - Streamlined installation process. - Reduced start menu shortcuts.
This commit is contained in:
parent
45ca126a90
commit
9638996b9a
|
@ -1,15 +1,12 @@
|
|||
; Script generated by the HM NIS Edit Script Wizard.
|
||||
RequestExecutionLevel user
|
||||
|
||||
|
||||
!include x64.nsh
|
||||
!include WordFunc.nsh
|
||||
!insertmacro VersionCompare
|
||||
!include LogicLib.nsh
|
||||
|
||||
SetCompressor lzma
|
||||
|
||||
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
; HM NIS Edit Wizard helper defines
|
||||
!define PRODUCT_NAME "OpenTK"
|
||||
|
@ -22,7 +19,7 @@ SetCompressor lzma
|
|||
!define DOTNET20_PUBLIC_ASSEMBLIES_KEY "SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
|
||||
!define MULTIUSER_EXECUTIONLEVEL User
|
||||
;!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
|
||||
!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
|
||||
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "SHELL_CONTEXT"
|
||||
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "InstallDir"
|
||||
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "SHELL_CONTEXT"
|
||||
|
@ -44,11 +41,13 @@ SetCompressor lzma
|
|||
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
||||
|
||||
; Welcome page
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
; License page
|
||||
;!insertmacro MUI_PAGE_WELCOME
|
||||
; License page;
|
||||
!insertmacro MUI_PAGE_LICENSE "..\..\Documentation\License.txt"
|
||||
; Directory page
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
; Components page
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
; Instfiles page
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
; Finish page
|
||||
|
@ -58,64 +57,7 @@ SetCompressor lzma
|
|||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Language files
|
||||
!insertmacro MUI_LANGUAGE "Afrikaans"
|
||||
!insertmacro MUI_LANGUAGE "Albanian"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Basque"
|
||||
!insertmacro MUI_LANGUAGE "Belarusian"
|
||||
!insertmacro MUI_LANGUAGE "Bosnian"
|
||||
!insertmacro MUI_LANGUAGE "Breton"
|
||||
!insertmacro MUI_LANGUAGE "Bulgarian"
|
||||
!insertmacro MUI_LANGUAGE "Catalan"
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
!insertmacro MUI_LANGUAGE "Esperanto"
|
||||
!insertmacro MUI_LANGUAGE "Estonian"
|
||||
!insertmacro MUI_LANGUAGE "Farsi"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "Galician"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
!insertmacro MUI_LANGUAGE "Icelandic"
|
||||
!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
!insertmacro MUI_LANGUAGE "Irish"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Korean"
|
||||
!insertmacro MUI_LANGUAGE "Kurdish"
|
||||
!insertmacro MUI_LANGUAGE "Latvian"
|
||||
!insertmacro MUI_LANGUAGE "Lithuanian"
|
||||
!insertmacro MUI_LANGUAGE "Luxembourgish"
|
||||
!insertmacro MUI_LANGUAGE "Macedonian"
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Mongolian"
|
||||
!insertmacro MUI_LANGUAGE "Norwegian"
|
||||
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Slovenian"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "SpanishInternational"
|
||||
!insertmacro MUI_LANGUAGE "Swedish"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Uzbek"
|
||||
!insertmacro MUI_LANGUAGE "Welsh"
|
||||
|
||||
; Reserve files
|
||||
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
||||
|
@ -128,23 +70,8 @@ InstallDir "${MULTIUSER_INSTALLMODE_INSTDIR}"
|
|||
ShowInstDetails show
|
||||
ShowUnInstDetails show
|
||||
|
||||
Var AccountType
|
||||
|
||||
Function .onInit
|
||||
; !insertmacro MULTIUSER_INIT
|
||||
UserInfo::GetAccountType
|
||||
Pop $AccountType
|
||||
|
||||
${If} $AccountType == "Admin"
|
||||
${OrIf} $AccountType == "Power"
|
||||
${If} ${RunningX64}
|
||||
StrCpy $INSTDIR "$PROGRAMFILES64\${MULTIUSER_INSTALLMODE_INSTDIR}"
|
||||
${Else}
|
||||
StrCpy $INSTDIR "$PROGRAMFILES\${MULTIUSER_INSTALLMODE_INSTDIR}"
|
||||
${EndIf}
|
||||
${Else}
|
||||
StrCpy $INSTDIR "$DOCUMENTS\${MULTIUSER_INSTALLMODE_INSTDIR}"
|
||||
${EndIf}
|
||||
StrCpy $INSTDIR "$DOCUMENTS\${MULTIUSER_INSTALLMODE_INSTDIR}"
|
||||
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
FunctionEnd
|
||||
|
@ -159,7 +86,8 @@ SectionEnd
|
|||
Function UninstallPrevious
|
||||
|
||||
; Check for uninstaller.
|
||||
ReadRegStr $R0 ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "InstallDir"
|
||||
ReadRegStr $R0 ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
|
||||
ReadRegStr $R1 ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "InstallDir"
|
||||
|
||||
${If} $R0 == ""
|
||||
Goto Done
|
||||
|
@ -168,13 +96,62 @@ Function UninstallPrevious
|
|||
DetailPrint "Removing previous installation."
|
||||
|
||||
; Run the uninstaller silently.
|
||||
ExecWait '"$INSTDIR\uninst.exe /S"'
|
||||
; The "if" is necessary becaused older installer versions
|
||||
; did not set "InstallDir".
|
||||
CopyFiles "$R0" "$TEMP\uninst.exe"
|
||||
${If} $R1 != ""
|
||||
ExecWait '$TEMP\uninst.exe /S _?=$R1'
|
||||
${Else}
|
||||
Push $R0
|
||||
Call GetParent
|
||||
Pop $R0
|
||||
ExecWait '$TEMP\uninst.exe /S _?=$R0'
|
||||
${EndIf}
|
||||
|
||||
Done:
|
||||
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section "MainSection" SEC01
|
||||
; GetParent
|
||||
; input, top of stack (e.g. C:\Program Files\Poop)
|
||||
; output, top of stack (replaces, with e.g. C:\Program Files)
|
||||
; modifies no other variables.
|
||||
;
|
||||
; Usage:
|
||||
; Push "C:\Program Files\Directory\Whatever"
|
||||
; Call GetParent
|
||||
; Pop $R0
|
||||
; ; at this point $R0 will equal "C:\Program Files\Directory"
|
||||
Function GetParent
|
||||
|
||||
Exch $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R1 0
|
||||
StrLen $R2 $R0
|
||||
|
||||
loop:
|
||||
IntOp $R1 $R1 + 1
|
||||
IntCmp $R1 $R2 get 0 get
|
||||
StrCpy $R3 $R0 1 -$R1
|
||||
StrCmp $R3 "\" get
|
||||
Goto loop
|
||||
|
||||
get:
|
||||
StrCpy $R0 $R0 -$R1
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section "OpenTK Library (required)" SEC01
|
||||
SectionIn RO
|
||||
|
||||
${If} $INSTDIR == $PROGRAMFILES
|
||||
${OrIf} $INSTDIR == $DOCUMENTS
|
||||
${OrIf} $INSTDIR == $DESKTOP
|
||||
|
@ -188,21 +165,31 @@ Section "MainSection" SEC01
|
|||
SetOutPath $INSTDIR
|
||||
File /r /x *.vshost.exe /x *.vshost.exe.manifest /x *.log ..\..\Binaries
|
||||
File /r /x .svn /x Source /x Source\*.* ..\..\Documentation
|
||||
SectionEnd
|
||||
|
||||
Section "Source code" SEC02
|
||||
SetOutPath $INSTDIR
|
||||
File /r /x .svn /x obj /x *.snk /x *.user /x *.pidb /x html /x latex /x OpenTK*.xml ..\..\Source
|
||||
File ..\..\Build.exe
|
||||
File /r /x .svn ..\..\*.csproj
|
||||
File ..\..\*.sln
|
||||
File /r /x .svn /x opentk-actual.* /x opentk*.exe /x opentk*.msi /x opentk*.deb /x opentk*.rpm ..\..\Installers
|
||||
File /r /x .svn /x opentk-actual.* /x *.exe /x *.msi /x *.deb /x *.rpm ..\..\Installers
|
||||
SectionEnd
|
||||
|
||||
Section "OpenAL drivers" SEC03
|
||||
SetOutPath $INSTDIR\Installers\Dependencies
|
||||
File ..\..\Installers\Dependencies\oalinst.exe
|
||||
ExecShell "open" '"$INSTDIR\Installers\Dependencies\oalinst.exe"' /S
|
||||
SectionEnd
|
||||
|
||||
Section -AdditionalIcons
|
||||
SetOutPath $INSTDIR
|
||||
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
|
||||
CreateDirectory "$SMPROGRAMS\OpenTK"
|
||||
CreateShortCut "$SMPROGRAMS\OpenTK\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
CreateShortCut "$SMPROGRAMS\OpenTK\Examples.lnk" "$INSTDIR\Binaries\OpenTK\Debug\Examples.exe"
|
||||
;CreateShortCut "$SMPROGRAMS\OpenTK\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
CreateShortCut "$SMPROGRAMS\OpenTK\Examples.lnk" "$INSTDIR\Binaries\OpenTK\Release\Examples.exe"
|
||||
CreateShortCut "$SMPROGRAMS\OpenTK\Reference.lnk" "$INSTDIR\Documentation\Reference.pdf"
|
||||
CreateShortCut "$SMPROGRAMS\OpenTK\Manual.lnk" "$INSTDIR\Documentation\Manual.pdf"
|
||||
CreateShortCut "$SMPROGRAMS\OpenTK\Release.lnk" "$INSTDIR\Documentation\Release.txt"
|
||||
;CreateShortCut "$SMPROGRAMS\OpenTK\Release.lnk" "$INSTDIR\Documentation\Release.txt"
|
||||
SectionEnd
|
||||
|
||||
Section -Post
|
||||
|
@ -211,27 +198,23 @@ Section -Post
|
|||
${EndIf}
|
||||
WriteUninstaller "$INSTDIR\uninst.exe"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||
WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${DOTNET20_PUBLIC_ASSEMBLIES_KEY}" "" "$INSTDIR\Binaries\OpenTK\Release"
|
||||
|
||||
; Install necessary dependencies
|
||||
ExecShell "open" '"$INSTDIR\Installers\Dependencies\oalinst.exe"' /S
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function un.onUninstSuccess
|
||||
HideWindow
|
||||
;MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully uninstalled."
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
; !insertmacro MULTIUSER_UNINIT
|
||||
!insertmacro MUI_UNGETLANGUAGE
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you wish to completely uninstall $(^Name) and all of its components?" IDYES +2
|
||||
Abort
|
||||
IfSilent +3
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you wish to completely uninstall $(^Name) and all of its components?" IDYES +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Section Uninstall
|
||||
|
@ -242,12 +225,7 @@ Section Uninstall
|
|||
Delete "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
Delete "$INSTDIR\uninst.exe"
|
||||
|
||||
Delete "$SMPROGRAMS\OpenTK\Examples.lnk"
|
||||
Delete "$SMPROGRAMS\OpenTK\Website.lnk"
|
||||
Delete "$SMPROGRAMS\OpenTK\Reference.lnk"
|
||||
Delete "$SMPROGRAMS\OpenTK\Manual.lnk"
|
||||
Delete "$SMPROGRAMS\OpenTK\Release.lnk"
|
||||
RMDir "$SMPROGRAMS\OpenTK"
|
||||
RMDir /r "$SMPROGRAMS\OpenTK"
|
||||
|
||||
Delete "$INSTDIR\*.sln"
|
||||
Delete "$INSTDIR\Build.exe"
|
||||
|
@ -258,6 +236,7 @@ Section Uninstall
|
|||
RMDir /r "$INSTDIR\Binaries"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
|
||||
DeleteRegKey ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}"
|
||||
DeleteRegKey ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${DOTNET20_PUBLIC_ASSEMBLIES_KEY}"
|
||||
SetAutoClose true
|
||||
|
|
Loading…
Reference in a new issue