#!/bin/sh # # Bootstrap entry point. Auto-run by GitHub Codespaces from within the # pre-cloned dotfiles directory; run manually on a fresh macOS machine # after `git clone`. # # On a fresh Mac: ./script/setup set -e REPO="$(cd "$(dirname "$0")/.." && pwd)" cd "$REPO" OS="$(uname -s)" # Ensure stow is available before `make install` calls it. if ! command -v stow >/dev/null 2>&1; then case "$OS" in Darwin) if ! command -v brew >/dev/null 2>&1; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # A fresh Homebrew install does NOT put brew on $PATH in # the current shell — it prints "add this to your profile". # Load brew's environment into this script so the next # `brew install` call actually works. if [ -x /opt/homebrew/bin/brew ]; then eval "$(/opt/homebrew/bin/brew shellenv)" elif [ -x /usr/local/bin/brew ]; then eval "$(/usr/local/bin/brew shellenv)" fi fi brew install stow ;; Linux) if command -v apt-get >/dev/null 2>&1; then sudo apt-get update && sudo apt-get install -y stow else echo "stow is required; please install it for your distro" >&2 exit 1 fi ;; *) echo "Unsupported OS: $OS" >&2 exit 1 ;; esac fi make install # In Codespaces, mark the whole setup finished (Neovim, tree-sitter, plugins). # gh csd (github.com/tarebyte/gh-csd) watches for this and sends a notification. if [ -n "${CODESPACES:-}" ]; then mkdir -p "$HOME/.local/state/gh-csd" touch "$HOME/.local/state/gh-csd/setup-complete" fi