diff --git a/CHANGELOG.md b/CHANGELOG.md index 97012a0..811a980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ > Breaking: this release removes all code and documentation that belongs to the cortex product. This repo is now exclusively dotfiles — configuration files, installer, and shell aliases. +- `curl -fsSL https://raw.githubusercontent.com/barbatdev/cortex-dots/v0.2.0/install.sh | bash` installs from this release. + ### Breaking - Removed `docs/` — agent-state spec, workflow docs, keymaps, release checklist (belong to cortex product). diff --git a/README.md b/README.md index 79a749c..7ca5bb2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,20 @@ The repo is intentionally generic. Private paths, tokens, emails, hostnames, pro ## Install +Install latest release: + +```bash +curl -fsSL https://raw.githubusercontent.com/barbatdev/cortex-dots/v0.2.0/install.sh | bash +``` + +Install a specific version: + +```bash +curl -fsSL https://raw.githubusercontent.com/barbatdev/cortex-dots/v0.1.1/install.sh | bash +``` + +Install from source (manual): + ```bash git clone ~/.cortex/cortex-dots cd ~/.cortex/cortex-dots diff --git a/install.sh b/install.sh index 046ec35..d953024 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,37 @@ # install.sh — Instalador de dotfiles set -e -DOTFILES="$(cd "$(dirname "$0")" && pwd)" +# If running via curl pipe (stdin), download to temp dir from the repo. +# Usage: curl -fsSL https://raw.githubusercontent.com/barbatdev/cortex-dots/v0.2.0/install.sh | bash +if [ -t 0 ]; then + DOTFILES="$(cd "$(dirname "$0")" && pwd)" +else + # Running from stdin — download the repo to a temp dir. + # Allow overriding the release tag via CORTEX_DOTS_TAG env var. + REPO_ORG="barbatdev" + REPO_NAME="cortex-dots" + TAG="${CORTEX_DOTS_TAG:-main}" + TMPDIR_INSTALL="$(mktemp -d)" + trap 'rm -rf "$TMPDIR_INSTALL"' EXIT INT TERM + DOTFILES="$TMPDIR_INSTALL/$REPO_NAME" + curl -fsSL "https://github.com/${REPO_ORG}/${REPO_NAME}/archive/refs/tags/${TAG}.tar.gz" -o "$TMPDIR_INSTALL/release.tar.gz" || { + echo "ERROR: could not download release $TAG from GitHub" >&2 + exit 1 + } + tar -xzf "$TMPDIR_INSTALL/release.tar.gz" -C "$TMPDIR_INSTALL" || { + echo "ERROR: failed to extract release $TAG" >&2 + exit 1 + } + # The tarball extracts as $REPO_NAME-$TAG/, rename to clean path + EXTRACTED_DIR="$TMPDIR_INSTALL/${REPO_NAME}-${TAG}" + if [ -d "$EXTRACTED_DIR" ]; then + mv "$EXTRACTED_DIR" "$DOTFILES" + fi + if [ ! -f "$DOTFILES/install.sh" ]; then + echo "ERROR: release $TAG does not contain install.sh" >&2 + exit 1 + fi +fi TIMESTAMP=$(date +%Y%m%d_%H%M%S) DRY_RUN=false CHECK_MODE=false @@ -479,7 +509,7 @@ release_ghostty_pending_lock() { GHOSTTY_PENDING_LOCK_HELD=false } -trap 'release_ghostty_pending_lock' EXIT +trap 'release_ghostty_pending_lock; rm -rf "${TMPDIR_INSTALL:-}"' EXIT defer_ghostty_target() { local src="$1"