Skip to content

Commit ad10df0

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

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

Diff for: packages/binaryninja.vm/tools/chocolateyinstall.ps1

+25-20
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
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+
$installFile = "binaryninja_free_win64.exe"
165

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

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

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
23+
VM-Install-With-Installer -toolName 'binaryninja' `
24+
-category 'Disassemblers' `
25+
-fileType 'EXE' `
26+
-silentArgs '/S /ALLUSERS=1' `
27+
-executablePath $executablePath `
28+
-url $url `
29+
-sha256 $hash `
30+
-consoleApp $false
2631

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

4-
$toolName = 'binaryninja'
5-
$category = 'Disassemblers'
6-
VM-Remove-Tool-Shortcut $toolName $category
7-
8-
Uninstall-BinFile -Name $toolName
9-
10-
VM-Uninstall-With-Uninstaller "Binary Ninja*" $category "EXE" "/S /ALLUSERS=1"
4+
VM-Uninstall-With-Uninstaller -toolName "Binary Ninja*" `
5+
-category "Disassemblers" `
6+
-fileType "EXE" `
7+
-silentArgs "/S /ALLUSERS=1"

0 commit comments

Comments
 (0)