Merge pull request #12949 from birarda/feat/installer-marketing-images

add default or campaigned marketing slideshow during install
This commit is contained in:
Stephen Birarda 2018-04-23 13:52:53 -07:00 committed by GitHub
commit 0de1a49c78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 0 deletions

View file

@ -19,6 +19,7 @@ To produce an executable installer on Windows, the following are required:
- [nsProcess Plug-in for Nullsoft](http://nsis.sourceforge.net/NsProcess_plugin) - 1.6 - [nsProcess Plug-in for Nullsoft](http://nsis.sourceforge.net/NsProcess_plugin) - 1.6
- [Inetc Plug-in for Nullsoft](http://nsis.sourceforge.net/Inetc_plug-in) - 1.0 - [Inetc Plug-in for Nullsoft](http://nsis.sourceforge.net/Inetc_plug-in) - 1.0
- [NSISpcre Plug-in for Nullsoft](http://nsis.sourceforge.net/NSISpcre_plug-in) - 1.0 - [NSISpcre Plug-in for Nullsoft](http://nsis.sourceforge.net/NSISpcre_plug-in) - 1.0
- [nsisSlideshow Plug-in for Nullsoft](http://nsis.sourceforge.net/NsisSlideshow_plug-in) - 1.7
Run the `package` target to create an executable installer using the Nullsoft Scriptable Install System. Run the `package` target to create an executable installer using the Nullsoft Scriptable Install System.

View file

@ -87,6 +87,10 @@
;-------------------------------- ;--------------------------------
;-------------------------------- ;--------------------------------
;General ;General
; hide install details since we show an image slideshow in their place
ShowInstDetails nevershow
; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges ; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges
!include UAC.nsh !include UAC.nsh
@ -446,6 +450,7 @@ SectionEnd
Page custom PostInstallOptionsPage ReadPostInstallOptions Page custom PostInstallOptionsPage ReadPostInstallOptions
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageInstallFilesPre !define MUI_PAGE_CUSTOMFUNCTION_PRE PageInstallFilesPre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW StartInstallSlideshow
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_CONFIRM
@ -544,11 +549,33 @@ Var Express
${EndIf} ${EndIf}
!macroend !macroend
!macro DownloadSlideshowImages
InitPluginsDir
Push $0
; figure out where to download installer slideshow images from
StrCpy $0 "http://cdn.highfidelity.com/installer/slideshow"
${If} $CampaignName == ""
StrCpy $0 "$0/default"
${Else}
StrCpy $0 "$0/$CampaignName"
${EndIf}
NSISdl::download_quiet $0/1.jpg "$PLUGINSDIR\1.jpg"
NSISdl::download_quiet $0/2.jpg "$PLUGINSDIR\2.jpg"
NSISdl::download_quiet $0/3.jpg "$PLUGINSDIR\3.jpg"
Pop $0
!macroend
Function OnUserAbort Function OnUserAbort
!insertmacro GoogleAnalytics "Installer" "Abort" "User Abort" "" !insertmacro GoogleAnalytics "Installer" "Abort" "User Abort" ""
FunctionEnd FunctionEnd
Function PageWelcomePre Function PageWelcomePre
!insertmacro GoogleAnalytics "Installer" "Welcome" "" "" !insertmacro GoogleAnalytics "Installer" "Welcome" "" ""
!insertmacro DownloadSlideshowImages
FunctionEnd FunctionEnd
Function PageLicensePre Function PageLicensePre
!insertmacro GoogleAnalytics "Installer" "License" "" "" !insertmacro GoogleAnalytics "Installer" "License" "" ""
@ -640,6 +667,56 @@ Function ChangeCustomLabel
Pop $R1 Pop $R1
FunctionEnd FunctionEnd
!macro AddImageToSlideshowFile ImageFilename
${If} ${FileExists} "$PLUGINSDIR\${ImageFilename}.jpg"
FileWrite $0 "= ${ImageFilename}.jpg,500,5000,$\"$\"$\r$\n"
StrCpy $1 "1"
${EndIf}
!macroend
Function StartInstallSlideshow
; create a slideshow file based on what files we have available
; stash $0 and $1
Push $0
Push $1
; start $1 as 0, indicating we have no images present
StrCpy $1 "0"
FileOpen $0 "$PLUGINSDIR\slideshow.dat" w
; write the language value to the slideshow file for english
FileWrite $0 "[1033]$\r$\n"
; for each of 1.jpg, 2.jpg, 3.jpg
; if the image is present add it to the dat file and set our flag
; to show we found at least one image
!insertmacro AddImageToSlideshowFile "1"
!insertmacro AddImageToSlideshowFile "2"
!insertmacro AddImageToSlideshowFile "3"
FileClose $0
; NOTE: something inside of nsisSlideshow::show isn't keeping the stack clean
; so we need to push things back BEFORE we call it
${If} $1 == "1"
Pop $1
Pop $0
; show the slideshow using the created data file
nsisSlideshow::show /NOUNLOAD "/auto=$PLUGINSDIR\slideshow.dat"
${Else}
Pop $1
Pop $0
; show the install details because we didn't end up with slideshow images to show
SetDetailsView show
${EndIf}
FunctionEnd
Function PostInstallOptionsPage Function PostInstallOptionsPage
!insertmacro MaybeSkipPage !insertmacro MaybeSkipPage
!insertmacro GoogleAnalytics "Installer" "Post Install Options" "" "" !insertmacro GoogleAnalytics "Installer" "Post Install Options" "" ""
@ -932,6 +1009,7 @@ FunctionEnd
;Installer Sections ;Installer Sections
Section "-Core installation" Section "-Core installation"
;The following delete blocks are temporary and can be removed once users who had the initial installer have updated ;The following delete blocks are temporary and can be removed once users who had the initial installer have updated
;Delete any server-console files installed before it was placed in sub-folder ;Delete any server-console files installed before it was placed in sub-folder
@ -983,11 +1061,13 @@ Section "-Core installation"
WriteRegStr HKLM "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR WriteRegStr HKLM "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
;Write some information about this install to the installation folder ;Write some information about this install to the installation folder
Push $0
FileOpen $0 "$INSTDIR\installer.ini" w FileOpen $0 "$INSTDIR\installer.ini" w
FileWrite $0 "type=@INSTALLER_TYPE@$\r$\n" FileWrite $0 "type=@INSTALLER_TYPE@$\r$\n"
FileWrite $0 "campaign=$CampaignName$\r$\n" FileWrite $0 "campaign=$CampaignName$\r$\n"
FileWrite $0 "exepath=$EXEPATH$\r$\n" FileWrite $0 "exepath=$EXEPATH$\r$\n"
FileClose $0 FileClose $0
Pop $0
;Package the signed uninstaller produced by the inner loop ;Package the signed uninstaller produced by the inner loop
!ifndef INNER !ifndef INNER