forked from dolphinsmalltalk/Dolphin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FetchVM.ps1
38 lines (33 loc) · 1.21 KB
/
FetchVM.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Powershell script to pull the VM files from GitHub into the current folder.
# Either invoke with a VMversion parameter specifying the version you want to download,
# or use FetchVM.cmd, which will query git to determine the correct version.
param
(
[string]$VMversion
)
# Override Powershell's default use of TLS1.0 for web requests; this is insecure and no longer works with GitHub
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if(-not($VMVersion)) { Throw “VMVersion required (hint: Use/see fetchvm.cmd)” }
Try
{
$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path;
Write-Host "Fetching DolphinVM.zip" $VMversion
$source = "https://github.com/dolphinsmalltalk/Dolphin/releases/download/$VMversion/DolphinVM.zip";
$zipFile = $scriptDir+"\DolphinVM.zip";
Invoke-WebRequest $source -OutFile $zipFile;
}
Catch
{
Write-Host "Unable to fetch DolphinVM.zip" $VMversion;
Break;
}
$shell = new-object -com shell.application;
$zip = $shell.NameSpace($zipFile);
foreach($item in $zip.items())
{
Write-Host "..unpack" $item.Name
$shell.Namespace($scriptDir).copyhere($item, 0x14);
}
Write-Host "Removing Zip"
Remove-Item $zipFile
Write-Host "Done fetching DolphinVM.zip" $VMversion