7
7
# of them when querying for the architecture.
8
8
#>
9
9
[System.String []]$SUPPORTED_ARCH = @ (" x86_64" , " arm64" , " amd64" )
10
- [System.String []]$SUPPORTED_OS = @ (" linux" , " darwin" , " win32nt" )
11
-
12
- # Associate binaries with CPU architectures and operating systems
13
- [System.Collections.Hashtable ]$BINARIES = @ {
14
- " x86_64-linux" = " Parseable_x86_64-unknown-linux-gnu"
15
- " arm64-linux" = " Parseable_aarch64-unknown-linux-gnu"
16
- " x86_64-darwin" = " Parseable_x86_64-apple-darwin"
17
- " arm64-darwin" = " Parseable_aarch64-apple-darwin"
18
- " amd64-win32nt" = " Parseable_x86_64-pc-windows-msvc.exe"
19
- }
10
+ [System.String ]$DOWNLOAD_BASE_URL = " cdn.parseable.com/"
20
11
21
12
# util functions
22
13
function Get-Env {
@@ -86,12 +77,13 @@ function Get-Env {
86
77
}
87
78
88
79
# Get the system's CPU architecture and operating system
89
- [String ]$CPU_ARCH = [ System.Environment ]::GetEnvironmentVariable( " PROCESSOR_ARCHITECTURE " ).ToLower()
90
- [String ]$OS = [ System.Environment ]::OSVersion.Platform.ToString().ToLower()
80
+ [String ]$CPU_ARCH = " x86_64 "
81
+ [String ]$OS = " windows "
91
82
[String ]$INSTALLDIR = " ${HOME} \.parseable\bin"
92
83
[String ]$BIN = " ${INSTALLDIR} \parseable.exe"
93
84
94
85
function Install-Parseable {
86
+ Write-Output " `n =========================`n "
95
87
Write-Output " OS: $OS "
96
88
Write-Output " CPU arch: $CPU_ARCH "
97
89
@@ -100,11 +92,6 @@ function Install-Parseable {
100
92
Write-Error " Unsupported CPU architecture ($CPU_ARCH )."
101
93
exit 1
102
94
}
103
- # Check if the OS is supported
104
- if ($SUPPORTED_OS -notcontains $OS ) {
105
- Write-Error " Unsupported operating system ($OS )."
106
- exit 1
107
- }
108
95
109
96
Write-Output " Checking for existing installation..."
110
97
if (Test-Path $BIN ) {
@@ -119,26 +106,14 @@ function Install-Parseable {
119
106
# Get the latest release information using GitHub API
120
107
$release = Invoke-RestMethod - Uri " https://api.github.com/repos/parseablehq/parseable/releases/latest"
121
108
# Loop through binaries in the release and find the appropriate one
122
- foreach ($arch_os in " $CPU_ARCH -$OS " ) {
123
- $binary_name = $BINARIES [$arch_os ]
124
- $download_url = ($release.assets | Where-Object { $_.name -like " *$binary_name *" }).browser_download_url
125
- if ($download_url ) {
126
- break
127
- }
128
- }
109
+ $download_url = $DOWNLOAD_BASE_URL + $CPU_ARCH + " -" + $OS + " ." + $release.tag_name
129
110
130
111
mkdir - Force $INSTALLDIR
131
112
132
- Write-Output " Downloading Parseable Server... "
113
+ Write-Output " Downloading Parseable version $release_tag , for OS: $OS , CPU architecture: $CPU_ARCH `n`n "
133
114
# Download the binary using Invoke-WebRequest
134
115
Invoke-WebRequest - Uri $download_url - OutFile $BIN
135
116
136
- # Make the binary executable (for Unix-like systems)
137
- if ($OS -eq " linux" -or $OS -eq " darwin" ) {
138
- Set-ItemProperty - Path $BIN - Name IsReadOnly - Value $false
139
- Set-ItemProperty - Path $BIN - Name IsExecutable - Value $true
140
- }
141
-
142
117
Write-Output " Adding Parseable to PATH..."
143
118
# Only try adding to path if there isn't already a bun.exe in the path
144
119
$Path = (Get-Env - Key " Path" ) -split ' ;'
0 commit comments