Contrib/ExperienceUI/XPUI-Setup.nsi
changeset 0 d5ce4c64ef88
equal deleted inserted replaced
-1:000000000000 0:d5ce4c64ef88
       
     1 ; ExperienceUI for NSIS 1.11
       
     2 ; Setup Script
       
     3 ; Copyright © 2004-2006 Dan Fuhry aka dandaman32
       
     4 
       
     5 ; This program is free software; you redistribute and/or modify it
       
     6 ; under the terms of the zlib/libpng license.
       
     7 ; This program is distributed in the hope that it will be useful,
       
     8 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
       
     9 ; merchantability or fitness for a particular purpose.  See the
       
    10 ; zlib/libpng license for details.
       
    11 
       
    12 ; You should have received a copy of the zlib/libpng license with
       
    13 ; this program; if not, visit http://xpui.sf.net/docs/?start=legal.htm.
       
    14 
       
    15 ; This script requires the following add-ons and libraries in order to compile:
       
    16 ; * ExperienceUI for NSIS SDK v1.11 or later - http://xpui.sourceforge.net/
       
    17 ; * Component Manager 0.2 or later - http://xpui.sourceforge.net/page/compmgr/
       
    18 
       
    19 ;-------------------------------------
       
    20 ; First Things First
       
    21 
       
    22 SetCompressor /FINAL /SOLID lzma
       
    23 
       
    24 ;-------------------------------------
       
    25 ; Declarations
       
    26 
       
    27 Name "ExperienceUI for NSIS"
       
    28 Caption "ExperienceUI SDK Setup"
       
    29 OutFile "..\..\ExperienceUI-1.11.exe"
       
    30 CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\Modern.bmp"
       
    31 !define /date XPUI_BUILD_ID "%H%M-%y%m%d"
       
    32 !define /date XPUI_BUILD_ID_DECIMAL "%y%m%d.%H%M"
       
    33 !define XPUI_SYSDIR "."
       
    34 
       
    35 InstType "Full Install"
       
    36 InstType "Standard Install"
       
    37 InstType "Minimal Install"
       
    38 
       
    39 ;-------------------------------------
       
    40 ; ExperienceUI Settings
       
    41 
       
    42 !define XPUI_DIRECTORYPAGE_TEXT "Setup will install $(^Name) in the following folder. To install in this folder, leave the text below as-is. To install in a different folder, enter one below, or click Browse. $_CLICK$\n$\nNOTE: You need to have write access to the directory 2 levels up from the install directory,$\ni. e. if you install in C:\Program Files\NSIS\Contrib\ExperienceUI, you need to have write access to C:\Program Files\NSIS."
       
    43 !define XPUI_ABORTWARNING
       
    44 !define XPUI_UNABORTWARNING
       
    45 !define XPUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\XPUI-Install.ico"
       
    46 !define XPUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\XPUI-UnInstall.ico"
       
    47 !define XPUI_BRANDINGTEXT "ExperienceUI for NSIS ${XPUI_VERSION}"
       
    48 !define XPUI_SKIN "Windows XP"
       
    49 !define XPUI_LICENSEPAGE_CHECKBOX
       
    50 !define XPUI_DISABLEBG
       
    51 !define XPUI_FINISHPAGE_DOCS
       
    52 !define XPUI_FINISHPAGE_DOCS_FILE "$INSTDIR\..\..\Docs\ExperienceUI\open_popup.hta"
       
    53 !define XPUI_VERBOSE 4
       
    54 
       
    55 !define CM_STARTMENU_REG_ROOT HKLM
       
    56 !define CM_STARTMENU_REG_KEY  "Software\NSIS\ExperienceUI"
       
    57 !define CM_STARTMENU_REG_VALUE "StartMenuFolder"
       
    58 
       
    59 !include XPUI.nsh
       
    60 !include CM.nsh
       
    61 
       
    62 ;-------------------------------------
       
    63 ; Compile-time Options
       
    64 
       
    65 ; Define to include the "A Better Installer" splash screen (adds a whopping 100KB)
       
    66   !define XPUI_SETUP_SPLASH
       
    67 
       
    68 ;-------------------------------------
       
    69 ; Variables
       
    70 
       
    71 Var SMFOLDER
       
    72 Var INSTALL_EX
       
    73 Var INSTALL_DOCS
       
    74 Var INSTALL_UTILS
       
    75 
       
    76 !insertmacro XPUI_PAGE_STARTMENU_INIT App $SMFOLDER
       
    77 
       
    78 ;-------------------------------------
       
    79 ; Version Info
       
    80 
       
    81 VIProductVersion "1.11.${XPUI_BUILD_ID_DECIMAL}"
       
    82 VIAddVersionKey /LANG=1033 "FileVersion" "1.11.${XPUI_BUILD_ID}"
       
    83 VIAddVersionKey /LANG=1033 "ProductVersion" "1.11.${XPUI_BUILD_ID}"
       
    84 VIAddVersionKey /LANG=1033 "ProductName" "ExperienceUI for NSIS"
       
    85 VIAddVersionKey /LANG=1033 "Comments" "This installer was written by Dan Fuhry using Nullsoft Scriptable Install System (http://nsis.sourceforge.net)"
       
    86 VIAddVersionKey /LANG=1033 "CompanyName" "Dan Fuhry"
       
    87 VIAddVersionKey /LANG=1033 "LegalTrademarks" "ExperienceUI SDK by Dan Fuhry. Copyright © 2004-2005 Dashboard Software Ltd."
       
    88 VIAddVersionKey /LANG=1033 "LegalCopyright" "Copyright © 2004-2005 Dan Fuhry"
       
    89 VIAddVersionKey /LANG=1033 "FileDescription" "ExperienceUI SDK Setup/Maintenance Program"
       
    90 VIAddVersionKey /LANG=1033 "SpecialBuild" "ExperienceUI for NSIS Software Development Kit Setup, built on ${__TIMESTAMP__} (${XPUI_BUILD_ID})"
       
    91 
       
    92 ;-------------------------------------
       
    93 ; Initialization
       
    94 
       
    95 Function .onInit
       
    96   !ifdef XPUI_SETUP_SPLASH
       
    97   InitPluginsDir
       
    98   SetOutPath $PLUGINSDIR
       
    99   File LargeLogo.gif
       
   100   newadvsplash::show /NOUNLOAD 2000 2000 2000 -1 "$PLUGINSDIR\LargeLogo.gif"
       
   101   Delete $PLUGINSDIR\LargeLogo.gif
       
   102   !endif
       
   103   ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "UninstallString"
       
   104   StrCpy $0 $0 "" 1
       
   105   StrCpy $0 $0 -17
       
   106   IfFileExists $0\MakeNSIS.exe FoundNSIS
       
   107     MessageBox MB_YESNO|MB_ICONEXCLAMATION "Setup was unable to find NSIS on your system.  The ExperienceUI SDK requires NSIS in order to function.$\n$\nDo you want to go to the NSIS website now?" IDNO +2
       
   108       ExecShell open "http://nsis.sourceforge.net/"
       
   109     Abort
       
   110   FoundNSIS:
       
   111   StrCpy $INSTDIR "$0\Contrib\ExperienceUI"
       
   112 FunctionEnd
       
   113 
       
   114 ;-------------------------------------
       
   115 ; Sections
       
   116 
       
   117 !verbose 0
       
   118 !include ExperienceUIFileList.nsh
       
   119 Section
       
   120   ReadRegStr $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "RegisteredOwner"
       
   121   StrCmp $0 "Daniel C. Fuhry" +2
       
   122   MessageBox MB_OK|MB_ICONINFORMATION "Please take some time to read the ExperienceUI documentation because the ExperienceUI is different from other UIs and as a result requires a slightly different script layout."
       
   123 SectionEnd
       
   124 !verbose 4
       
   125 
       
   126 SubSection "Downloadable extras"
       
   127   Section "Page background images - 187KB"
       
   128     DetailPrint "Downloading file: http://xpui.sf.net/bin/1.11/bgimages.eup (187KB, <1min)"
       
   129     download:
       
   130     nsisdl::download_quiet "http://xpui.sourceforge.net/bin/1.11/bgimages.eup" "$PLUGINSDIR\bg.eup"
       
   131     Pop $0
       
   132     StrCmp $0 success dlgood
       
   133       MessageBox MB_OK|MB_ICONEXCLAMATION "Error downloading patch file: $0"
       
   134       Return
       
   135     dlgood:
       
   136     DCryptDll::MD5Hash "FS" "$PLUGINSDIR\bg.eup" "--End--"
       
   137     Pop $0
       
   138       StrCmp $0 OK ok1
       
   139       MessageBox MB_OK|MB_ICONSTOP "Error verifying MD5 hash of download:$\n$0"
       
   140       Goto done
       
   141     ok1:
       
   142     Pop $0
       
   143     StrCmp $0 "83972708FD0EBC9373BDEF81EE006881" Patch ; Not the signature hash, just the regular MD5
       
   144       Pop $9
       
   145       Pop $9
       
   146       Pop $9
       
   147       Pop $9
       
   148       Pop $9
       
   149       Pop $9
       
   150       Pop $9
       
   151       Pop $9
       
   152       Pop $9 ; GET RID OF THE STACK!!!!
       
   153       StrCpy $0 ""
       
   154       StrCpy $1 ""
       
   155       StrCpy $2 ""
       
   156       StrCpy $3 ""
       
   157       StrCpy $4 ""
       
   158       messagebox::show MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON1 "Bad Download" "0,103" "The ExperienceUI installer has detected that the MD5 hash of the official download and the hash of the downloaded file are different.$\n$\nThe most likely reason for this is a corrupt download.  If you want to try to download the file again, click Try Again.$\n$\nIt is also possible, though very unlikely, that someone has broken into the ExperienceUI web server and changed the patch file to something potentially malicious.  If you think that is the case, please press Skip.$\n$\nTo try to install the patch file anyway, click Ignore.$\n" "IDTRYAGAIN" "Skip" IDIGNORE
       
   159       Pop $1
       
   160       StrCmp $1 1 download
       
   161       StrCmp $1 2 done
       
   162     Patch:
       
   163       DetailPrint "Installing background image files..."
       
   164       ExecWait '"$INSTDIR\Utils\PatchInstaller.exe" $PLUGINSDIR\bg.eup /Silent'
       
   165     Done:
       
   166   SectionEnd
       
   167 SubSectionEnd
       
   168 
       
   169 !macro CM_UNINST
       
   170   Delete $INSTDIR\Utils\Updater.exe
       
   171   Delete $INSTDIR\Utils\PatchInstaller.exe
       
   172   SetOutPath "C:\" ; Reset the output dir and close any handles still open
       
   173   ${CMInclude} Dirlist # doing this three
       
   174   ${CMInclude} Dirlist # times to make sure
       
   175   ${CMInclude} Dirlist # everything's gone
       
   176   RMDir $INSTDIR # Will delete $INSTDIR if it's empty
       
   177 !macroend
       
   178 
       
   179 ;-------------------------------------
       
   180 ; Pages
       
   181 
       
   182 !verbose 0
       
   183 !insertmacro CM_LANGUAGE English
       
   184 !insertmacro CM_PAGES
       
   185 
       
   186 !define XPUI_WELCOMEPAGE2_TEXT_TOP "Welcome to ExperienceUI 1.11."
       
   187 !define XPUI_WELCOMEPAGE2_TEXT     "Welcome to the ExperienceUI, the user interface that makes NSIS the installer your programs truly deserve.\r\n\r\nClick Next to start.\r\n\r\nThis release is version 1.11 and it was built on ${__TIMESTAMP__}."
       
   188 
       
   189 ${Page} Welcome2
       
   190 ${LicensePage} License.rtf
       
   191 ${Page} Components
       
   192 ${Page} Directory
       
   193 !insertmacro XPUI_PAGE_STARTMENU_SHOW App
       
   194 ${Page} InstConfirm
       
   195 ${Page} InstFiles
       
   196 ${Page} Finish
       
   197 ${Page} Abort
       
   198 
       
   199 ${UnPage} Welcome2
       
   200 ${UnPage} UnConfirm
       
   201 ${UnPage} InstConfirm
       
   202 ${UnPage} InstFiles
       
   203 ${UnPage} Finish
       
   204 ${UnPage} Abort
       
   205 
       
   206 !insertmacro XPUI_LANGUAGE "English"
       
   207 !insertmacro CM_FILES
       
   208 !verbose 4