Adds a GET /install.sh endpoint on the backend (embedded via Go's embed package, so the script stays a real, shellcheck-able .sh file rather than a Go string literal). Auto-detects OS/arch (including Termux on Android via $PREFIX) and always resolves the latest GitHub release via the /releases/latest/download/ redirect, so unlike the winget/brew/AUR manifests it needs no per-release maintenance. Verified end-to-end in an ephemeral Ubuntu container (both the normal /usr/local/bin path and the Termux $PREFIX path), and locally against a running backend instance. Documented alongside the existing winget/Homebrew instructions in README.md, the release notes template, the web CLI page, and the per-product CliHandoff card. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.2 KiB
Bash
48 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Installs the msdl CLI. Usage: curl -fsSL https://api.msdl.tech-latest.com/install.sh | bash
|
|
set -euo pipefail
|
|
|
|
REPO="starkSV/windows-iso-downloader"
|
|
|
|
os="$(uname -s)"
|
|
arch="$(uname -m)"
|
|
|
|
case "$os" in
|
|
Linux) platform="linux" ;;
|
|
Darwin) platform="darwin" ;;
|
|
*)
|
|
echo "msdl: unsupported OS: $os (Windows users: winget install starkSV.msdl)" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
case "$arch" in
|
|
x86_64|amd64) goarch="amd64" ;;
|
|
aarch64|arm64) goarch="arm64" ;;
|
|
*)
|
|
echo "msdl: unsupported architecture: $arch" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
asset="msdl-${platform}-${goarch}"
|
|
url="https://github.com/${REPO}/releases/latest/download/${asset}"
|
|
|
|
tmp="$(mktemp)"
|
|
echo "Downloading ${asset}..."
|
|
curl -fsSL "$url" -o "$tmp"
|
|
chmod +x "$tmp"
|
|
|
|
if [ -n "${PREFIX:-}" ] && [ -d "${PREFIX}/bin" ]; then
|
|
# Termux (or similar $PREFIX-based environment) -- no sudo available or needed
|
|
mv "$tmp" "${PREFIX}/bin/msdl"
|
|
echo "Installed to ${PREFIX}/bin/msdl"
|
|
elif [ -w /usr/local/bin ]; then
|
|
mv "$tmp" /usr/local/bin/msdl
|
|
echo "Installed to /usr/local/bin/msdl"
|
|
else
|
|
sudo mv "$tmp" /usr/local/bin/msdl
|
|
echo "Installed to /usr/local/bin/msdl"
|
|
fi
|
|
|
|
echo "Run 'msdl --help' to get started."
|