Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Fix Vagrant boxes so they are DIRECTLY usable #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}