From a10253a91385bcd9292575af2083ce3da91119de Mon Sep 17 00:00:00 2001 From: rainwater Date: Wed, 28 Aug 2002 19:45:45 +0000 Subject: [PATCH] new makensis installer git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@786 212acab6-be3b-0410-9dea-997c60f758d6 --- Examples/makensis.nsi | 184 ++++++++++++++++++++++++++++++++---------- 1 file changed, 140 insertions(+), 44 deletions(-) diff --git a/Examples/makensis.nsi b/Examples/makensis.nsi index aaea29e8..fdeb1872 100644 --- a/Examples/makensis.nsi +++ b/Examples/makensis.nsi @@ -1,40 +1,34 @@ !define VER_MAJOR 2 !define VER_MINOR 0a7 +!define NAME "NSIS" -!ifdef NO_COMPRESSION -SetCompress off -SetDatablockOptimize off -!endif +!verbose 3 +!include "${NSISDIR}\Examples\WinMessages.nsh" +!verbose 4 -!ifdef NO_CRC -CRCCheck off -!endif +!define CURRENTPAGE $9 +!define TEMP1 $R0 +!define TEMP2 $R1 Name "NSIS" Caption "Nullsoft Install System - Setup" OutFile ..\nsis${VER_MAJOR}${VER_MINOR}.exe - SetCompressor bzip2 -!ifdef uglyinstaller -BGGradient 000000 308030 FFFFFF -InstallColors FF8080 000000 -InstProgressFlags smooth colored -!else +InstallColors /windows +InstProgressFlags smooth XPStyle on -WindowIcon off -!endif +ChangeUI all "${NSISDIR}\Contrib\UIs\modernsimple.exe" +SetFont Tahoma 8 +CheckBitmap "${NSISDIR}\Contrib\Icons\modern.bmp" -!ifdef NSIS_CONFIG_LICENSEPAGE -LicenseText "You must read the following license before installing:" +LicenseText "Scroll down to see the rest of the agreement." LicenseData ..\license.txt -!endif -!ifdef NSIS_CONFIG_COMPONENTPAGE + ComponentText "This will install the Nullsoft Install System v${VER_MAJOR}.${VER_MINOR} on your computer:" -InstType "Full (w/ Source and Contrib)" -InstType "Normal (w/ Contrib, w/o Source)" -InstType "Lite (w/o Source or Contrib)" -!endif +InstType "Full" +InstType "Normal" +InstType "Lite" AutoCloseWindow false ShowInstDetails show @@ -42,9 +36,6 @@ ShowUninstDetails show DirText "Please select a location to install NSIS (or use the default):" SetOverwrite on SetDateSave on -!ifdef HAVE_UPX - !packhdr tmp.dat "upx\upx --best --compress-icons=1 tmp.dat" -!endif InstallDir $PROGRAMFILES\NSIS InstallDirRegKey HKLM SOFTWARE\NSIS "" @@ -128,10 +119,7 @@ Section "Start Menu + Desktop Icons" CreateShortCut "$DESKTOP\MakeNSIS.lnk" "$INSTDIR\Makensisw.exe" '"$INSTDIR\makensis.exe" /CD' SectionEnd -!ifndef NO_CONTRIB - SubSection "Contrib" - Section "Extra Icons" SectionIn 1 2 SetOutPath $INSTDIR\Contrib\Icons @@ -252,16 +240,10 @@ Section "NSIS-DL" CreateShortCut "$SMPROGRAMS\NSIS\Contrib\NSIS-DL project workspace.lnk" "$INSTDIR\contrib\NSISDL\nsisdl.dsw" NoShortCuts: SectionEnd - SubSectionEnd -!endif - - -!ifndef NO_SOURCE SubSection "Source code" - Section "NSIS Source Code" SectionIn 1 DetailPrint "Extracting source code...." @@ -298,7 +280,6 @@ Section "NSIS Source Code" SectionEnd SubSection "Contrib" - Section "ExDLL Source" SectionIn 1 SetOutPath $INSTDIR\Contrib\ExDLL @@ -331,13 +312,9 @@ Section "MakeNSISW Source" CreateShortCut "$SMPROGRAMS\NSIS\Contrib\MakeNSISW readme.lnk" "$INSTDIR\contrib\MakeNsisw\readme.txt" NoShortCuts: SectionEnd - SubSectionEnd - SubSectionEnd -!endif - Section -post WriteRegStr HKLM SOFTWARE\NSIS "" $INSTDIR WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "DisplayName" "NSIS Development Kit (remove only)" @@ -348,10 +325,10 @@ Section -post Sleep 500 BringToFront nofunshit: - ; since the installer is now created last (in 1.2+), this makes sure - ; that any old installer that is readonly is overwritten. Delete $INSTDIR\uninst-nsis.exe WriteUninstaller $INSTDIR\uninst-nsis.exe + IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1 + Call SetHeader SectionEnd Function .onInstSuccess @@ -360,7 +337,84 @@ Function .onInstSuccess NoReadme: FunctionEnd -!ifndef NO_UNINST +Function .onInitDialog + Push ${TEMP1} + FindWindow ${TEMP1} "#32770" "" $HWNDPARENT + StrCmp ${CURRENTPAGE} 1 "" +4 + GetDlgItem ${TEMP1} ${TEMP1} 1040 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "If you accept all the terms of the agreement, choose I Agree to continue. If you choose Cancel, Setup will close. You must accept the agreement to install ${NAME}." + Goto done + StrCmp ${CURRENTPAGE} 2 "" +4 + GetDlgItem ${TEMP1} ${TEMP1} 1042 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Description" + Goto done + StrCmp ${CURRENTPAGE} 3 "" +3 + GetDlgItem ${TEMP1} ${TEMP1} 1041 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Destination Folder" + done: + Pop ${TEMP1} +FunctionEnd + +Function .onNextPage + Push ${TEMP1} + Push ${TEMP2} + StrCmp ${CURRENTPAGE} "" "" no_set_outer + GetDlgItem ${TEMP1} $HWNDPARENT 1037 + CreateFont ${TEMP2} "Tahoma" 16 1000 + SendMessage ${TEMP1} ${WM_SETFONT} ${TEMP2} 0 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + GetDlgItem ${TEMP1} $HWNDPARENT 1038 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + GetDlgItem ${TEMP1} $HWNDPARENT 1034 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + GetDlgItem ${TEMP1} $HWNDPARENT 1039 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + no_set_outer: + IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1 + Call SetHeader + Pop ${TEMP2} + Pop ${TEMP1} +FunctionEnd + +Function .onPrevPage + IntOp ${CURRENTPAGE} ${CURRENTPAGE} - 1 + Call SetHeader +FunctionEnd + +Function SetHeader + Push ${TEMP1} + Push ${TEMP2} + GetDlgItem ${TEMP1} $HWNDPARENT 1037 + GetDlgItem ${TEMP2} $HWNDPARENT 1038 + StrCmp ${CURRENTPAGE} 1 "" +4 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "License Agreement" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Please review the license terms before installing ${NAME}." + Goto done + StrCmp ${CURRENTPAGE} 2 "" +4 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Choose Components" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Choose the components you want to install." + Goto done + StrCmp ${CURRENTPAGE} 3 "" +4 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Choose Install Location" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Choose the folder in which to install ${NAME} in." + Goto done + StrCmp ${CURRENTPAGE} 4 "" +4 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Installing" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Please wait while ${NAME} is being installed." + Goto done + StrCmp ${CURRENTPAGE} 5 "" +3 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Finished" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Setup was completed successfully." + done: + Pop ${TEMP1} + Pop ${TEMP2} +FunctionEnd + +Function .onUserAbort + MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to quit the NSIS Setup?" IDYES quit + Abort + quit: +FunctionEnd UninstallText "This will uninstall NSIS from your system:" @@ -448,6 +502,48 @@ Section Uninstall IfFileExists $INSTDIR 0 Removed MessageBox MB_OK|MB_ICONEXCLAMATION "Note: $INSTDIR could not be removed." Removed: + IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1 + Call un.SetHeader SectionEnd -!endif +Function un.onNextPage + Push ${TEMP1} + Push ${TEMP2} + StrCmp ${CURRENTPAGE} "" "" no_set_outer + GetDlgItem ${TEMP1} $HWNDPARENT 1037 + CreateFont ${TEMP2} "Tahoma" 16 1000 + SendMessage ${TEMP1} ${WM_SETFONT} ${TEMP2} 0 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + GetDlgItem ${TEMP1} $HWNDPARENT 1038 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + GetDlgItem ${TEMP1} $HWNDPARENT 1034 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + GetDlgItem ${TEMP1} $HWNDPARENT 1039 + SetStaticBkColor ${TEMP1} 0x00FFFFFF + no_set_outer: + IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1 + Call un.SetHeader + Pop ${TEMP2} + Pop ${TEMP1} +FunctionEnd + +Function un.SetHeader + Push ${TEMP1} + Push ${TEMP2} + GetDlgItem ${TEMP1} $HWNDPARENT 1037 + GetDlgItem ${TEMP2} $HWNDPARENT 1038 + StrCmp ${CURRENTPAGE} 1 "" +4 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Uninstall ${NAME}" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Remove ${NAME} from your system." + Goto done + StrCmp ${CURRENTPAGE} 2 "" +4 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Uninstalling" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "Please wait while ${NAME} is being uninstalled." + Goto done + StrCmp ${CURRENTPAGE} 3 "" +3 + SendMessage ${TEMP1} ${WM_SETTEXT} 0 "Finished" + SendMessage ${TEMP2} ${WM_SETTEXT} 0 "${NAME} has been removed from your system." + done: + Pop ${TEMP2} + Pop ${TEMP1} +FunctionEnd