#!/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. # Each live file goes back into the layer that OWNS it for this machine's # profile (the last layer providing that path; `./install.sh --show` lists # them). It only refreshes paths the repo already tracks, so adding a newly # customized file is a deliberate act (see README, "Adding a file"). # # ./capture.sh # this machine's profile, every step # ./capture.sh --profile hp-laptop # name it explicitly # ./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) c_ch=$'\033[33m'; c_skip=$'\033[2m'; c_warn=$'\033[33m'; c_err=$'\033[31m'; c_hd=$'\033[1m'; c_off=$'\033[0m' [[ -t 1 ]] || { c_ch=; c_skip=; c_warn=; c_err=; 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"; } err() { printf ' %sx %s%s\n' "$c_err" "$*" "$c_off"; } gone() { printf ' %s? %s%s\n' "$c_warn" "$*" "$c_off"; } # shellcheck source=lib/layers.sh source "$REPO/lib/layers.sh" # pull_back