From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ryan Volz Date: Wed, 23 Feb 2022 18:11:22 -0500 Subject: [PATCH] Customize Windows NSIS installer script. 1. Never clear the full pkg dir 2. Delete environment variables set in registry by PothosSDR 3. Do not show "advanced" installation options --- constructor/nsis/main.nsi.tmpl | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/constructor/nsis/main.nsi.tmpl b/constructor/nsis/main.nsi.tmpl index 6f5c8ae..df85d27 100644 --- a/constructor/nsis/main.nsi.tmpl +++ b/constructor/nsis/main.nsi.tmpl @@ -151,7 +151,7 @@ Page Custom InstModePage_Create InstModePage_Leave !define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirectoryLeave !insertmacro MUI_PAGE_DIRECTORY # Custom options now differ depending on installation mode. -Page Custom mui_AnaCustomOptions_Show +#Page Custom mui_AnaCustomOptions_Show !insertmacro MUI_PAGE_INSTFILES #if with_conclusion_text is True !define MUI_FINISHPAGE_TITLE __CONCLUSION_TITLE__ @@ -1087,7 +1087,7 @@ Section "Install" ${If} $Ana_ClearPkgCache_State = ${BST_CHECKED} DetailPrint "Clearing package cache..." - push '"$INSTDIR\_conda.exe" clean --all --force-pkgs-dirs --yes' + push '"$INSTDIR\_conda.exe" clean --all --yes' push 'Failed to clear package cache' push 'WithLog' call AbortRetryNSExecWait @@ -1120,6 +1120,26 @@ Section "Install" ${EndIf} ${If} $ARGV_NoRegistry == "0" + # Delete registry entries for environment variables set by PothosSDR + # With admin rights, we can delete them + ${If} ${UAC_IsAdmin} + DetailPrint "Deleting PothosSDR registry environment variables..." + !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + DeleteRegValue ${env_hklm} "GR_PREFIX" + DeleteRegValue ${env_hklm} "GRC_BLOCKS_PATH" + DeleteRegValue ${env_hklm} "UHD_PKG_PATH" + DeleteRegValue ${env_hklm} "VOLK_PREFIX" + # Without admin rights, we have to shadow them with empty values set for the user + ${Else} + DetailPrint "Overriding PothosSDR registry environment variables for user..." + !define env_hkcu 'HKCU "Environment"' + WriteRegExpandStr ${env_hkcu} "GR_PREFIX" "" + WriteRegExpandStr ${env_hkcu} "GRC_BLOCKS_PATH" "" + WriteRegExpandStr ${env_hkcu} "UHD_PKG_PATH" "" + WriteRegExpandStr ${env_hkcu} "VOLK_PREFIX" "" + ${EndIf} + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + # Registry uninstall info WriteRegStr SHCTX "${UNINSTREG}" "DisplayName" "${UNINSTALL_NAME}" WriteRegStr SHCTX "${UNINSTREG}" "DisplayVersion" "${VERSION}" @@ -1202,6 +1222,15 @@ Section "Uninstall" # In case the last command fails, run the slow method to remove leftover RMDir /r /REBOOTOK "$INSTDIR" + # Delete user environment variables that we set during installation + ${IfNot} ${UAC_IsAdmin} + DeleteRegValue ${env_hkcu} "GR_PREFIX" + DeleteRegValue ${env_hkcu} "GRC_BLOCKS_PATH" + DeleteRegValue ${env_hkcu} "UHD_PKG_PATH" + DeleteRegValue ${env_hkcu} "VOLK_PREFIX" + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + ${EndIf} + DeleteRegKey SHCTX "${UNINSTREG}" # If Anaconda was registered as the official Python for this version, # remove it from the registry -- 2.39.2