1
0
mirror of https://github.com/coalaura/up.git synced 2025-07-18 21:53:23 +00:00

install script

This commit is contained in:
Laura
2025-06-21 00:27:10 +02:00
parent 68105ab538
commit 61cbb06574
4 changed files with 46 additions and 6 deletions

36
install.sh Executable file
View File

@ -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"