|
1 | | -#!/bin/bash |
2 | | -# Custom binary installer for Amfora (Gemini terminal browser) |
3 | | -# https://github.com/makeworld-the-better-one/amfora |
4 | | - |
5 | | -set -e |
6 | | - |
7 | | -LOG_PREFIX="Amfora - install:" |
8 | | -REPO="makeworld-the-better-one/amfora" |
9 | | -INSTALL_DIR="/usr/local/bin" |
10 | | -BINARY_NAME="amfora" |
11 | | - |
12 | | -# --- Detect architecture --- |
13 | | - |
14 | | -ARCH="$(uname -m)" |
15 | | - |
16 | | -case "$ARCH" in |
17 | | - x86_64) ARCH="amd64" ;; |
18 | | - aarch64) ARCH="arm64" ;; |
19 | | - armv7*) ARCH="arm7" ;; |
20 | | - *) |
21 | | - echo "$LOG_PREFIX Unsupported architecture: $ARCH" |
22 | | - exit 1 |
23 | | - ;; |
24 | | -esac |
25 | | - |
26 | | -# --- Resolve latest release tag --- |
27 | | - |
28 | | -echo "$LOG_PREFIX Fetching latest release from GitHub..." |
29 | | -LATEST_TAG="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \ |
30 | | - | grep '"tag_name"' \ |
31 | | - | sed 's/.*"tag_name": *"\([^"]*\)".*/\1/')" |
32 | | - |
33 | | -if [ -z "$LATEST_TAG" ]; then |
34 | | - echo "$LOG_PREFIX Failed to resolve latest release tag." |
35 | | - exit 1 |
36 | | -fi |
37 | | - |
38 | | -echo "$LOG_PREFIX Latest release: $LATEST_TAG" |
39 | | - |
40 | | -# --- Download --- |
41 | | -# Amfora release assets follow the pattern: amfora_linux_amd64 |
42 | | - |
43 | | -ASSET_NAME="${BINARY_NAME}_linux_${ARCH}" |
44 | | -DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${LATEST_TAG}/${ASSET_NAME}" |
45 | | - |
46 | | -TMP_FILE="$(mktemp)" |
47 | | -echo "$LOG_PREFIX Downloading $DOWNLOAD_URL..." |
48 | | -curl -fsSL "$DOWNLOAD_URL" -o "$TMP_FILE" |
49 | | - |
50 | | -# --- Install binary --- |
51 | | - |
52 | | -echo "$LOG_PREFIX Installing binary to ${INSTALL_DIR}/${BINARY_NAME}..." |
53 | | -chmod +x "$TMP_FILE" |
54 | | -mv "$TMP_FILE" "${INSTALL_DIR}/${BINARY_NAME}" |
55 | | - |
56 | | -echo "$LOG_PREFIX Binary installed: $(command -v "$BINARY_NAME") — $("$BINARY_NAME" --version 2>/dev/null || true)" |
57 | | - |
58 | | -# --- Install desktop entry --- |
59 | | - |
60 | | -DESKTOP_DIR="$HOME/.local/share/applications" |
61 | | -echo "$LOG_PREFIX Installing desktop entry to $DESKTOP_DIR..." |
62 | | -mkdir -p "$DESKTOP_DIR" |
63 | | -curl -fsSL \ |
64 | | - "https://raw.githubusercontent.com/${REPO}/master/amfora.desktop" \ |
65 | | - -o "$DESKTOP_DIR/amfora.desktop" |
66 | | -if command -v update-desktop-database > /dev/null 2>&1; then |
67 | | - update-desktop-database "$DESKTOP_DIR" |
68 | | - echo "$LOG_PREFIX Desktop database updated." |
69 | | -fi |
70 | | - |
71 | | -echo "$LOG_PREFIX Done." |
| 1 | +# Build amfora from source using Go |
| 2 | +git clone https://github.com/makew0rld/amfora /tmp/amfora-build |
| 3 | +cd /tmp/amfora-build |
| 4 | +go build -o amfora . |
| 5 | +sudo mv amfora /usr/local/bin/amfora |
| 6 | +rm -rf /tmp/amfora-build |
0 commit comments