Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update spacetime-install.ps1 #2356

Open
wants to merge 2 commits 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
29 changes: 26 additions & 3 deletions crates/update/spacetime-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ function Install {
$ErrorActionPreference = 'Stop'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

function CheckVCRuntime {
$paths = @(
"$env:SystemRoot\System32\vcruntime140.dll",
"$env:SystemRoot\SysWOW64\vcruntime140.dll"
)
foreach ($path in $paths) {
if (Test-Path $path) {
Write-Host "vcruntime140.dll is already installed at $path"
return $true
}
}
Write-Host "vcruntime140.dll is not installed"
return $false
}

if (-not (CheckVCRuntime)) {
$DownloadUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
Write-Output "Downloading vcruntime140.dll..."
$Installer = Join-Path ([System.IO.Path]::GetTempPath()) "vc_redist.x64.exe"
Invoke-WebRequest $DownloadUrl -OutFile $Installer -UseBasicParsing
Start-Process -Wait -FilePath $Installer -ArgumentList "/quiet", "/install"
return
}

$DownloadUrl = "https://github.com/clockworklabs/SpacetimeDB/releases/latest/download/spacetimedb-update-x86_64-pc-windows-msvc.exe"
Write-Output "Downloading installer..."

Expand All @@ -22,13 +46,12 @@ function Install {

$Executable = Join-Path ([System.IO.Path]::GetTempPath()) "spacetime-install.exe"
Invoke-WebRequest $DownloadUrl -OutFile $Executable -UseBasicParsing
& $Executable
Start-Process -Wait -FilePath $Executable

# TODO: do this in spacetimedb-update
$InstallDir = Join-Path ([Environment]::GetFolderPath("LocalApplicationData")) "SpacetimeDB"
UpdatePathIfNotExists $InstallDir
Write-Output "We have added spacetimedb to your Path. You may have to logout and log back in to reload your environment."
}

Install

Install