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

fix(decompress): use innoextract if innounp fails #4192

Closed
wants to merge 10 commits into from
5 changes: 3 additions & 2 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function Get-HelperPath {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2')]
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2', 'Innoextract')]
[String]
$Helper
)
Expand All @@ -258,6 +258,7 @@ function Get-HelperPath {
}
'Lessmsi' { $HelperPath = Get-AppFilePath 'lessmsi' 'lessmsi.exe' }
'Innounp' { $HelperPath = Get-AppFilePath 'innounp' 'innounp.exe' }
'Innoextract' { $HelperPath = Get-AppFilePath 'innoextract' 'innoextract.exe' }
'Dark' {
$HelperPath = Get-AppFilePath 'dark' 'dark.exe'
if([String]::IsNullOrEmpty($HelperPath)) {
Expand All @@ -274,7 +275,7 @@ function Test-HelperInstalled {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2')]
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2', 'Innoextract')]
[String]
$Helper
)
Expand Down
13 changes: 11 additions & 2 deletions lib/decompress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,17 @@ function Expand-InnoArchive {
}
$Status = Invoke-ExternalCommand (Get-HelperPath -Helper Innounp) $ArgList -LogPath $LogPath
if (!$Status) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
}
$InnoextractLogPath = "$(Split-Path $Path)\innoextract.log"
$InnoextractArgList = @($Path, "-d", $DestinationPath)
$NewStatus = Invoke-ExternalCommand (Get-HelperPath -Helper innoextract) $InnoextractArgList -LogPath $InnoextractLogPath

if (!$NewStatus) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n $(friendly_path $InnoextractLogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
} else {
dir $DestinationPath\app\* | mv -dest $DestinationPath
rm $DestinationPath\app\
}
}
if (Test-Path $LogPath) {
Remove-Item $LogPath -Force
}
Expand Down
5 changes: 5 additions & 0 deletions lib/depends.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function script_deps($script) {
}
if($script -like '*Expand-InnoArchive *' -or $script -like '*unpack_inno *') {
$deps += 'innounp'
$deps += 'innoextract'
}
if($script -like '*Expand-DarkArchive *') {
$deps += 'dark'
Expand All @@ -86,6 +87,10 @@ function install_deps($manifest, $arch) {
if (!(Test-HelperInstalled -Helper Innounp) -and $manifest.innosetup) {
$deps += 'innounp'
}
if (!(Test-HelperInstalled -Helper innoextract) -and $manifest.innosetup) {
$deps += 'innoextract'
}


$pre_install = arch_specific 'pre_install' $manifest $arch
$installer = arch_specific 'installer' $manifest $arch
Expand Down