New improved installer.
This commit is contained in:
parent
9cbb8b0d73
commit
b2338c49af
@ -109,7 +109,7 @@ REM ------------------------------------------
|
||||
REM :: CREATE PACKAGES ::
|
||||
REM ------------------------------------------
|
||||
"%PATH_SEVENZ%\7z.exe" a -tzip -r "%OUT_FILE%.zip" "%TMP_PATH%\*"
|
||||
"%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_SOURCE_PATH=%TMP_PATH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_DATE=%OUT_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_SUFFIX=%VER_LAMEXP_SUFFIX%" "..\NSIS\setup.nsi"
|
||||
"%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_SOURCE_PATH=%TMP_PATH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_UPX_PATH=%PATH_UPXBIN%" "/DLAMEXP_DATE=%OUT_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_SUFFIX=%VER_LAMEXP_SUFFIX%" "..\NSIS\setup.nsi"
|
||||
rd /S /Q "%TMP_PATH%"
|
||||
REM ------------------------------------------
|
||||
if not exist "%OUT_FILE%.zip" (
|
||||
|
@ -19,23 +19,79 @@
|
||||
; // 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_SUFFIX
|
||||
!error "LAMEXP_SUFFIX 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_PATH
|
||||
!error "LAMEXP_SOURCE_PATH is not defined !!!"
|
||||
!endif
|
||||
!ifndef LAMEXP_UPX_PATH
|
||||
!error "LAMEXP_UPX_PATH is not defined !!!"
|
||||
!endif
|
||||
|
||||
;UUID
|
||||
!define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Includes
|
||||
;--------------------------------
|
||||
|
||||
!include `MUI2.nsh`
|
||||
!include `UAC.nsh`
|
||||
!include `parameters.nsh`
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Installer Attributes
|
||||
;--------------------------------
|
||||
|
||||
RequestExecutionLevel user
|
||||
;TargetMinimalOS 5.0
|
||||
BrandingText `Date created: ${LAMEXP_DATE}`
|
||||
ShowInstDetails show
|
||||
ShowUninstDetails show
|
||||
Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_SUFFIX} [Build #${LAMEXP_BUILD}]"
|
||||
OutFile "${LAMEXP_OUTPUT_FILE}"
|
||||
BrandingText "Date created: ${LAMEXP_DATE}"
|
||||
InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
|
||||
InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
|
||||
|
||||
!define ZIP2EXE_NAME `LameXP v${LAMEXP_VERSION} ${LAMEXP_SUFFIX} [Build #${LAMEXP_BUILD}]`
|
||||
!define ZIP2EXE_OUTFILE `${LAMEXP_OUTPUT_FILE}`
|
||||
!define ZIP2EXE_COMPRESSOR_LZMA
|
||||
!define ZIP2EXE_COMPRESSOR_SOLID
|
||||
!define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\${ZIP2EXE_NAME}`
|
||||
|
||||
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
|
||||
!define MUI_CUSTOMFUNCTION_GUIINIT myUacInit
|
||||
;--------------------------------
|
||||
;Compressor
|
||||
;--------------------------------
|
||||
|
||||
SetCompressor /SOLID LZMA
|
||||
SetCompressorDictSize 64
|
||||
|
||||
!packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Variables
|
||||
;--------------------------------
|
||||
|
||||
Var StartMenuFolder
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Version Info
|
||||
;--------------------------------
|
||||
|
||||
!searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
|
||||
VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
|
||||
@ -52,12 +108,104 @@ VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
|
||||
VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
|
||||
VIAddVersionKey "Website" "http://mulder.at.gg/"
|
||||
|
||||
!include `UAC.nsh`
|
||||
!include `parameters.nsh`
|
||||
!include `${NSISDIR}\Contrib\zip2exe\Base.nsh`
|
||||
!include `${NSISDIR}\Contrib\zip2exe\Modern.nsh`
|
||||
|
||||
Function myUacInit
|
||||
;--------------------------------
|
||||
;MUI2 Interface Settings
|
||||
;--------------------------------
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_WELCOMEPAGE_TITLE_3LINES
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_FINISHPAGE_TITLE_3LINES
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
|
||||
!define MUI_FINISHPAGE_SHOWREADME
|
||||
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
|
||||
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
|
||||
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
|
||||
!define MUI_LANGDLL_ALLLANGUAGES
|
||||
!define MUI_CUSTOMFUNCTION_GUIINIT MyUacInit
|
||||
!define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyUacInit
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;MUI2 Pages
|
||||
;--------------------------------
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
;--------------------------------
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "SpanishInternational"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "Afrikaans"
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Installer initialization
|
||||
;--------------------------------
|
||||
|
||||
Function .onInit
|
||||
${If} ${UAC_IsInnerInstance}
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
${If} ${UAC_IsInnerInstance}
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;UAC initialization
|
||||
;--------------------------------
|
||||
|
||||
Function MyUacInit
|
||||
UAC_TryAgain:
|
||||
!insertmacro UAC_RunElevated
|
||||
${Switch} $0
|
||||
@ -79,28 +227,143 @@ Function myUacInit
|
||||
${EndSwitch}
|
||||
FunctionEnd
|
||||
|
||||
!insertmacro SECTION_BEGIN
|
||||
Function un.MyUacInit
|
||||
UAC_TryAgain:
|
||||
!insertmacro UAC_RunElevated
|
||||
${Switch} $0
|
||||
${Case} 0
|
||||
${IfThen} $1 = 1 ${|} Quit ${|}
|
||||
${IfThen} $3 <> 0 ${|} ${Break} ${|}
|
||||
${If} $1 = 3
|
||||
MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This un-installer requires admin access, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
|
||||
${EndIf}
|
||||
${Case} 1223
|
||||
MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This un-installer requires admin privileges, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
|
||||
Quit
|
||||
${Case} 1062
|
||||
MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Logon service not running, aborting!"
|
||||
Quit
|
||||
${Default}
|
||||
MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Unable to elevate installer! (Error code: $0)"
|
||||
Quit
|
||||
${EndSwitch}
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Macros
|
||||
;--------------------------------
|
||||
|
||||
!macro PrintProgress Text
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint '${Text}'
|
||||
SetDetailsPrint listonly
|
||||
Sleep 1000
|
||||
!macroend
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Install Files
|
||||
;--------------------------------
|
||||
|
||||
Section "!Install Files"
|
||||
!insertmacro PrintProgress "Installing program files, please wait..."
|
||||
SetOutPath "$INSTDIR"
|
||||
File /r `${LAMEXP_SOURCE_PATH}\*.*`
|
||||
!insertmacro SECTION_END
|
||||
SectionEnd
|
||||
|
||||
Section "-Write Uinstaller"
|
||||
!insertmacro PrintProgress "Creating the uninstaller, please wait..."
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "-Create Shortcuts"
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
!insertmacro PrintProgress "Creating shortcuts, please wait..."
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\LameXP.exe" "" "$INSTDIR\LameXP.exe" 0
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\License.lnk" "$INSTDIR\License.txt"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
SectionEnd
|
||||
|
||||
Section "-Update Registry"
|
||||
!insertmacro PrintProgress "Updating the registry, please wait..."
|
||||
WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP"
|
||||
SectionEnd
|
||||
|
||||
Section
|
||||
!insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
|
||||
SectionEnd
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller
|
||||
;--------------------------------
|
||||
|
||||
Section "Uninstall"
|
||||
!insertmacro PrintProgress "Uninstalling program, please wait..."
|
||||
|
||||
Delete /REBOOTOK "$INSTDIR\*.exe"
|
||||
Delete /REBOOTOK "$INSTDIR\*.txt"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
IfFileExists "$SMPROGRAMS\$StartMenuFolder\*.*" 0 NoStartmenuFolder
|
||||
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
|
||||
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
|
||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||
|
||||
NoStartmenuFolder:
|
||||
|
||||
DeleteRegValue HKLM "${MyRegPath}" "InstallLocation"
|
||||
DeleteRegValue HKLM "${MyRegPath}" "UninstallString"
|
||||
DeleteRegValue HKLM "${MyRegPath}" "DisplayName"
|
||||
DeleteRegValue HKLM "${MyRegPath}" "StartmenuFolder"
|
||||
|
||||
!insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
|
||||
SectionEnd
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Check For Update Mode
|
||||
;--------------------------------
|
||||
|
||||
Function CheckForUpdate
|
||||
!insertmacro GetCommandlineParameter "Update" "error" $R0
|
||||
StrCmp $R0 "error" 0 +2
|
||||
StrCmp $R0 "error" 0 EnableUpdateMode
|
||||
IfFileExists "$INSTDIR\LameXP.exe" EnableUpdateMode
|
||||
Return
|
||||
|
||||
EnableUpdateMode:
|
||||
|
||||
FindWindow $R0 "#32770" "" $HWNDPARENT
|
||||
GetDlgItem $R1 $R0 1019
|
||||
SendMessage $R1 ${EM_SETREADONLY} 1 0
|
||||
EnableWindow $R1 0
|
||||
|
||||
FindWindow $R0 "#32770" "" $HWNDPARENT
|
||||
GetDlgItem $R1 $R0 1001
|
||||
EnableWindow $R1 0
|
||||
|
||||
GetDlgItem $R1 $HWNDPARENT 1
|
||||
SendMessage $R1 ${WM_SETTEXT} 0 "STR:Update"
|
||||
FunctionEnd
|
||||
|
||||
Function .onInstSuccess
|
||||
;GetDlgItem $R1 $HWNDPARENT 1
|
||||
;SendMessage $R1 ${WM_SETTEXT} 0 "STR:Update"
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Install Success
|
||||
;--------------------------------
|
||||
|
||||
Function RunAppFunction
|
||||
!insertmacro UAC_AsUser_ExecShell "explore" "$INSTDIR" "" "" SW_SHOWNORMAL
|
||||
!insertmacro UAC_AsUser_ExecShell "open" "$INSTDIR\LameXP.exe" "" "$INSTDIR" SW_SHOWNORMAL
|
||||
FunctionEnd
|
||||
|
||||
Function ShowReadmeFunction
|
||||
!insertmacro UAC_AsUser_ExecShell "open" "$INSTDIR\License.txt" "" "" SW_SHOWNORMAL
|
||||
FunctionEnd
|
Loading…
x
Reference in New Issue
Block a user