Skip to content

Add PowerShell script for Windows installation #73

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ TLS.

# Installation

## For Linux/MacOS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update this to be ## For Linux/MacOS/Windows (bash)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README has been updated, but the issue for the powershell cmd persists as noted in [#320](n0-computer/iroh.computer#320). Any recommendations on how to resolve this?

```
cargo install sendme
```

## For windows (Run in Powershell)
```
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/n0-computer/sendme/main/install-sendme.ps1'))
```

# Usage

## Send side
Expand Down
35 changes: 35 additions & 0 deletions install-sendme.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
$repo = "n0-computer/sendme"
$release_url = "https://api.github.com/repos/$repo/releases/latest"

$target = "windows-x86_64"
$zipFile = "sendme.zip"
$extractPath = ".\sendme"

Write-Host "Fetching latest release for $target..."
$releaseJson = Invoke-RestMethod -Uri $release_url
$releaseUrl = ($releaseJson.assets | Where-Object { $_.browser_download_url -match $target }).browser_download_url

if (-not $releaseUrl) {
Write-Host "Error: No release found for $target" -ForegroundColor Red
exit 1
}

Write-Host "Downloading from $releaseUrl..."
Invoke-WebRequest -Uri $releaseUrl -OutFile $zipFile

Write-Host "Extracting..."
Expand-Archive -Path $zipFile -DestinationPath $extractPath -Force

Write-Host "Cleaning up..."
Remove-Item -Force $zipFile

Write-Host "Installation complete!"

# Add the 'sendme' folder to PATH
$sendmePath = (Resolve-Path $extractPath).Path

# Add the folder to the PATH permanently (user level)
$env:Path += ";$sendmePath"
[System.Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User)

Write-Host "'$sendmePath' has been permanently added to user PATH." -ForegroundColor Green
Loading