Skip to content

Commit

Permalink
install: curl|bash script to make install easier
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Apr 24, 2024
1 parent fe08463 commit 9b314d5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
#
# This script installs the latest version into /usr/local/bin or TARGET if specified
#
set -eo pipefail

username="tractordev"
repo="wanix"
binpath="${TARGET:-/usr/local/bin}"

repoURL="https://github.com/${username}/${repo}"
releaseURL="$(curl -sI ${repoURL}/releases/latest | grep 'location:' | awk '{print $2}')"
version="$(basename $releaseURL | cut -c 2- | tr -d '\r')"

os=""
arch=""

# Detect operating system
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
os="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
os="darwin"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
# WSL uses msys or cygwin as OSTYPE
os="windows"
else
echo "Unsupported operating system"
exit 1
fi

# Detect architecture
if [[ "$(uname -m)" == "x86_64" ]]; then
arch="amd64"
elif [[ "$(uname -m)" == "arm64" ]]; then
arch="arm64"
else
echo "Unsupported architecture"
exit 1
fi

filename="${repo}_${version}_${os}_${arch}.zip"

curl -sSLO "${repoURL}/releases/download/v${version}/${filename}"
unzip $filename wanix -d $binpath
rm $filename

0 comments on commit 9b314d5

Please sign in to comment.