Simple-x264-Launcher/etc/setup/wrapper.nsi

215 lines
5.9 KiB
Plaintext
Raw Normal View History

2013-12-13 15:25:57 +01:00
; ///////////////////////////////////////////////////////////////////////////////
2013-12-13 15:35:46 +01:00
; // Simple x264 Launcher
2016-01-01 23:59:55 +01:00
; // Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
2013-12-13 15:25:57 +01:00
; //
; // This program is free software; you can redistribute it and/or modify
; // it under the terms of the GNU General Public License as published by
; // the Free Software Foundation; either version 2 of the License, or
; // (at your option) any later version.
; //
; // This program is distributed in the hope that it will be useful,
; // but WITHOUT ANY WARRANTY; without even the implied warranty of
; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; // GNU General Public License for more details.
; //
; // You should have received a copy of the GNU General Public License along
; // with this program; if not, write to the Free Software Foundation, Inc.,
; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; //
; // http://www.gnu.org/licenses/gpl-2.0.txt
; ///////////////////////////////////////////////////////////////////////////////
;--------------------------------
;Basic Defines
;--------------------------------
2013-12-13 15:35:46 +01:00
!ifndef X264_BUILD
!error "X264_BUILD is not defined !!!"
2013-12-13 15:25:57 +01:00
!endif
2013-12-13 15:35:46 +01:00
!ifndef X264_DATE
!error "X264_DATE is not defined !!!"
2013-12-13 15:25:57 +01:00
!endif
2013-12-13 15:35:46 +01:00
!ifndef X264_OUTPUT_FILE
!error "X264_OUTPUT_FILE is not defined !!!"
2013-12-13 15:25:57 +01:00
!endif
2013-12-13 15:35:46 +01:00
!ifndef X264_SOURCE_FILE
!error "X264_SOURCE_FILE is not defined !!!"
2013-12-13 15:25:57 +01:00
!endif
2013-12-13 15:35:46 +01:00
!ifndef X264_UPX_PATH
!error "X264_UPX_PATH is not defined !!!"
2013-12-13 15:25:57 +01:00
!endif
;Web-Site
!define MyWebSite "http://mulder.at.gg/"
;Installer file name
2013-12-13 15:35:46 +01:00
!define InstallerFileName "$PLUGINSDIR\x264_x64-SETUP-r${X264_BUILD}.exe"
2013-12-13 15:25:57 +01:00
;--------------------------------
;Includes
;--------------------------------
!include `LogicLib.nsh`
!include `StdUtils.nsh`
;--------------------------------
;Installer Attributes
;--------------------------------
XPStyle on
RequestExecutionLevel user
InstallColors /windows
2013-12-13 15:35:46 +01:00
Name "Simple x264 Launcher [Build #${X264_BUILD}]"
OutFile "${X264_OUTPUT_FILE}"
BrandingText "${X264_DATE} / Build #${X264_BUILD}"
2013-12-13 15:25:57 +01:00
Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
2015-10-14 21:20:28 +02:00
ShowInstDetails nevershow
2013-12-13 15:25:57 +01:00
AutoCloseWindow true
InstallDir ""
;--------------------------------
;Page Captions
;--------------------------------
SubCaption 0 " "
SubCaption 1 " "
SubCaption 2 " "
SubCaption 3 " "
SubCaption 4 " "
;--------------------------------
;Compressor
;--------------------------------
2013-12-13 15:35:46 +01:00
!packhdr "$%TEMP%\exehead.tmp" '"${X264_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
2013-12-13 15:25:57 +01:00
;--------------------------------
;Reserved Files
;--------------------------------
ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
2015-10-14 21:20:28 +02:00
ReserveFile "${NSISDIR}\Plugins\SelfDel.dll"
2013-12-13 15:25:57 +01:00
;--------------------------------
;Version Info
;--------------------------------
2013-12-13 15:35:46 +01:00
!searchreplace PRODUCT_VERSION_DATE "${X264_DATE}" "-" "."
VIProductVersion "${PRODUCT_VERSION_DATE}.${X264_BUILD}"
2013-12-13 15:25:57 +01:00
VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
VIAddVersionKey "Comments" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."
VIAddVersionKey "CompanyName" "Free Software Foundation"
2013-12-13 15:35:46 +01:00
VIAddVersionKey "FileDescription" "Simple x264 Launcher [Build #${X264_BUILD}]"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${X264_BUILD}"
2016-01-01 23:59:55 +01:00
VIAddVersionKey "LegalCopyright" "Copyright 2004-2016 LoRd_MuldeR"
2013-12-13 15:25:57 +01:00
VIAddVersionKey "LegalTrademarks" "GNU"
2013-12-13 15:35:46 +01:00
VIAddVersionKey "OriginalFilename" "x264_x64.${X264_DATE}.exe"
VIAddVersionKey "ProductName" "Simple x264 Launcher"
VIAddVersionKey "ProductVersion" "Build #${X264_BUILD} (${X264_DATE})"
2013-12-13 15:25:57 +01:00
VIAddVersionKey "Website" "${MyWebSite}"
;--------------------------------
;Installer initialization
;--------------------------------
Section "-LaunchTheInstaller"
SetDetailsPrint textonly
DetailPrint "Launching installer, please stay tuned..."
SetDetailsPrint listonly
InitPluginsDir
SetOutPath "$PLUGINSDIR"
2015-10-14 21:20:28 +02:00
${StdUtils.TestParameter} $R0 "Update"
${If} "$R0" == "true"
SetFileAttributes "$EXEPATH" FILE_ATTRIBUTE_NORMAL
SelfDel::del /RMDIR
${EndIf}
2013-12-13 15:25:57 +01:00
SetOverwrite on
2013-12-13 15:35:46 +01:00
File "/oname=${InstallerFileName}" "${X264_SOURCE_FILE}"
2013-12-13 15:25:57 +01:00
; --------
2013-12-13 15:35:46 +01:00
${If} "$EXEFILE" == "x264_launcher.exe"
MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, you must NOT rename the installation program to 'x264_launcher.exe'. Please re-rename the installer executable file (e.g. to 'x264_x64-Setup.exe') and then try again!"
2013-12-13 15:25:57 +01:00
Quit
${EndIf}
; --------
${StdUtils.GetAllParameters} $R9 0
${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
${IfNot} "$R9" == ""
DetailPrint "Parameters: $R9"
${EndIf}
; --------
${Do}
SetOverwrite ifdiff
2013-12-13 15:35:46 +01:00
File "/oname=${InstallerFileName}" "${X264_SOURCE_FILE}"
2013-12-13 15:25:57 +01:00
DetailPrint "ExecShellWait: ${InstallerFileName}"
${StdUtils.ExecShellWaitEx} $R1 $R2 "${InstallerFileName}" "open" '$R9'
DetailPrint "Result: $R1 ($R2)"
${IfThen} $R1 == "no_wait" ${|} Goto RunSuccess ${|}
${If} $R1 == "ok"
Sleep 333
HideWindow
${StdUtils.WaitForProcEx} $R1 $R2
Goto RunSuccess
${EndIf}
MessageBox MB_RETRYCANCEL|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDCANCEL FallbackMode
${Loop}
; -----------
FallbackMode:
DetailPrint "Installer not launched yet, trying fallback mode!"
SetOverwrite ifdiff
2013-12-13 15:35:46 +01:00
File "/oname=${InstallerFileName}" "${X264_SOURCE_FILE}"
2013-12-13 15:25:57 +01:00
ClearErrors
ExecShell "open" "${InstallerFileName}" '$R9' SW_SHOWNORMAL
IfErrors 0 RunSuccess
ClearErrors
ExecShell "" "${InstallerFileName}" '$R9' SW_SHOWNORMAL
IfErrors 0 RunSuccess
; --------
SetDetailsPrint both
DetailPrint "Failed to launch installer :-("
SetDetailsPrint listonly
SetErrorLevel 1
2015-10-14 21:20:28 +02:00
SetOutPath "$TEMP"
2013-12-13 15:25:57 +01:00
Abort "Aborted."
; --------
RunSuccess:
Delete /REBOOTOK "${InstallerFileName}"
SetErrorLevel 0
2015-10-14 21:20:28 +02:00
SetOutPath "$TEMP"
2013-12-13 15:25:57 +01:00
SectionEnd