diff --git a/README.md b/README.md index bf2eacf..6c58cb7 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,14 @@ appherder automatically installs, removes, and upgrades your AppImages. Throw th ## Installation +### Quick install + +```bash +curl -sSL https://raw.githubusercontent.com/alyraffauf/appherder/main/scripts/install.sh | bash +``` + +This downloads the latest AppImage, installs it, and enables automatic sync and upgrades. + ### Download a binary Grab `appherder-linux-amd64` from the [latest release](https://github.com/alyraffauf/appherder/releases/latest), then: @@ -28,6 +36,19 @@ chmod +x appherder-linux-amd64 sudo mv appherder-linux-amd64 /usr/local/bin/appherder ``` +### AppImage + +Download the `.AppImage` from the [latest release](https://github.com/alyraffauf/appherder/releases/latest), then: + +```bash +chmod +x appherder-*-x86_64.AppImage +./appherder-*-x86_64.AppImage install ./appherder-*-x86_64.AppImage +appherder autosync +appherder autoupgrade +``` + +The install step copies it into `~/AppImages` and links it to `~/.local/bin/appherder` automatically. + ### Nix flake ```bash diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..f5d3c7f --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -eu + +REPO="alyraffauf/appherder" +DEST="$HOME/AppImages" +BIN="$HOME/.local/bin" + +if [ -n "${GH_TOKEN:-}" ]; then + AUTH="Authorization: Bearer $GH_TOKEN" +elif [ -n "${GITHUB_TOKEN:-}" ]; then + AUTH="Authorization: Bearer $GITHUB_TOKEN" +else + AUTH="" +fi + +echo "Fetching latest release..." +if [ -n "$AUTH" ]; then + URL=$(curl -sL -H "$AUTH" "https://api.github.com/repos/$REPO/releases/latest" | + grep -o '"browser_download_url": "[^"]*AppImage"' | + head -1 | cut -d'"' -f4) +else + URL=$(curl -sL "https://api.github.com/repos/$REPO/releases/latest" | + grep -o '"browser_download_url": "[^"]*AppImage"' | + head -1 | cut -d'"' -f4) +fi + +if [ -z "$URL" ]; then + echo "Could not find AppImage asset in latest release" >&2 + exit 1 +fi + +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT +APPIMAGE="$TMP/appherder.AppImage" + +echo "Downloading..." +curl -sLo "$APPIMAGE" "$URL" +chmod +x "$APPIMAGE" + +echo "Installing..." +mkdir -p "$DEST" "$BIN" +"$APPIMAGE" install "$APPIMAGE" + +echo "Enabling background services..." +"$BIN/appherder" autosync +"$BIN/appherder" autoupgrade + +echo +echo "appherder installed. Run 'appherder --help' to get started." +echo "If 'appherder' is not found, re-open your terminal or run:" +echo " export PATH=\"$BIN:\$PATH\"" +echo +echo "Coming from another AppImage manager? Run 'appherder migrate' to adopt" +echo "existing apps in $DEST."