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

Clean up psnotify chocoinstall #718

Merged
merged 1 commit into from
Oct 31, 2023
Merged
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
2 changes: 1 addition & 1 deletion packages/psnotify.vm/psnotify.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>psnotify.vm</id>
<version>0.2.4</version>
<version>0.2.4.20231020</version>
<authors>alphillips-lab</authors>
<description>A POC tool to fight .NET anti-dumping tricks.</description>
<dependencies>
Expand Down
47 changes: 19 additions & 28 deletions packages/psnotify.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,29 @@ try {

$unzipLocation = 'C:\' # psnotify has a requirement of being located in 'C:\psnotify'
Ana06 marked this conversation as resolved.
Show resolved Hide resolved
$toolDir = Join-Path $unzipLocation $toolName
try {
$toolDir = Join-Path $unzipLocation $toolName
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category

# Remove files from previous zips for upgrade
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}
# Remove files from previous zips for upgrade
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}

# Download and unzip
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $unzipLocation
url = $zipUrl
checksum = $zipSha256
checksumType = 'sha256'
url64bit = $zipUrl_64
checksum64 = $zipSha256_64
}
Install-ChocolateyZipPackage @packageArgs
VM-Assert-Path $toolDir
$executablePath = Join-Path $toolDir "$toolName.exe" -Resolve
$shortcut = Join-Path $shortcutDir "$toolName.lnk"

$executableDir = $toolDir
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -WorkingDirectory $executableDir
VM-Assert-Path $shortcut

Install-BinFile -Name $toolName -Path $executablePath
return $executablePath
} catch {
VM-Write-Log-Exception $_
# Download and unzip
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $unzipLocation
url = $zipUrl
checksum = $zipSha256
checksumType = 'sha256'
url64bit = $zipUrl_64
checksum64 = $zipSha256_64
}
Install-ChocolateyZipPackage @packageArgs
VM-Assert-Path $toolDir
$executablePath = Join-Path $toolDir "$toolName.exe" -Resolve
$shortcut = Join-Path $shortcutDir "$toolName.lnk"

$executableDir = $toolDir
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -WorkingDirectory $executableDir
VM-Assert-Path $shortcut
} catch {
VM-Write-Log-Exception $_
}
5 changes: 1 addition & 4 deletions packages/psnotify.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ $toolDir = 'C:\psnotify'
Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null

# Remove tool shortcut
VM-Remove-Tool-Shortcut $toolName $category

# Uninstall binary
Uninstall-BinFile -Name $toolName
Ana06 marked this conversation as resolved.
Show resolved Hide resolved
VM-Remove-Tool-Shortcut $toolName $category
Loading