From 7ecc279e00061eb7e2bd8b031c3e48fe2c8fa127 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Apr 2018 16:43:11 -0700 Subject: [PATCH 1/3] show default or campaigned slideshow during install --- cmake/templates/NSIS.template.in | 84 ++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 28ac320e42..6ede94b900 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -87,6 +87,10 @@ ;-------------------------------- ;-------------------------------- ;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 !include UAC.nsh @@ -446,6 +450,7 @@ SectionEnd Page custom PostInstallOptionsPage ReadPostInstallOptions !define MUI_PAGE_CUSTOMFUNCTION_PRE PageInstallFilesPre + !define MUI_PAGE_CUSTOMFUNCTION_SHOW StartInstallSlideshow !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM @@ -544,11 +549,33 @@ Var Express ${EndIf} !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 !insertmacro GoogleAnalytics "Installer" "Abort" "User Abort" "" FunctionEnd Function PageWelcomePre !insertmacro GoogleAnalytics "Installer" "Welcome" "" "" + !insertmacro DownloadSlideshowImages FunctionEnd Function PageLicensePre !insertmacro GoogleAnalytics "Installer" "License" "" "" @@ -640,6 +667,56 @@ Function ChangeCustomLabel Pop $R1 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 !insertmacro MaybeSkipPage !insertmacro GoogleAnalytics "Installer" "Post Install Options" "" "" @@ -932,6 +1009,7 @@ FunctionEnd ;Installer Sections Section "-Core installation" + ;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 @@ -983,11 +1061,13 @@ Section "-Core installation" WriteRegStr HKLM "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR ;Write some information about this install to the installation folder + Push $0 FileOpen $0 "$INSTDIR\installer.ini" w FileWrite $0 "type=@INSTALLER_TYPE@$\r$\n" FileWrite $0 "campaign=$CampaignName$\r$\n" FileWrite $0 "exepath=$EXEPATH$\r$\n" FileClose $0 + Pop $0 ;Package the signed uninstaller produced by the inner loop !ifndef INNER @@ -1082,6 +1162,10 @@ Section "-Core installation" Call HandlePostInstallOptions !insertmacro GoogleAnalytics "Installer" "Done" "" "" + + ; stop the image slideshow and display install details + nsisSlideshow::stop + SetDetailsView show SectionEnd !include nsProcess.nsh From 752d8368cc4748a24fe67b73a9739a8523dccacb Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Apr 2018 18:16:44 -0700 Subject: [PATCH 2/3] add slideshow plugin to list of requirements in install doc --- INSTALL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/INSTALL.md b/INSTALL.md index e07d28a43d..ac210c887f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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 - [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 +- [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. From 0da51672bbf61c648b902055616f7ccb5f3559c4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Apr 2018 18:52:45 -0700 Subject: [PATCH 3/3] don't stop image slideshow when install concludes --- cmake/templates/NSIS.template.in | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 6ede94b900..bfedccdd2e 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -1162,10 +1162,6 @@ Section "-Core installation" Call HandlePostInstallOptions !insertmacro GoogleAnalytics "Installer" "Done" "" "" - - ; stop the image slideshow and display install details - nsisSlideshow::stop - SetDetailsView show SectionEnd !include nsProcess.nsh