Skip to content

Commit d03b30c

Browse files
Updates setup files. Fixes #624 (#626)
1 parent df3f4b5 commit d03b30c

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

scripts/setup-beta.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ Write-Host "Downloading Dev Proxy $version..."
4040
$base_url = "https://github.com/microsoft/dev-proxy/releases/download/$version/dev-proxy"
4141

4242
# Check system architecture
43-
$os = $PSVersionTable.OS
43+
# empty in Windows PowerShell
4444
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
45+
# fallback for Windows PowerShell
46+
$os = [System.Runtime.InteropServices.RuntimeInformation]::OSDescription
47+
$isX64 = [Environment]::Is64BitOperatingSystem
4548

4649
if ($os -match "Windows") {
47-
if ($arch -eq "X64") {
50+
if ($isX64) {
4851
$url = "$base_url-win-x64-$version.zip"
49-
} elseif ($arch -eq "X86") {
50-
$url = "$base_url-win-x86-$version.zip"
5152
} else {
52-
Write-Host "Unsupported architecture $arch. Aborting"
53-
exit 1
53+
$url = "$base_url-win-x86-$version.zip"
5454
}
55-
} elseif ($os -match "Linux") {
55+
} elseif ($IsLinux) {
5656
if ($arch -eq "X64") {
5757
$url = "$base_url-linux-x64-$version.zip"
5858
} else {
5959
Write-Host "Unsupported architecture $arch. Aborting"
6060
exit 1
6161
}
62-
} elseif ($os -match "Darwin") {
62+
} elseif ($IsMacOS) {
6363
# temporary workaround to install devproxy on Mx macs
6464
if ($arch -eq "X64" -or $arch -eq "Arm64") {
6565
$url = "$base_url-osx-x64-$version.zip"
@@ -77,7 +77,7 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
7777
Expand-Archive -Path devproxy.zip -DestinationPath . -Force -ErrorAction Stop
7878
Remove-Item devproxy.zip
7979

80-
if ($os -match "Linux" -or $os -match "Darwin") {
80+
if ($IsLinux -or $IsMacOS) {
8181
Write-Host "Configuring devproxy and its files as executable..."
8282
chmod +x ./devproxy ./libe_sqlite3.dylib
8383
}

scripts/setup.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ Write-Host "Downloading Dev Proxy $version..."
3939
$base_url = "https://github.com/microsoft/dev-proxy/releases/download/$version/dev-proxy"
4040

4141
# Check system architecture
42-
$os = $PSVersionTable.OS
42+
# empty in Windows PowerShell
4343
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
44+
# fallback for Windows PowerShell
45+
$os = [System.Runtime.InteropServices.RuntimeInformation]::OSDescription
46+
$isX64 = [Environment]::Is64BitOperatingSystem
4447

4548
if ($os -match "Windows") {
46-
if ($arch -eq "X64") {
49+
if ($isX64) {
4750
$url = "$base_url-win-x64-$version.zip"
48-
} elseif ($arch -eq "X86") {
49-
$url = "$base_url-win-x86-$version.zip"
5051
} else {
51-
Write-Host "Unsupported architecture $arch. Aborting"
52-
exit 1
52+
$url = "$base_url-win-x86-$version.zip"
5353
}
54-
} elseif ($os -match "Linux") {
54+
} elseif ($IsLinux) {
5555
if ($arch -eq "X64") {
5656
$url = "$base_url-linux-x64-$version.zip"
5757
} else {
5858
Write-Host "Unsupported architecture $arch. Aborting"
5959
exit 1
6060
}
61-
} elseif ($os -match "Darwin") {
61+
} elseif ($IsMacOS) {
6262
# temporary workaround to install devproxy on Mx macs
6363
if ($arch -eq "X64" -or $arch -eq "Arm64") {
6464
$url = "$base_url-osx-x64-$version.zip"
@@ -76,7 +76,7 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
7676
Expand-Archive -Path devproxy.zip -DestinationPath . -Force -ErrorAction Stop
7777
Remove-Item devproxy.zip
7878

79-
if ($os -match "Linux" -or $os -match "Darwin") {
79+
if ($IsLinux -or $IsMacOS) {
8080
Write-Host "Configuring devproxy and its files as executable..."
8181
chmod +x ./devproxy ./libe_sqlite3.dylib
8282
}

0 commit comments

Comments
 (0)