2011-10-02 22:14:09 +02:00
; ///////////////////////////////////////////////////////////////////////////////
; // LameXP - Audio Encoder Front-End
2012-02-23 21:21:02 +01:00
; // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
2011-10-02 22:14:09 +02: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
;--------------------------------
!ifndef LAMEXP_VERSION
!error "LAMEXP_VERSION is not defined !!!"
!endif
!ifndef LAMEXP_BUILD
!error "LAMEXP_BUILD is not defined !!!"
!endif
!ifndef LAMEXP_INSTTYPE
!error "LAMEXP_INSTTYPE is not defined !!!"
!endif
!ifndef LAMEXP_PATCH
!error "LAMEXP_PATCH is not defined !!!"
!endif
!ifndef LAMEXP_DATE
!error "LAMEXP_DATE is not defined !!!"
!endif
!ifndef LAMEXP_OUTPUT_FILE
!error "LAMEXP_OUTPUT_FILE is not defined !!!"
!endif
!ifndef LAMEXP_SOURCE_FILE
!error "LAMEXP_SOURCE_FILE is not defined !!!"
!endif
!ifndef LAMEXP_UPX_PATH
!error "LAMEXP_UPX_PATH is not defined !!!"
!endif
;Web-Site
!define MyWebSite "http://mulder.at.gg/"
2013-11-26 22:58:14 +01:00
;Installer file name
!define InstallerFileName "$PLUGINSDIR\LameXP-SETUP-r${LAMEXP_BUILD}.exe"
2011-10-02 22:14:09 +02:00
;--------------------------------
;Includes
;--------------------------------
2011-10-10 22:26:50 +02:00
!include `LogicLib.nsh`
2011-10-08 18:20:20 +02:00
!include `StdUtils.nsh`
2011-10-02 22:14:09 +02:00
;--------------------------------
;Installer Attributes
;--------------------------------
XPStyle on
2011-10-03 01:33:12 +02:00
RequestExecutionLevel user
2011-10-02 23:32:15 +02:00
InstallColors /windows
2011-10-02 22:14:09 +02:00
Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
OutFile "${LAMEXP_OUTPUT_FILE}"
2011-10-02 23:32:15 +02:00
BrandingText "${LAMEXP_DATE} / Build #${LAMEXP_BUILD}"
2011-10-02 22:14:09 +02:00
Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
ShowInstDetails show
AutoCloseWindow true
2011-10-03 01:33:12 +02:00
InstallDir ""
2011-10-02 22:14:09 +02:00
;--------------------------------
;Page Captions
;--------------------------------
SubCaption 0 " "
SubCaption 1 " "
SubCaption 2 " "
SubCaption 3 " "
SubCaption 4 " "
;--------------------------------
;Compressor
;--------------------------------
!packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
2011-10-03 12:52:12 +02:00
;--------------------------------
;Reserved Files
;--------------------------------
ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
2011-10-02 22:14:09 +02:00
;--------------------------------
;Version Info
;--------------------------------
!searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
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"
VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
2012-02-23 21:21:02 +01:00
VIAddVersionKey "LegalCopyright" "Copyright 2004-2012 LoRd_MuldeR"
2011-10-02 22:14:09 +02:00
VIAddVersionKey "LegalTrademarks" "GNU"
2012-04-20 21:11:06 +02:00
VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.Build-${LAMEXP_BUILD}.exe"
2011-10-02 22:14:09 +02:00
VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
VIAddVersionKey "Website" "${MyWebSite}"
;--------------------------------
;Installer initialization
;--------------------------------
Section "-LaunchTheInstaller"
SetDetailsPrint textonly
DetailPrint "Launching installer, please stay tuned..."
SetDetailsPrint listonly
InitPluginsDir
SetOutPath "$PLUGINSDIR"
2013-11-26 22:58:14 +01:00
SetOverwrite on
File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
2011-10-02 23:32:15 +02:00
; --------
2011-11-06 14:19:47 +01:00
${If} "$EXEFILE" == "LameXP.exe"
${OrIf} "$EXEFILE" == "LameXP-Portable.exe"
MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, you must NOT rename the LameXP installation program to 'LameXP.exe' or 'LameXP-Portable.exe'. Please re-rename the installer executable file (e.g. to 'LameXP-Setup.exe') and then try again!"
Quit
${EndIf}
; --------
2011-10-10 20:24:17 +02:00
${StdUtils.GetAllParameters} $R9 0
2011-10-10 22:26:50 +02:00
${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
${IfNot} "$R9" == ""
DetailPrint "Parameters: $R9"
${EndIf}
2011-10-02 23:32:15 +02:00
; --------
2013-11-26 22:58:14 +01:00
${Do}
SetOverwrite ifdiff
File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
DetailPrint "ExecShellWait: ${InstallerFileName}"
2013-12-07 15:55:44 +01:00
${StdUtils.ExecShellWaitEx} $R1 $R2 "${InstallerFileName}" "open" '$R9'
DetailPrint "Result: $R1 ($R2)"
2013-11-26 22:58:14 +01:00
${IfThen} $R1 == "no_wait" ${|} Goto RunSuccess ${|}
2013-12-07 15:55:44 +01:00
${If} $R1 == "ok"
2013-11-26 22:58:14 +01:00
Sleep 333
HideWindow
2013-12-07 15:55:44 +01:00
${StdUtils.WaitForProcEx} $R1 $R2
2013-11-26 22:58:14 +01:00
Goto RunSuccess
${EndIf}
MessageBox MB_RETRYCANCEL|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDCANCEL FallbackMode
${Loop}
2011-10-03 12:52:12 +02:00
2013-11-26 22:58:14 +01:00
; -----------
2011-10-03 12:52:12 +02:00
2013-11-26 22:58:14 +01:00
FallbackMode:
2011-10-03 12:52:12 +02:00
2013-11-26 22:58:14 +01:00
DetailPrint "Installer not launched yet, trying fallback mode!"
2011-10-03 12:52:12 +02:00
2013-11-25 19:52:53 +01:00
SetOverwrite ifdiff
2013-11-26 22:58:14 +01:00
File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
2013-11-25 19:52:53 +01:00
2011-10-02 22:14:09 +02:00
ClearErrors
2013-11-26 22:58:14 +01:00
ExecShell "open" "${InstallerFileName}" '$R9' SW_SHOWNORMAL
2011-10-02 22:14:09 +02:00
IfErrors 0 RunSuccess
2011-10-08 22:58:11 +02:00
2011-10-02 22:14:09 +02:00
ClearErrors
2013-11-26 22:58:14 +01:00
ExecShell "" "${InstallerFileName}" '$R9' SW_SHOWNORMAL
2011-10-02 22:14:09 +02:00
IfErrors 0 RunSuccess
2011-10-08 22:58:11 +02:00
; --------
SetDetailsPrint both
DetailPrint "Failed to launch installer :-("
SetDetailsPrint listonly
2013-11-25 19:52:53 +01:00
SetErrorLevel 1
2011-10-08 22:58:11 +02:00
Abort "Aborted."
2011-10-03 12:52:12 +02:00
; --------
2011-10-02 22:14:09 +02:00
RunSuccess:
2011-10-03 12:52:12 +02:00
2013-11-26 22:58:14 +01:00
Delete /REBOOTOK "${InstallerFileName}"
2013-11-25 19:52:53 +01:00
SetErrorLevel 0
2012-04-06 16:36:13 +02:00
SectionEnd