Skip to content

Commit 362a776

Browse files
committed
binja: move to VM-Install-With-Installer
1 parent 01de76f commit 362a776

File tree

2 files changed

+33
-26
lines changed

2 files changed

+33
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
$ErrorActionPreference = 'Stop'
22
Import-Module vm.common -Force -DisableNameChecking
33

4-
try {
5-
$toolName = 'binaryninja'
6-
$category = 'Disassemblers'
7-
8-
$packageArgs = @{
9-
packageName = ${Env:ChocolateyPackageName}
10-
fileType = 'exe'
11-
silentArgs = '/S /ALLUSERS=1'
12-
url = 'https://cdn.binary.ninja/installers/binaryninja_free_win64.exe'
13-
checksum = '426aa8219415a64df90562274ae7e420471934c60f3a19c459e982467469cf55'
14-
checksumType = 'sha256'
15-
}
4+
$toolName = "binaryninja"
5+
$category = "Disassemblers"
6+
$installFile = "binaryninja_free_win64.exe"
167

17-
Install-ChocolateyPackage @packageArgs
8+
function Get-CurrentHash {
9+
param (
10+
[string]$url = "https://binary.ninja/js/hashes.json",
11+
[string]$installFile = $installFile
12+
)
13+
$json = Invoke-WebRequest -Uri $url
14+
$json = ConvertFrom-Json $json
15+
return $json.Hashes.$installFile
16+
}
1817

19-
$toolDir = Join-Path ${Env:ProgramFiles} "Vector35" -Resolve
20-
$toolDir = Join-Path $toolDir "BinaryNinja" -Resolve
21-
$executablePath = Join-Path $toolDir "binaryninja.exe" -Resolve
18+
try {
19+
$url = "https://cdn.binary.ninja/installers/$installFile"
20+
$hash = Get-CurrentHash
21+
$toolDir = Join-Path ${Env:ProgramFiles} "Vector35"
22+
$toolDir = Join-Path $toolDir "BinaryNinja"
23+
$executablePath = Join-Path $toolDir "binaryninja.exe"
2224

23-
Install-BinFile -Name $toolname -Path $executablePath
24-
$executableIcon = Join-Path $toolDir "icon.ico" -Resolve
25-
VM-Install-Shortcut -toolName "binja" -category $category -executablePath $executablePath -IconLocation $executableIcon
25+
VM-Install-With-Installer -toolName $toolName `
26+
-category $category `
27+
-fileType 'EXE' `
28+
-silentArgs '/S /ALLUSERS=1' `
29+
-executablePath $executablePath `
30+
-url $url `
31+
-sha256 $hash `
32+
-consoleApp $false
2633

2734
} catch {
2835
VM-Write-Log-Exception $_
29-
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
$ErrorActionPreference = 'Continue'
22
Import-Module vm.common -Force -DisableNameChecking
33

4-
$toolName = 'binaryninja'
5-
$category = 'Disassemblers'
6-
VM-Remove-Tool-Shortcut $toolName $category
4+
$toolName = "binaryninja"
5+
$category = "Disassemblers"
76

8-
Uninstall-BinFile -Name $toolName
9-
10-
VM-Uninstall-With-Uninstaller "Binary Ninja*" $category "EXE" "/S /ALLUSERS=1"
7+
VM-Uninstall-With-Uninstaller -toolName $toolName `
8+
-category $category `
9+
-fileType "EXE" `
10+
-silentArgs "/S /ALLUSERS=1"

0 commit comments

Comments
 (0)