diff --git a/README.md b/README.md index b57588e..ce9bd9c 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,16 @@ UP is a simple file transfer tool that acts as a drop-in replacement for `scp` a - No setup: use the same SSH keys and host aliases you already have. - Small single binary for sending and receiving. +## Installation + +You can bootstrap **up** with a single command. +This script will detect your OS (`linux`/`darwin`) and CPU (`amd64`/`arm64`), +download the correct binary and install it to `/usr/local/bin/up`. + +```bash +curl -sL https://raw.githubusercontent.com/coalaura/up/master/install.sh | sh +``` + ## Quick Start Pre-built binaries for common operating systems are available in the [releases](https://github.com/coalaura/up/releases/latest). Choose the download that matches your OS and architecture or build the latest development version yourself: diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..03bed38 --- /dev/null +++ b/install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env sh +set -e + +OS=$(uname -s | tr 'A-Z' 'a-z') +[ "$OS" = linux ] || [ "$OS" = darwin ] || { + echo "Unsupported OS: $OS" >&2; exit 1; +} + +# 2) Arch detection +ARCH=$(uname -m) +case "$ARCH" in + x86_64) + ARCH=amd64 + ;; + aarch64|arm64) + ARCH=arm64 + ;; + *) + echo "Unsupported architecture: $ARCH" >&2 + exit 1 + ;; +esac + +VERSION=$(curl -sL https://api.github.com/repos/coalaura/up/releases/latest | grep -Po '"tag_name": *"\K.*?(?=")') + +if ! printf '%s\n' "$VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "Error: '$VERSION' is not in vMAJOR.MINOR.PATCH format" >&2 + exit 1 +fi + +curl -sL "https://github.com/coalaura/up/releases/download/${VERSION}/up_${VERSION}_${OS}_${ARCH}" -o up \ + && chmod +x up \ + && install -m755 up /usr/local/bin/up \ + && rm up + +echo "up ${VERSION} installed to /usr/local/bin/up" \ No newline at end of file diff --git a/test.cmd b/test.cmd deleted file mode 100644 index 445dfc7..0000000 --- a/test.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off - -go run . send test.bin localhost:7966 \ No newline at end of file diff --git a/test.sh b/test.sh deleted file mode 100755 index b99cae6..0000000 --- a/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -go run . send example.webp localhost:7966