#!/bin/bash # Pull the live machine's state back into this repo - the reverse of install.sh. # # Run it after customizing something by hand, then review `git diff` and commit. # It only refreshes paths the repo already tracks; it never invents new ones, so # adding a newly customized file is a deliberate act (see README, "Adding a file"). # # ./capture.sh # refresh everything # ./capture.sh config # only the named steps # ./capture.sh --list # # Steps: config themes plugins bin services system packages set -uo pipefail REPO="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" STEPS=(config themes plugins bin services system packages) HOST="${OMARCHY_SETUP_HOST:-$(hostname)}" HOST_DIR="$REPO/hosts/$HOST" # The shared config/ and system/ trees were captured from this host. Capturing # them anywhere else would overwrite its customizations with the other machine's # (often stock) files, so elsewhere only the host overlay is refreshed unless # CAPTURE_SHARED=1 says the change really is meant for every machine. SHARED_HOST="${OMARCHY_SETUP_SHARED_HOST:-omarchy-laptop}" CAPTURE_SHARED="${CAPTURE_SHARED:-0}" [[ $HOST == "$SHARED_HOST" ]] && CAPTURE_SHARED=1 c_ch=$'\033[33m'; c_skip=$'\033[2m'; c_warn=$'\033[33m'; c_hd=$'\033[1m'; c_off=$'\033[0m' [[ -t 1 ]] || { c_ch=; c_skip=; c_warn=; c_hd=; c_off=; } say() { printf '%s\n' "$*"; } head_() { printf '\n%s==> %s%s\n' "$c_hd" "$*" "$c_off"; } chg() { printf ' %sM %s%s\n' "$c_ch" "$*" "$c_off"; } skip() { printf ' %s= %s%s\n' "$c_skip" "$*" "$c_off"; } warn() { printf ' %s! %s%s\n' "$c_warn" "$*" "$c_off"; } gone() { printf ' %s? %s%s\n' "$c_warn" "$*" "$c_off"; } # pull_back