filebot/installer/nsis/filebot.nsi

128 lines
3.7 KiB
Plaintext

;--------------------------------
; FileBot NSIS installer script
;--------------------------------
!define PRODUCT_PROPER_NAME "FileBot"
!define INSTALLER_EXE_NAME "FileBot-setup.exe"
!define OPTION_USE_MUI_2
;--------------------------------
; Installer Configuration
;--------------------------------
; Request admin privileges for Windows Vista, 7.
RequestExecutionLevel admin
; Name (shown in various places in the installer UI)
Name "${PRODUCT_PROPER_NAME}"
; Output file generated by NSIS compiler
OutFile "${INSTALLER_EXE_NAME}"
; Use lzma compression
SetCompressor lzma
; Optimize Data Block
SetDatablockOptimize on
; Restore last write datestamp of files
; SetDateSave on
; Show installation details
ShowInstDetails show
ShowUnInstDetails show
;--------------------------------
; Includes
;--------------------------------
!include "MUI2.nsh"
!include "x64.nsh"
;--------------------------------
; Modern UI Configuration
;--------------------------------
; MUI Settings
!define MUI_ABORTWARNING
; MUI Settings / Icons
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
; MUI Settings / Header
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-r.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall-r.bmp"
; MUI Settings / Wizard
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
;--------------------------------
; Installer pages
;--------------------------------
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; End user license agreement
!insertmacro MUI_PAGE_LICENSE "FileBot_EULA.txt"
; Perform installation
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
;--------------------------------
; Language support
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
LangString Section_Name_MainProduct ${LANG_ENGLISH} "${PRODUCT_PROPER_NAME}"
;---------------------------
; Install sections
;---------------------------
Var MSI_STATUS
Section MAIN
DetailPrint "Downloading latest version..."
${if} ${RunningX64}
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (64-bit)" "https://app.filebot.net/download.php?type=msi&arch=x64" "$PLUGINSDIR\FileBot.msi" /end
${else}
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (32-bit)" "https://app.filebot.net/download.php?type=msi&arch=x86" "$PLUGINSDIR\FileBot.msi" /end
${endif}
DetailPrint "Installing latest version..."
nsExec::Exec `msiexec /passive /norestart /i "$PLUGINSDIR\FileBot.msi"`
Pop $MSI_STATUS # grab return value
${if} $MSI_STATUS == "0"
DetailPrint "Optimizing..."
nsExec::ExecToLog `"C:\Program Files\FileBot\filebot.exe" -script "g:println Settings.applicationIdentifier; println 'JRE: '+Settings.javaRuntimeIdentifier; println 'JVM: '+(com.sun.jna.Platform.is64Bit() ? 64 : 32)+'-bit '+System.getProperty('java.vm.name'); java.util.prefs.Preferences.userRoot(); CacheManager.getInstance().clearAll(); MediaDetection.warmupCachedResources();" --log OFF`
ExecShell "open" "https://www.filebot.net/getting-started/index.html"
ExecShell "open" "https://www.filebot.net/manual.html"
DetailPrint "Done."
${else}
DetailPrint "msiexec error $MSI_STATUS"
ExecShell "open" "https://www.filebot.net/files/"
${if} ${RunningX64}
DetailPrint "Installation failed. Please download the x64 msi package yourself."
${else}
DetailPrint "Installation failed. Please download the x86 msi package yourself."
${endif}
Abort
${endif}
SectionEnd