Skip to content

Commit

Permalink
Fix Vagrant boxes so they are DIRECTLY usable
Browse files Browse the repository at this point in the history
Fixes MicrosoftEdge#15 and should make developers 100x more likely to actually use it
  • Loading branch information
dragon788 authored Sep 28, 2019
1 parent f61e112 commit 35abb25
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions scripts/vmgen.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,14 @@ function Compress($software, $browser, $windows, $oshost) {
LogWrite "Starting Vagrant compression..."
# Compress Vagrant
$zipFolder = "$outputPath\VMBuild_$global:buildId\Vagrant\$browser\"
$zipName = "$browser.$windows.Vagrant.zip"
$zipName = "$browser.$windows.Vagrant.box"

$sourceBox = "$global:Path\..\vms\output\Vagrant\edgems.box"
$source = "$global:Path\..\vms\output\Vagrant\$browser - $windows.box"
If (Test-Path $sourceBox) { Move-Item $sourceBox $source -Force }

Compress-SingleAndMultipart $zipFolder $zipName $source
# We do NOT want to try and further compress the .box, it is already compressed and
# adding the extra layer of archiving BREAKS `vagrant box add --name ModernIE https://aka.ms/msedge.win10.vagrant`
Compress-SingleAndMultipart $zipFolder $zipName $source $skipCompression=$True
}
}

Expand All @@ -266,7 +267,7 @@ function Generate-Hashes ($zipsPath, $outputPath) {
}
}

function Compress-SingleAndMultipart ($zipFolder, $zipName, $source) {
function Compress-SingleAndMultipart ($zipFolder, $zipName, $source, $skipCompression=$False) {
$multipart = $global:Config.GenerateMultipart

IF(Test-Path $zipFolder) {
Expand All @@ -276,14 +277,19 @@ function Compress-SingleAndMultipart ($zipFolder, $zipName, $source) {

$outputPath = $global:Config.OutputPath

IF ($multipart -eq $True) {
LogWrite "Compressing VM to multipart file ZIP $source $zipName in $zipFolder"
& 7z a $zipFolder$zipName $source -tzip -r -v1G -aoa | Out-Null
}

LogWrite "Compressing VM to single file ZIP $source $zipName in $zipFolder"
& 7z a $zipFolder$zipName $source -tzip -r -aoa | Out-Null
IF ($skipCompression -eq $False) {
IF ($multipart -eq $True) {
LogWrite "Compressing VM to multipart file ZIP $source $zipName in $zipFolder"
& 7z a $zipFolder$zipName $source -tzip -r -v1G -aoa | Out-Null
}

LogWrite "Compressing VM to single file ZIP $source $zipName in $zipFolder"
& 7z a $zipFolder$zipName $source -tzip -r -aoa | Out-Null
} else {
# In the Vagrant case, we just want the .box not a .zip
Move-Item $source $zipFolder$zipName -Force
}

$md5FolderPath = "$outputPath\md5\VMBuild_$global:buildId"
LogWrite "Generating File Hashes..."
Generate-Hashes $zipFolder $md5FolderPath
Expand Down Expand Up @@ -642,4 +648,4 @@ If ($GenerateJSON -eq $True -or $Build -eq $True) {
Prepare-SofwareListJsonToBeNotified
Send-NotificationEmail
Remove-OutputFiles
}
}

0 comments on commit 35abb25

Please sign in to comment.