2013-08-04 13:18:07 +00:00
|
|
|
;--------------------------------
|
2014-01-19 15:29:27 +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
|
|
|
|
|
2014-01-19 15:29:27 +00:00
|
|
|
; Show installation details
|
2013-08-04 13:18:07 +00:00
|
|
|
ShowInstDetails show
|
|
|
|
ShowUnInstDetails show
|
|
|
|
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; Includes
|
|
|
|
;--------------------------------
|
|
|
|
!include "MUI2.nsh"
|
2014-01-19 15:29:27 +00:00
|
|
|
!include "x64.nsh"
|
2013-08-04 13:18:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; Modern UI Configuration
|
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
; MUI Settings
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
|
2013-06-15 10:01:31 +00:00
|
|
|
; 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"
|
2013-06-15 10:01:31 +00:00
|
|
|
|
|
|
|
; 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"
|
|
|
|
|
2013-06-15 10:01:31 +00:00
|
|
|
; 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-06-15 10:01:31 +00:00
|
|
|
|
2013-08-04 13:18:07 +00:00
|
|
|
; Welcome page
|
2013-06-15 10:01:31 +00:00
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
2013-08-04 13:18:07 +00:00
|
|
|
|
|
|
|
; End user license agreement
|
2014-01-19 15:29:27 +00:00
|
|
|
!insertmacro MUI_PAGE_LICENSE "FileBot_EULA.txt"
|
|
|
|
|
|
|
|
; Perform installation
|
2013-06-15 10:01:31 +00:00
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
2013-08-04 13:18:07 +00:00
|
|
|
|
|
|
|
; Finish page
|
|
|
|
!insertmacro MUI_PAGE_FINISH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; Language support
|
|
|
|
;--------------------------------
|
|
|
|
|
2013-06-15 10:01:31 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
2013-08-04 13:18:07 +00:00
|
|
|
LangString Section_Name_MainProduct ${LANG_ENGLISH} "${PRODUCT_PROPER_NAME}"
|
2013-06-15 10:01:31 +00:00
|
|
|
|
2013-08-04 13:18:07 +00:00
|
|
|
|
|
|
|
;---------------------------
|
|
|
|
; Install sections
|
|
|
|
;---------------------------
|
|
|
|
Var MSI_STATUS
|
|
|
|
|
|
|
|
|
2014-01-19 15:29:27 +00:00
|
|
|
Section MAIN
|
2013-12-26 05:29:39 +00:00
|
|
|
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..."
|
2013-12-26 05:29:39 +00:00
|
|
|
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"
|
2014-01-19 15:29:27 +00:00
|
|
|
DetailPrint "Clearing cache and temporary files..."
|
2014-01-13 04:11:05 +00:00
|
|
|
nsExec::Exec `"C:\Program Files\FileBot\filebot.exe" -clear-cache`
|
2014-01-19 15:29:27 +00:00
|
|
|
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}
|
2013-08-07 18:36:28 +00:00
|
|
|
DetailPrint "msiexec error $MSI_STATUS"
|
2014-01-13 04:11:05 +00:00
|
|
|
DetailPrint "Install failed. Please download the .msi package manually."
|
2013-06-15 10:01:31 +00:00
|
|
|
Abort
|
2013-08-04 13:18:07 +00:00
|
|
|
${endif}
|
2013-06-15 10:01:31 +00:00
|
|
|
SectionEnd
|