diff --git a/README.md b/README.md index 162b900..38758b2 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Download the most recent [release](https://github.com/UCSD-E4E/git-lfs-synology/ #### Windows These install scripts install `git-lfs-synology` globally. This will impact all git repos on your system. Please install manually if this is something that you need to avoid. +Please install this using PowerShell as your user. Do NOT execute this from an admin shell. + ```powershell Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression (Invoke-WebRequest https://raw.githubusercontent.com/UCSD-E4E/git-lfs-synology/refs/heads/main/scripts/install.ps1?bust=$((Get-Date).Ticks)).Content; Invoke-InstallScript ``` diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 0edc84d..fd358ae 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -24,10 +24,21 @@ function Invoke-InstallScript { "*Darwin*" { "osx" } # MacOS is identified as Darwin Default { "unknown" } } - $arch = switch ($architecture) { - "X64" { "x86_64" } - "Arm64" { "aarch64" } - Default { "unknown" } + + if ($osPlatform -ne "win") { + $arch = switch ($env:PROCESSOR_ARCHITECTURE) { + "AMD64" { "x86_64 "} + "ARM64" { "aarch64" } + Default { "unknown" } + } + } + else { + # Not Windows + $arch = switch ($architecture) { + "X64" { "x86_64" } + "Arm64" { "aarch64" } + Default { "unknown" } + } } # Construct the asset name. @@ -59,7 +70,7 @@ function Invoke-InstallScript { # Update the Path Environment Variable if (-not ($targetPath -in $env:PATH)) { - if ($IsWindows) { + if ($osPlatform -eq "win") { $seperator = ";" } else { @@ -68,7 +79,7 @@ function Invoke-InstallScript { $env:PATH = "$($targetPath)$($seperator)$($env:PATH)" - if ($IsWindows) { + if ($osPlatform -eq "win") { # This only works on Windows. [Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User) } @@ -81,7 +92,7 @@ function Invoke-InstallScript { git-lfs-synology login --url $URL --user $User # Get the suffix - if ($IsWindows) { + if ($osPlatform -eq "win") { $suffix = ".exe" } else {