Skip to content

Commit 4af25cf

Browse files
authored
feat: add Windows support to sendme.sh (#317)
* Add Windows support for `sendme.sh` This support is for users who have access to a terminal which supports running shell scripts. * Add missing backslash
1 parent 4f89efd commit 4af25cf

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

public/sendme.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/sh
22
# Copyright 2023 n0. All rights reserved. Dual MIT/Apache license.
3+
# Windows support provided by neuralpain.
34

45
set -e
56

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

910
if [ "$OS" = "Windows_NT" ]; then
10-
echo "Error: this installer only works on linux & macOS." 1>&2
11-
exit 1
11+
target="windows-x86_64"
1212
else
1313
case $(uname -sm) in
1414
"Darwin x86_64") target="darwin-x86_64" ;;
@@ -27,4 +27,16 @@ release_target_url=$(
2727
sed -re 's/.*: "([^"]+)".*/\1/' \
2828
)
2929

30-
curl -sL "$release_target_url" | tar xz
30+
if [[ "$release_target_url" =~ \.zip$ ]]; then
31+
release_archive=$(
32+
curl -s "$release_url" |
33+
grep "name" |
34+
grep "$target" |
35+
sed -re 's/.*: "([^"]+)".*/\1/' \
36+
)
37+
curl -sL "$release_target_url" -o $release_archive
38+
unzip -oq $release_archive
39+
rm -rf $release_archive
40+
else
41+
curl -sL "$release_target_url" | tar xz
42+
fi

0 commit comments

Comments
 (0)