filebot/installer/nsis/filebot.nsi

125 lines
3.5 KiB
Plaintext
Raw Normal View History

2013-08-04 13:18:07 +00:00
;--------------------------------
; FileBot NSIS installer script
2013-08-04 13:18:07 +00:00
;--------------------------------
!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
2013-08-04 13:18:07 +00:00
ShowInstDetails show
ShowUnInstDetails show
;--------------------------------
; Includes
;--------------------------------
!include "MUI2.nsh"
!include "x64.nsh"
2013-08-04 13:18:07 +00:00
;--------------------------------
; Modern UI Configuration
;--------------------------------
; MUI Settings
!define MUI_ABORTWARNING
; MUI Settings / Icons
2013-08-04 13:18:07 +00:00
!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
2013-08-04 13:18:07 +00:00
!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
2013-08-04 13:18:07 +00:00
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
;--------------------------------
; Installer pages
;--------------------------------
2013-08-04 13:18:07 +00:00
; Welcome page
!insertmacro MUI_PAGE_WELCOME
2013-08-04 13:18:07 +00:00
; End user license agreement
!insertmacro MUI_PAGE_LICENSE "FileBot_EULA.txt"
; Perform installation
!insertmacro MUI_PAGE_INSTFILES
2013-08-04 13:18:07 +00:00
; Finish page
!insertmacro MUI_PAGE_FINISH
;--------------------------------
; Language support
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
2013-08-04 13:18:07 +00:00
LangString Section_Name_MainProduct ${LANG_ENGLISH} "${PRODUCT_PROPER_NAME}"
2013-08-04 13:18:07 +00:00
;---------------------------
; 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()"`
2013-08-04 13:18:07 +00:00
DetailPrint "Downloading latest version..."
${if} ${RunningX64}
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (64-bit)" "http://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)" "http://www.filebot.net/download.php?mode=nsis&type=msi&arch=x86" "$PLUGINSDIR\FileBot.msi" /end
${endif}
DetailPrint "Installing latest version..."
nsExec::Exec `msiexec /passive /i "$PLUGINSDIR\FileBot.msi"`
2013-08-04 13:18:07 +00:00
Pop $MSI_STATUS # grab return value
${if} $MSI_STATUS == "0"
DetailPrint "Clearing cache and temporary files..."
nsExec::Exec `"C:\Program Files\FileBot\filebot.exe" -clear-cache`
DetailPrint "Initializing Cache..."
nsExec::Exec `"C:\Program Files\FileBot\filebot.exe" -script "g:net.sourceforge.filebot.media.MediaDetection.warmupCachedResources()"`
2013-08-04 13:18:07 +00:00
${else}
DetailPrint "msiexec error $MSI_STATUS"
DetailPrint "Install failed. Please download the .msi package manually."
Abort
2013-08-04 13:18:07 +00:00
${endif}
SectionEnd