Skip to content

Commit 35abb25

Browse files
authored
Fix Vagrant boxes so they are DIRECTLY usable
Fixes MicrosoftEdge#15 and should make developers 100x more likely to actually use it
1 parent f61e112 commit 35abb25

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

scripts/vmgen.ps1

+18-12
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,14 @@ function Compress($software, $browser, $windows, $oshost) {
247247
LogWrite "Starting Vagrant compression..."
248248
# Compress Vagrant
249249
$zipFolder = "$outputPath\VMBuild_$global:buildId\Vagrant\$browser\"
250-
$zipName = "$browser.$windows.Vagrant.zip"
250+
$zipName = "$browser.$windows.Vagrant.box"
251251

252252
$sourceBox = "$global:Path\..\vms\output\Vagrant\edgems.box"
253253
$source = "$global:Path\..\vms\output\Vagrant\$browser - $windows.box"
254254
If (Test-Path $sourceBox) { Move-Item $sourceBox $source -Force }
255-
256-
Compress-SingleAndMultipart $zipFolder $zipName $source
255+
# We do NOT want to try and further compress the .box, it is already compressed and
256+
# adding the extra layer of archiving BREAKS `vagrant box add --name ModernIE https://aka.ms/msedge.win10.vagrant`
257+
Compress-SingleAndMultipart $zipFolder $zipName $source $skipCompression=$True
257258
}
258259
}
259260

@@ -266,7 +267,7 @@ function Generate-Hashes ($zipsPath, $outputPath) {
266267
}
267268
}
268269

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

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

277278
$outputPath = $global:Config.OutputPath
278279

279-
IF ($multipart -eq $True) {
280-
LogWrite "Compressing VM to multipart file ZIP $source $zipName in $zipFolder"
281-
& 7z a $zipFolder$zipName $source -tzip -r -v1G -aoa | Out-Null
282-
}
283-
284-
LogWrite "Compressing VM to single file ZIP $source $zipName in $zipFolder"
285-
& 7z a $zipFolder$zipName $source -tzip -r -aoa | Out-Null
280+
IF ($skipCompression -eq $False) {
281+
IF ($multipart -eq $True) {
282+
LogWrite "Compressing VM to multipart file ZIP $source $zipName in $zipFolder"
283+
& 7z a $zipFolder$zipName $source -tzip -r -v1G -aoa | Out-Null
284+
}
286285

286+
LogWrite "Compressing VM to single file ZIP $source $zipName in $zipFolder"
287+
& 7z a $zipFolder$zipName $source -tzip -r -aoa | Out-Null
288+
} else {
289+
# In the Vagrant case, we just want the .box not a .zip
290+
Move-Item $source $zipFolder$zipName -Force
291+
}
292+
287293
$md5FolderPath = "$outputPath\md5\VMBuild_$global:buildId"
288294
LogWrite "Generating File Hashes..."
289295
Generate-Hashes $zipFolder $md5FolderPath
@@ -642,4 +648,4 @@ If ($GenerateJSON -eq $True -or $Build -eq $True) {
642648
Prepare-SofwareListJsonToBeNotified
643649
Send-NotificationEmail
644650
Remove-OutputFiles
645-
}
651+
}

0 commit comments

Comments
 (0)