Skip to content
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

🤖 Add processhacker.vm #566

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/processhacker.vm/processhacker.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>processhacker.vm</id>
<version>2.39</version>
<authors>Wen Jia Liu</authors>
<description>A free, powerful, multi-purpose tool that helps you monitor system resources, debug software and detect malware.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="processhacker" version="[2.39]" />
</dependencies>
</metadata>
</package>
21 changes: 21 additions & 0 deletions packages/processhacker.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
$toolName = 'ProcessHacker'
$category = 'Utilities'

$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
$shortcut = Join-Path $shortcutDir "$toolName.lnk"
$executablePath = Join-Path ${Env:ProgramFiles} "\Process Hacker 2\ProcessHacker.exe" -Resolve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the tool to path as well?

Install-BinFile -Name $toolName -Path $executablePath

Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -RunAsAdmin
VM-Assert-Path $shortcut

# Delete Desktop shortcut
$desktopShortcut = Join-Path ${Env:Public} "Desktop\Process Hacker 2.lnk"
if (Test-Path $desktopShortcut) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This if is not needed as the next command has the -ea 0that is the same as -ErrorAction SilentlyContinue. We have currently some packages with this if and some without. I would remove it for simplicity.

Remove-Item $desktopShortcut -Force -ea 0
}
} catch {
VM-Write-Log-Exception $_
}
7 changes: 7 additions & 0 deletions packages/processhacker.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

$toolName = 'ProcessHacker'
$category = 'Utilities'

VM-Remove-Tool-Shortcut $toolName $category