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 sendme.sh to support Windows operating system #86

Closed
neuralpain opened this issue Mar 23, 2025 · 2 comments
Closed

Update sendme.sh to support Windows operating system #86

neuralpain opened this issue Mar 23, 2025 · 2 comments

Comments

@neuralpain
Copy link

neuralpain commented Mar 23, 2025

I wasn't satisfied with the one-liner PowerShell code I shared in issue #84, so I attempted to update the main install script at iroh.computer/sendme.sh. The code below is the proposed update which was tested using Git Bash (MINGW64). Another test can be done before officially updating.

#!/bin/sh
# Copyright 2023 n0. All rights reserved. Dual MIT/Apache license.
# Windows support provided by neuralpain.

set -e

repo="n0-computer/sendme"
release_url="https://api.github.com/repos/$repo/releases/latest"

if [ "$OS" = "Windows_NT" ]; then
  target="windows-x86_64"
else
  case $(uname -sm) in
  "Darwin x86_64") target="darwin-x86_64" ;;
  "Darwin arm64") target="darwin-aarch64" ;;
  "Linux x86_64") target="linux-x86_64" ;;
  "Linux arm64" | "Linux aarch64") target="linux-aarch64" ;;
  *) target="linux-x86_64" ;;
  esac
fi

echo "Downloading $repo for $target"
release_target_url=$(
  curl -s "$release_url" |
    grep "browser_download_url" |
    grep "$target" |
    sed -re 's/.*: "([^"]+)".*/\1/'
)

if [[ "$release_target_url" =~ \.zip$ ]]; then
  release_name=$(
    curl -s "$release_url" |
      grep "name" |
      grep "$target" |
      sed -re 's/.*: "([^"]+)".*/\1/'
  )
  curl -sL "$release_target_url" -O | unzip -oq $release_name
else
  curl -sL "$release_target_url" | tar xz
fi
@n0bot n0bot bot added this to iroh Mar 23, 2025
@neuralpain
Copy link
Author

neuralpain commented Mar 23, 2025

I wasn't satisfied with the one-liner PowerShell code I shared...

This does not mean that the PowerShell code is obsolete. Not every Windows OS is set up with a Unix-like shell environment by default; and for that reason the PowerShell one-liner would be the preferred method of installation. However, I'd like to think of this as added versatility for the more capable power users out there.

if [[ "$release_target_url" =~ \.zip$ ]]

Since the Windows release is the only package which uses a .zip extension, this shouldn't cause any issues during installation.

@neuralpain
Copy link
Author

Disregard for now; I'll push an update via PR. I'm running a couple more tests.

@github-project-automation github-project-automation bot moved this to ✅ Done in iroh Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant