Skip to content

Commit

Permalink
Merge pull request #236 from taliesins/Support-Packer-Compression
Browse files Browse the repository at this point in the history
fix: Support packer compression
  • Loading branch information
taliesins authored Jan 14, 2024
2 parents 5850a72 + 9febad8 commit 82c1c1f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions api/hyperv-winrm/vhd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ function Expand-Downloads {
[System.IO.Compression.ZipFile]::ExtractToDirectory($_.FullName, $tempPath)
}
if (Test-Path "$tempPath\Virtual Hard Disks") {
Move-Item "$tempPath\Virtual Hard Disks\*.*" $FolderPath
$vhdPath = Get-ChildItem $tempPath *"Virtual Hard Disks"* -Recurse -Directory
if (Test-Path $($vhdPath.FullName)) {
Move-Item "$($vhdPath.FullName)\*.*" $FolderPath
} else {
Move-Item "$tempPath\*.*" $FolderPath
}
Expand All @@ -116,8 +118,10 @@ function Expand-Downloads {
$command = """$7zPath"" x ""$($_.FullName)"" -o""$tempPath"""
& cmd.exe /C $command
if (Test-Path "$tempPath\Virtual Hard Disks") {
Move-Item "$tempPath\Virtual Hard Disks\*.*" $FolderPath
$vhdPath = Get-ChildItem $tempPath *"Virtual Hard Disks"* -Recurse -Directory
if ($vhdPath -and Test-Path $($vhdPath.FullName)) {
Move-Item "$($vhdPath.FullName)\*.*" $FolderPath
} else {
Move-Item "$tempPath\*.*" $FolderPath
}
Expand All @@ -139,8 +143,10 @@ function Expand-Downloads {
$command = """$tarPath"" -C ""$tempPath"" -x -f ""$($_.FullName)"""
& cmd.exe /C $command
if (Test-Path "$tempPath\Virtual Hard Disks") {
Move-Item "$tempPath\Virtual Hard Disks\*.*" $FolderPath
$vhdPath = Get-ChildItem $tempPath *"Virtual Hard Disks"* -Recurse -Directory
if ($vhdPath -and Test-Path $($vhdPath.FullName)) {
Move-Item "$($vhdPath.FullName)\*.*" $FolderPath
} else {
Move-Item "$tempPath\*.*" $FolderPath
}
Expand Down

0 comments on commit 82c1c1f

Please sign in to comment.