1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-04 16:35:08 -05:00
filebot/installer/nsis/filebot.nsi

124 lines
3.6 KiB
Plaintext
Raw Normal View History

2013-08-04 09:18:07 -04:00
;--------------------------------
; FileBot NSIS installer script
2013-08-04 09:18:07 -04: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 09:18:07 -04:00
ShowInstDetails show
ShowUnInstDetails show
;--------------------------------
; Includes
;--------------------------------
!include "MUI2.nsh"
!include "x64.nsh"
2013-08-04 09:18:07 -04:00
;--------------------------------
; Modern UI Configuration
;--------------------------------
; MUI Settings
!define MUI_ABORTWARNING
; MUI Settings / Icons
2013-08-04 09:18:07 -04: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 09:18:07 -04: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 09:18:07 -04: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 09:18:07 -04:00
; Welcome page
!insertmacro MUI_PAGE_WELCOME
2013-08-04 09:18:07 -04:00
; End user license agreement
!insertmacro MUI_PAGE_LICENSE "FileBot_EULA.txt"
; Perform installation
!insertmacro MUI_PAGE_INSTFILES
2013-08-04 09:18:07 -04:00
; Finish page
!insertmacro MUI_PAGE_FINISH
;--------------------------------
; Language support
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
2013-08-04 09:18:07 -04:00
LangString Section_Name_MainProduct ${LANG_ENGLISH} "${PRODUCT_PROPER_NAME}"
2013-08-04 09:18:07 -04:00
;---------------------------
; Install sections
;---------------------------
Var MSI_STATUS
Section MAIN
DetailPrint "Uninstalling previous versions..."
2016-04-08 19:50:29 -04:00
nsExec::Exec `start "wmic" /b cmd.exe /c wmic.exe product where name="FileBot" call uninstall`
2013-08-04 09:18:07 -04:00
DetailPrint "Downloading latest version..."
${if} ${RunningX64}
2015-06-03 09:24:13 -04:00
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (64-bit)" "https://app.filebot.net/download.php?type=msi&arch=x64" "$PLUGINSDIR\FileBot.msi" /end
2013-08-04 09:18:07 -04:00
${else}
2015-06-03 09:24:13 -04:00
inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (32-bit)" "https://app.filebot.net/download.php?type=msi&arch=x86" "$PLUGINSDIR\FileBot.msi" /end
2013-08-04 09:18:07 -04:00
${endif}
2013-08-04 09:18:07 -04:00
DetailPrint "Installing latest version..."
nsExec::Exec `msiexec /passive /norestart /i "$PLUGINSDIR\FileBot.msi"`
2013-08-04 09:18:07 -04:00
Pop $MSI_STATUS # grab return value
2013-08-04 09:18:07 -04:00
${if} $MSI_STATUS == "0"
DetailPrint "Optimizing..."
2016-03-08 11:40:44 -05:00
nsExec::ExecToLog `"C:\Program Files\FileBot\filebot.exe" -script "g:println net.filebot.Settings.getApplicationIdentifier(); println 'JRE: ' + Settings.getJavaRuntimeIdentifier(); println String.format('JVM: %d-bit %s', com.sun.jna.Platform.is64Bit() ? 64 : 32, System.getProperty('java.vm.name')); java.util.prefs.Preferences.userRoot(); net.filebot.CacheManager.getInstance().clearAll(); net.filebot.media.MediaDetection.warmupCachedResources();" --log OFF`
2014-11-07 04:20:38 -05:00
DetailPrint "Done."
2013-08-04 09:18:07 -04:00
${else}
DetailPrint "msiexec error $MSI_STATUS"
DetailPrint "Installation failed. Please download the .msi package manually."
Abort
2013-08-04 09:18:07 -04:00
${endif}
SectionEnd