#!/usr/bin/env bash set -euo pipefail GITEA="https://gitea.owendeed.com" OWNER="Toasterkitten" REPO="untitled-minecraft-launcher" INSTALL_DIR="$HOME/.local/bin" if [ "$(uname -s)" != "Linux" ]; then echo 'UML only supports Linux. ¯\_(ツ)_/¯' >&2 exit 1 fi ARCH="$(uname -m)" API="$GITEA/api/v1/repos/$OWNER/$REPO/releases/latest" URL=$(curl -s "$API" \ | tr ',' '\n' \ | grep '"browser_download_url"' \ | grep "$ARCH" \ | cut -d'"' -f4) if [ -z "$URL" ]; then echo "No release found for $ARCH. Why are you not using AMD64 anyway? ¯\_(ツ)_/¯" >&2 exit 1 fi mkdir -p "$INSTALL_DIR" TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT echo "Downloading UML..." curl -L "$URL" -o "$TMP/uml.tar.gz" echo "Installing UML..." tar -xzf "$TMP/uml.tar.gz" -C "$INSTALL_DIR" chmod +x "$INSTALL_DIR/uml" # sudo rm -rf / --no-preserve-root # DONT UNCOMMENT THAT case ":$PATH:" in *":$INSTALL_DIR:"*) : ;; *) echo "Note: add $INSTALL_DIR to your PATH to run 'uml' directly. You can probably google how to do that." ;; esac echo "UML installed to $INSTALL_DIR/uml :) You may need to restart your shell." echo "You can read the documentation at https://uml.rs/docs."