1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 22:05:00 -05:00
filebot/installer/nsis/filebot.nsi
2014-11-07 09:20:38 +00:00

122 lines
3.2 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 "Uninstalling previous versions..."
nsExec::Exec `Powershell.exe -inputformat none -noprofile -windowstyle hidden -Command "(Get-WmiObject -Class Win32_Product -Filter \"Name = 'FileBot'\").uninstall()"`
DetailPrint "Downloading latest version..."
${if} ${RunningX64}
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (64-bit)" "https://www.filebot.net/download.php?mode=nsis&type=msi&arch=x64" "$PLUGINSDIR\FileBot.msi" /end
${else}
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (32-bit)" "https://www.filebot.net/download.php?mode=nsis&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 "Done."
${else}
DetailPrint "msiexec error $MSI_STATUS"
DetailPrint "Install failed. Please download the .msi package manually."
Abort
${endif}
SectionEnd