-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor WinDbg install #1058
base: main
Are you sure you want to change the base?
Refactor WinDbg install #1058
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,32 @@ try { | |
$toolName = 'WinDbg' | ||
$category = 'Debuggers' | ||
|
||
# It seems WinDbg is now distributed as an .appinstaller and we need to install it using Add-AppxPackage | ||
Add-AppxPackage -AppInstallerFile 'https://windbg.download.prss.microsoft.com/dbazure/prod/1-0-0/windbg.appinstaller' | ||
$bundleUrl = "https://windbg.download.prss.microsoft.com/dbazure/prod/1-2402-24001-0/windbg.msixbundle" | ||
$bundleSha256 = "e941076cb4d7912d32a22ea87ad2693c01fa465227b4d1ead588283518de428f" | ||
|
||
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category | ||
$shortcut = Join-Path $shortcutDir "$toolName.lnk" | ||
$executableCmd = Join-Path ${Env:WinDir} "system32\cmd.exe" | ||
# Use `start` to close the open console | ||
$executableArgs = "/C start WinDbgX.exe" | ||
$executableDir = Join-Path ${Env:UserProfile} "Desktop" | ||
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executableCmd -Arguments $executableArgs -WorkingDirectory $executableDir -RunAsAdmin | ||
$packageArgs = @{ | ||
packageName = ${Env:ChocolateyPackageName} | ||
url = $bundleUrl | ||
checksum = $bundleSha256 | ||
checksumType = "sha256" | ||
fileFullPath = Join-Path ${Env:TEMP} "$toolName.msixbundle" | ||
} | ||
Get-ChocolateyWebFile @packageArgs | ||
Add-AppxPackage -Path $packageArgs.fileFullPath | ||
|
||
$installDir = (Get-AppxPackage -Name "Microsoft.$toolName").InstallLocation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the error I got as well. @d35ha do you get the error for the icon or only when used as executable path? |
||
$iconLocation = Join-Path $installDir "DbgX.Shell.exe" -Resolve | ||
$executablePath = "$(where.exe WinDbgXA.exe)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually It's a way better to use the powershell function It would be like this: $executablePath = (Get-Command WinDbgXA.exe -ea 0).Path
if (!$executablePath)
{
$executablePath = Join-Path $installDir DbgX.Shell.exe
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @d35ha your proposal could cause that |
||
VM-Install-Shortcut -toolName $toolName -category $category -executablePath $executablePath -iconLocation $iconLocation -RunAsAdmin | ||
} catch { | ||
VM-Write-Log-Exception $_ | ||
if ($_.Exception.Message -match "INFO: Could not find files for the given pattern\(s\).") | ||
{ | ||
$executablePath = Join-Path $installDir "DbgX.Shell.exe" | ||
VM-Install-Shortcut -toolName $toolName -category $category -executablePath $executablePath -iconLocation $iconLocation -RunAsAdmin | ||
} | ||
else | ||
{ | ||
VM-Write-Log-Exception $_ | ||
} | ||
Comment on lines
+26
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is the route we want to take, as noted in my comments on the PR. I think our current route of just making a shortcut may be the better alternative for the moment, unless we want to take the time to properly test and confirm one of the possible working solutions I noted in my comments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least we need to continue on this error, or |
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a
VM-Assert-Path $packageArgs.fileFullPath
to ensure the file has been downloaded before installing it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary, as
Get-ChocolateyWebFile
will throw an error with "incorrect hash" if the file has not been downloaded.