Installer clean-up and fixes.

This commit is contained in:
LoRd_MuldeR 2016-10-10 20:36:06 +02:00
parent 01dea18270
commit 19a43d9c7b
5 changed files with 53 additions and 262 deletions

View File

@ -178,37 +178,7 @@ if %ERRORLEVEL% NEQ 0 (
pause && exit
)
REM "%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_UPX_PATH=%PATH_UPXBIN%" "/DLAMEXP_DATE=%ISO_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_INSTTYPE=%VER_LAMEXP_TYPE%" "/DLAMEXP_PATCH=%VER_LAMEXP_PATCH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_SOURCE_FILE=%OUT_FILE%.sfx" "%~dp0\..\NSIS\wrapper.nsi"
rem if %ERRORLEVEL% NEQ 0 (
REM "%~dp0\..\Utilities\CEcho.exe" red "\nFailed to build installer^!\n"
REM pause && exit
REM )
:: ---------------------------------------------------------------------------
:: CREATE WRAPPER
:: ---------------------------------------------------------------------------
set "WRAPPER_CONF=%TMP%\~%RANDOM%-%RANDOM%.cf"
set "WRAPPER_PACK=%TMP%\~%RANDOM%-%RANDOM%.7z"
echo ;^^!@Install@^^!UTF-8^^!> "%WRAPPER_CONF%"
echo Title="LameXP Setup">> "%WRAPPER_CONF%"
echo ExecuteFile="LameXP-Setup-r%VER_LAMEXP_BUILD%.exe">> "%WRAPPER_CONF%"
echo ;^^!@InstallEnd@^^!>> "%WRAPPER_CONF%"
"%~dp0\..\Utilities\7za.exe" a -t7z "%WRAPPER_PACK%" "%OUT_FILE%.sfx"
if %ERRORLEVEL% NEQ 0 (
"%~dp0\..\Utilities\CEcho.exe" red "\nFailed to build installer^!\n"
pause && exit
)
"%~dp0\..\Utilities\7za.exe" rn "%WRAPPER_PACK%" "%OUT_NAME%.sfx" "LameXP-Setup-r%VER_LAMEXP_BUILD%.exe"
if %ERRORLEVEL% NEQ 0 (
"%~dp0\..\Utilities\CEcho.exe" red "\nFailed to build installer^!\n"
pause && exit
)
copy /b "%~dp0\..\Utilities\7zSD.sfx" + "%WRAPPER_CONF%" + "%WRAPPER_PACK%" "%OUT_FILE%.exe"
call "%~dp0\..\Utilities\7zSD.cmd" "%OUT_FILE%.sfx" "%OUT_FILE%.exe" "LameXP Setup" "LameXP-Setup-r%VER_LAMEXP_BUILD%"
if %ERRORLEVEL% NEQ 0 (
"%~dp0\..\Utilities\CEcho.exe" red "\nFailed to build installer^!\n"
pause && exit
@ -218,9 +188,6 @@ if %ERRORLEVEL% NEQ 0 (
:: CLEAN UP
:: ---------------------------------------------------------------------------
del "%WRAPPER_CONF%"
del "%WRAPPER_PACK%"
attrib -R "%TMP_PATH%\*.txt"
attrib -R "%TMP_PATH%\*.html"
attrib -R "%TMP_PATH%\*.exe"

View File

@ -619,7 +619,7 @@ Section "-Create Shortcuts"
!insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ShellVerb.PinToTaskbar}
DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
${EndIf}
!insertmacro MUI_STARTMENU_WRITE_END
@ -672,7 +672,7 @@ Section "Uninstall"
${IfNot} "$StartMenuFolder" == ""
SetShellVarContext current
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
${EndIf}
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
@ -683,7 +683,7 @@ Section "Uninstall"
SetShellVarContext all
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
${EndIf}
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"

View File

@ -1,224 +0,0 @@
; ///////////////////////////////////////////////////////////////////////////////
; // LameXP - Audio Encoder Front-End
; // Copyright (C) 2004-2016 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
; // 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/"
;Installer file name
!define InstallerFileName "$PLUGINSDIR\LameXP-SETUP-r${LAMEXP_BUILD}.exe"
;--------------------------------
;Includes
;--------------------------------
!include `LogicLib.nsh`
!include `StdUtils.nsh`
;--------------------------------
;Installer Attributes
;--------------------------------
XPStyle on
RequestExecutionLevel user
InstallColors /windows
Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
OutFile "${LAMEXP_OUTPUT_FILE}"
BrandingText "${LAMEXP_DATE} / Build #${LAMEXP_BUILD}"
Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
ShowInstDetails nevershow
AutoCloseWindow true
InstallDir ""
;--------------------------------
;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"'
;--------------------------------
;Reserved Files
;--------------------------------
ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
ReserveFile "${NSISDIR}\Plugins\SelfDel.dll"
;--------------------------------
;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})"
VIAddVersionKey "LegalCopyright" "Copyright 2004-2016 LoRd_MuldeR"
VIAddVersionKey "LegalTrademarks" "GNU"
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}"
;--------------------------------
;Installer initialization
;--------------------------------
Section "-LaunchTheInstaller"
SetDetailsPrint textonly
DetailPrint "Launching installer, please stay tuned..."
SetDetailsPrint listonly
InitPluginsDir
SetOutPath "$PLUGINSDIR"
${StdUtils.TestParameter} $R0 "Update"
${If} "$R0" == "true"
SetFileAttributes "$EXEPATH" FILE_ATTRIBUTE_NORMAL
SelfDel::del /RMDIR
${EndIf}
SetOverwrite on
File "/oname=${InstallerFileName}" "${LAMEXP_SOURCE_FILE}"
; --------
${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}
; --------
${StdUtils.GetAllParameters} $R9 0
${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
${IfNot} "$R9" == ""
DetailPrint "Parameters: $R9"
${EndIf}
; --------
${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" "${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
SetOutPath "$TEMP"
Abort "Aborted."
; --------
RunSuccess:
Delete /REBOOTOK "${InstallerFileName}"
SetErrorLevel 0
SetOutPath "$TEMP"
SectionEnd

48
etc/Utilities/7zSD.cmd Normal file
View File

@ -0,0 +1,48 @@
@echo off
setlocal ENABLEDELAYEDEXPANSION
REM Print help screen
if "%~4"=="" (
echo 7-Zip SFX Builder
echo Usage: 7zSD.cmd ^<input^> ^<output^> ^<title^> ^<fname^>
exit /b 1
)
REM Generate temp file names
set "SEVENZIP_SFX_CFG=%TMP%\~7zSD%RANDOM%%RANDOM%.cf"
set "SEVENZIP_SFX_ARC=%TMP%\~7zSD%RANDOM%%RANDOM%.7z"
REM Create the configuration file
echo ;^^!@Install@^^!UTF-8^^!> "%SEVENZIP_SFX_CFG%"
echo Title="%~3">> "%SEVENZIP_SFX_CFG%"
echo ExecuteFile="%~n4.exe">> "%SEVENZIP_SFX_CFG%"
echo ;^^!@InstallEnd@^^!>> "%SEVENZIP_SFX_CFG%"
REM Create the 7-Zip archive
"%~dp0\7za.exe" a -t7z "%SEVENZIP_SFX_ARC%" "%~1"
if %ERRORLEVEL% NEQ 0 (
del "%SEVENZIP_SFX_CFG%"
del "%SEVENZIP_SFX_ARC%"
exit /b 1
)
REM Rename the embedded file
"%~dp0\7za.exe" rn "%SEVENZIP_SFX_ARC%" "%~nx1" "%~n4.exe"
if %ERRORLEVEL% NEQ 0 (
del "%SEVENZIP_SFX_CFG%"
del "%SEVENZIP_SFX_ARC%"
exit /b 1
)
REM Actually build the SFX file
copy /b "%~dp0\7zSD.sfx" + "%SEVENZIP_SFX_CFG%" + "%SEVENZIP_SFX_ARC%" "%~2"
if %ERRORLEVEL% NEQ 0 (
del "%SEVENZIP_SFX_CFG%"
del "%SEVENZIP_SFX_ARC%"
exit /b 1
)
REM Final clean-up
del "%SEVENZIP_SFX_CFG%"
del "%SEVENZIP_SFX_ARC%"
exit /b 0

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 1912
#define VER_LAMEXP_BUILD 1913
#define VER_LAMEXP_CONFG 1818
///////////////////////////////////////////////////////////////////////////////