Skip to content

Commit

Permalink
Adjust Apktool package to use openjdk
Browse files Browse the repository at this point in the history
  • Loading branch information
emtuls committed Dec 22, 2023
1 parent c459d7b commit 780f090
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/apktool.vm/apktool.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>apktool.vm</id>
<version>2.9.0.20231024</version>
<version>2.9.1</version>
<authors>Connor Tumbleson, Ryszard Wisniewski</authors>
<description>A tool for reverse engineering 3rd party, closed, binary Android apps.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="apktool" version="[2.9.0]" />
<dependency id="common.vm" version="0.0.0.20231221" />
<dependency id="openjdk.vm" />
</dependencies>
</metadata>
</package>
20 changes: 17 additions & 3 deletions packages/apktool.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,29 @@ Import-Module vm.common -Force -DisableNameChecking
try {
$toolName = 'apktool'
$category = 'Java & Android'
$shimPath = 'bin\apktool.exe'
$rawToolPath = Join-Path ${Env:RAW_TOOLS_DIR} "$toolName"

# Download apktool.bat
$wrapperPath = Join-Path $rawToolPath "$toolName.bat"
$wrapperSource = 'https://raw.githubusercontent.com/iBotPeaches/Apktool/0741664808724bda41744ad3981bac2eec672d1b/scripts/windows/apktool.bat'
$wrapperChecksum = "3e1c29f9d2c7b3a7c938573f4c2ae61172f6221dc9febfa85080f354357d6336"
Get-ChocolateyWebFile -PackageName '$toolName wrapper script' -FileFullPath $wrapperPath -Url $wrapperSource -Checksum $wrapperChecksum -ChecksumType "sha256"

# Download apktool.jar
$toolPath = Join-Path $rawToolPath "$toolName.jar"
$toolSource = 'https://github.com/iBotPeaches/Apktool/releases/download/v2.9.1/apktool_2.9.1.jar'
$toolChecksum = "de7ce8aa109acb649e7f69cfe91030ffc20dbcc46edd8abbf6c2d1e36cfccd7b"
Get-ChocolateyWebFile -PackageName $toolName -FileFullPath $toolPath -Url $toolSource -Checksum $toolChecksum -ChecksumType "sha256"

# Add apktool to Path
VM-Add-To-Path $rawToolPath

$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
$shortcut = Join-Path $shortcutDir "$toolName.lnk"

$executablePath = Join-Path ${Env:ChocolateyInstall} $shimPath -Resolve
$executableCmd = Join-Path ${Env:WinDir} "system32\cmd.exe"
$executableDir = Join-Path ${Env:UserProfile} "Desktop"
$executableArgs = "/K `"cd `"$executableDir`" && `"$executablePath`""
$executableArgs = "/K `"$toolName`""

Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executableCmd -Arguments $executableArgs -WorkingDirectory $executableDir
VM-Assert-Path $shortcut
Expand Down

0 comments on commit 780f090

Please sign in to comment.