; ///////////////////////////////////////////////////////////////////////////////
; // LameXP - Audio Encoder Front-End
-; // Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+; // Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
; //
; // 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
!error "LAMEXP_UPX_PATH is not defined !!!"
!endif
-;UUID
-!define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
-
;Web-Site
!define MyWebSite "http://mulder.at.gg/"
+;Installer file name
+!define InstallerFileName "$PLUGINSDIR\LameXP-SETUP-r${LAMEXP_BUILD}.exe"
;--------------------------------
;Includes
;--------------------------------
-!include `parameters.nsh`
+!include `LogicLib.nsh`
+!include `StdUtils.nsh`
;--------------------------------
BrandingText "${LAMEXP_DATE} / Build #${LAMEXP_BUILD}"
Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
-ShowInstDetails show
+ShowInstDetails nevershow
AutoCloseWindow true
InstallDir ""
ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
+ReserveFile "${NSISDIR}\Plugins\SelfDel.dll"
;--------------------------------
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})"
-VIAddVersionKey "LegalCopyright" "Copyright 2004-2011 LoRd_MuldeR"
+VIAddVersionKey "LegalCopyright" "Copyright 2004-2015 LoRd_MuldeR"
VIAddVersionKey "LegalTrademarks" "GNU"
-VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
+VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.Build-${LAMEXP_BUILD}.exe"
VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
VIAddVersionKey "Website" "${MyWebSite}"
InitPluginsDir
SetOutPath "$PLUGINSDIR"
- File "/oname=$PLUGINSDIR\LameXP-Install.exe" "${LAMEXP_SOURCE_FILE}"
-
- ; --------
-
- StrCpy $R9 ""
- !insertmacro GetCommandlineParameter "Update" "?" $R0
- StrCmp "$R0" "?" +5
- StrCmp "$R0" "" 0 +3
- StrCpy $R9 "/Update"
- Goto +2
- StrCpy $R9 '"/Update=$R0"'
+ ${StdUtils.TestParameter} $R0 "Update"
+ ${If} "$R0" == "true"
+ SetFileAttributes "$EXEPATH" FILE_ATTRIBUTE_NORMAL
+ SelfDel::del /RMDIR
+ ${EndIf}
- StrCmp "$INSTDIR" "" +5
- StrCmp "$R9" "" 0 +3
- StrCpy $R9 '/D=$INSTDIR'
- Goto +2
- StrCpy $R9 '$R9 /D=$INSTDIR'
-
- ; --------
+ SetOverwrite on
+ File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
- RunTryAgain:
-
- DetailPrint "Exec: $PLUGINSDIR\LameXP-Install.exe"
- StdUtils::ExecShellWait /NOUNLOAD '$R9' "open" "$PLUGINSDIR\LameXP-Install.exe"
- Pop $R1
- DetailPrint "Result: $R1"
-
- StrCmp $R1 "error" RunFailed
- StrCmp $R1 "no_wait" RunSuccess
- Sleep 333
- HideWindow
- StdUtils::WaitForProc /NOUNLOAD $R1
- Goto RunSuccess
+ ; --------
+ ${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}
+
; --------
- RunFailed:
+ ${StdUtils.GetAllParameters} $R9 0
+ ${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
- MessageBox MB_ABORTRETRYIGNORE|MB_DEFBUTTON2|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDRETRY RunTryAgain IDIGNORE RunFallback
+ ${IfNot} "$R9" == ""
+ DetailPrint "Parameters: $R9"
+ ${EndIf}
- SetDetailsPrint both
- DetailPrint "Failed to launch installer :-("
- SetDetailsPrint listonly
-
- StdUtils::Unload
- Abort "Aborted."
-
; --------
- RunFallback:
+ ${Do}
+ SetOverwrite ifdiff
+ File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
+
+ 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
+ File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
+
ClearErrors
- ExecShell "open" "$PLUGINSDIR\LameXP-Install.exe" '$R9' SW_SHOWNORMAL
+ ExecShell "open" "${InstallerFileName}" '$R9' SW_SHOWNORMAL
IfErrors 0 RunSuccess
-
+
ClearErrors
- ExecShell "" "$PLUGINSDIR\LameXP-Install.exe" '$R9' SW_SHOWNORMAL
+ ExecShell "" "${InstallerFileName}" '$R9' SW_SHOWNORMAL
IfErrors 0 RunSuccess
- Goto RunFailed
-
+ ; --------
+
+ SetDetailsPrint both
+ DetailPrint "Failed to launch installer :-("
+ SetDetailsPrint listonly
+
+ SetErrorLevel 1
+ SetOutPath "$TEMP"
+ Abort "Aborted."
+
; --------
RunSuccess:
- Delete /REBOOTOK "$PLUGINSDIR\LameXP-Install.exe"
- StdUtils::Unload
+ Delete /REBOOTOK "${InstallerFileName}"
+ SetErrorLevel 0
+ SetOutPath "$TEMP"
SectionEnd