Capture omarchy-air's customizations as a per-host overlay
hosts/<hostname>/{config,system}/ now overlays the shared trees. install.sh
installs a host file in place of the shared copy at the same path, and
capture.sh pulls back into whichever copy the host installs from. That keeps
hardware-specific files off the wrong machine: the HP's EDID-named monitors.lua
and its fnmode=2 would otherwise land on the Air.
capture.sh refreshes the shared trees only on omarchy-laptop, where they were
captured, or when CAPTURE_SHARED=1 is set. On the Air, a plain run copied its
stock terminal, hypr and shell files over every one of the HP's customizations.
air's overlay holds monitors.lua (1.33333 scale and GDK_SCALE=1 for the
2560x1664 panel), input.lua (stock settings plus the inert-accel measurements),
herdr onboarding=false, git identity and credential helpers (no secrets),
mimeapps.list, and the Asahi installer's hid_apple fnmode=1 and show_notch=1.
bindings.lua is not overlaid because the shared one is a strict superset.
hosts/omarchy-air/README.md records what was left out on purpose and why, and
warns that the shared packages.txt is x86-specific.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KKPyqMc7MGKyBLKVdeDejp
This commit is contained in:
+33
-8
@@ -15,6 +15,15 @@ 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=; }
|
||||
@@ -32,13 +41,29 @@ pull_back() {
|
||||
if cmp -s "$live" "$dest"; then skip "$label"; else cp "$live" "$dest"; chg "$label"; fi
|
||||
}
|
||||
|
||||
# layered <tree> -- NUL-separated "<repo-copy>\t<rel>" across the shared tree and
|
||||
# this host's overlay, the overlay copy winning, so a live file is pulled back into
|
||||
# whichever copy this host actually installs from (see install.sh).
|
||||
layered() {
|
||||
local tree=$1 f rel
|
||||
declare -A pick=()
|
||||
for base in "$REPO/$tree" "$HOST_DIR/$tree"; do
|
||||
[[ -d $base ]] || continue
|
||||
while IFS= read -r -d '' f; do
|
||||
rel=${f#"$base/"}; pick[$rel]=$f
|
||||
done < <(find "$base" -type f -print0)
|
||||
done
|
||||
for rel in "${!pick[@]}"; do printf '%s\t%s\0' "${pick[$rel]}" "$rel"; done | sort -z -t$'\t' -k2
|
||||
}
|
||||
|
||||
step_config() {
|
||||
head_ "~/.config -> config/"
|
||||
head_ "~/.config -> config/ (+ hosts/$HOST/config)"
|
||||
local dest rel
|
||||
while IFS= read -r -d '' dest; do
|
||||
rel=${dest#"$REPO/config/"}
|
||||
pull_back "$HOME/.config/$rel" "$dest" "$rel"
|
||||
done < <(find "$REPO/config" -type f -print0 | sort -z)
|
||||
while IFS=$'\t' read -r -d '' dest rel; do
|
||||
local tag=$rel; [[ $dest == "$HOST_DIR"/* ]] && tag="$rel (hosts/$HOST)"
|
||||
if [[ $dest != "$HOST_DIR"/* ]] && (( ! CAPTURE_SHARED )); then skip "$rel (shared; not on $SHARED_HOST)"; continue; fi
|
||||
pull_back "$HOME/.config/$rel" "$dest" "$tag"
|
||||
done < <(layered config)
|
||||
}
|
||||
|
||||
step_themes() {
|
||||
@@ -135,10 +160,10 @@ step_services() {
|
||||
step_system() {
|
||||
head_ "/etc drop-ins"
|
||||
local dest rel
|
||||
while IFS= read -r -d '' dest; do
|
||||
rel=${dest#"$REPO/system/"}
|
||||
while IFS=$'\t' read -r -d '' dest rel; do
|
||||
if [[ $dest != "$HOST_DIR"/* ]] && (( ! CAPTURE_SHARED )); then skip "/etc/$rel (shared; not on $SHARED_HOST)"; continue; fi
|
||||
pull_back "/etc/$rel" "$dest" "/etc/$rel"
|
||||
done < <(find "$REPO/system" -type f -print0 | sort -z)
|
||||
done < <(layered system)
|
||||
}
|
||||
|
||||
# Report drift in the package delta without rewriting the hand-annotated file:
|
||||
|
||||
Reference in New Issue
Block a user