Add logging to the windows installer to track install options

and install steps
This commit is contained in:
Roxanne Skelly 2018-10-18 16:42:22 -07:00
parent 1f06c87580
commit 48a48883b0
2 changed files with 33 additions and 1 deletions

View file

@ -54,3 +54,4 @@ set(CLIENT_COMPONENT_CONDITIONAL "@CLIENT_COMPONENT_CONDITIONAL@")
set(INSTALLER_TYPE "@INSTALLER_TYPE@")
set(APP_USER_MODEL_ID "@APP_USER_MODEL_ID@")
set(BYPASS_SIGNING "@BYPASS_SIGNING@")
set(HF_CMAKE_DIR "@HF_CMAKE_DIR@")

View file

@ -28,6 +28,11 @@
!include "WinVer.nsh"
;--------------------------------
;Include Installer Logging
!addincludedir "@HF_CMAKE_DIR@\installer"
!include "TextLog.nsh"
;--------------------------------
; Utilities and Functions
;--------------------------------
@ -375,6 +380,10 @@ Var GAClientID
!insertmacro CreateGUID $GAClientID
!macroend
!macro LogStep Category Action Label Value
${LogText} "Step: ${Category} ${Action} ${Label} ${Value}"
!macroend
!macro GoogleAnalytics Category Action Label Value
${If} "@GA_TRACKING_ID@" != ""
Push $0
@ -557,11 +566,13 @@ Var Express
!macro MaybeSkipPage
; Check if Express is set, if so, abort the post install options page
${If} $Express == "1"
${LogText} "Express Install: Skipping Post Install Options Page"
Abort
${EndIf}
!macroend
!macro DownloadSlideshowImages
${LogText} "Download Slideshow Images"
InitPluginsDir
Push $0
@ -583,32 +594,40 @@ Var Express
!macroend
Function OnUserAbort
!insertmacro LogStep "Installer" "Abort" "User Abort" ""
!insertmacro GoogleAnalytics "Installer" "Abort" "User Abort" ""
FunctionEnd
Function PageWelcomePre
!insertmacro LogStep "Installer" "Welcome" "" ""
!insertmacro GoogleAnalytics "Installer" "Welcome" "" ""
!insertmacro DownloadSlideshowImages
FunctionEnd
Function PageLicensePre
!insertmacro LogStep "Installer" "License" "" ""
!insertmacro GoogleAnalytics "Installer" "License" "" ""
FunctionEnd
Function PageDirectoryPre
!insertmacro MaybeSkipPage
!insertmacro LogStep "Installer" "Directory" "" ""
!insertmacro GoogleAnalytics "Installer" "Directory" "" ""
FunctionEnd
Function PageStartMenuPre
!insertmacro MaybeSkipPage
!insertmacro LogStep "Installer" "StartMenu" "" ""
!insertmacro GoogleAnalytics "Installer" "StartMenu" "" ""
FunctionEnd
Function PageComponentsPre
!insertmacro MaybeSkipPage
!insertmacro LogStep "Installer" "Components" "" ""
!insertmacro GoogleAnalytics "Installer" "Components" "" ""
FunctionEnd
Function PageInstallFilesPre
!insertmacro LogStep "Installer" "Install" "" ""
!insertmacro GoogleAnalytics "Installer" "Install" "" ""
FunctionEnd
!macro SetInstallOption Checkbox OptionName Default
${LogText} "SetInstallOption ${OptionName} ${Default}"
; reads the value for the given install option to the registry
ReadRegStr $0 HKLM "@REGISTRY_HKLM_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\@POST_INSTALL_OPTIONS_REG_GROUP@" "${OptionName}"
@ -625,6 +644,7 @@ FunctionEnd
!macroend
Function InstallTypesPage
!insertmacro LogStep "Installer" "Install Types" "" ""
!insertmacro GoogleAnalytics "Installer" "Install Types" "" ""
!insertmacro MUI_HEADER_TEXT "Choose Installation Type" "Express or Custom Install"
@ -688,6 +708,7 @@ FunctionEnd
Function StartInstallSlideshow
; create a slideshow file based on what files we have available
${LogText} "Start Installs Slideshow"
; stash $0 and $1
Push $0
@ -730,7 +751,11 @@ Function StartInstallSlideshow
FunctionEnd
Function PostInstallOptionsPage
${LogText} "Install Directory: $INSTDIR"
!insertmacro MaybeSkipPage
!insertmacro LogStep "Installer" "Post Install Options" "" ""
!insertmacro GoogleAnalytics "Installer" "Post Install Options" "" ""
!insertmacro MUI_HEADER_TEXT "Setup Options" ""
@ -1225,6 +1250,7 @@ Section "-Core installation"
; Handle whichever post install options were set
Call HandlePostInstallOptions
!insertmacro LogStep "Installer" "Done" "" ""
!insertmacro GoogleAnalytics "Installer" "Done" "" ""
SectionEnd
@ -1232,7 +1258,6 @@ SectionEnd
!macro PromptForRunningApplication applicationName displayName action prompter
!define UniqueID ${__LINE__}
Prompt_${UniqueID}:
${nsProcess::FindProcess} ${applicationName} $R0
@ -1478,6 +1503,11 @@ InstallDirRegKey HKLM "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_RE
Function .onInit
Delete "$TEMP\hifi_install.log"
${LogSetFileName} "$TEMP\hifi_install.log"
${LogSetOn}
${LogText} "In .onInit"
!ifdef INNER
; If INNER is defined, then we aren't supposed to do anything except write out
; the installer. This is better than processing a command line option as it means
@ -1495,6 +1525,7 @@ Function .onInit
!insertmacro GoogleAnalytics "Installer" "Start" "$CampaignName" ""
; make sure none of the installed applications are still running
${LogText} "Checking For Running Applications"
!insertmacro CheckForRunningApplications "installed" "Installer"
${nsProcess::Unload}