diff options
| -rw-r--r-- | .github/copilot-instructions.md | 2 | ||||
| -rw-r--r-- | justfile | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 2d6c709..20573d0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -21,7 +21,7 @@ The repo root is a chezmoi source directory. Files targeting `$HOME` use chezmoi - `bootstrap.sh` at the repo root is a POSIX shell script that takes a fresh minimal Arch install (only `base`) to a fully deployed state. It installs prerequisites, enables `%wheel` sudoers, bootstraps `paru-bin` from the AUR, clones the repo, runs `just init`, and optionally invokes `create-efi`. Designed to be curlable: `curl -fsSL .../bootstrap.sh | sh`. - `.chezmoiignore` excludes non-home files (`etc/`, `meta/`, `systemd-units/`, `firefox/`, docs) from deployment to `$HOME`. - `.githooks/` contains git hooks (notably `post-commit` which runs `chezmoi apply`). Activated by `just init`. -- `justfile` provides recipes: `init` (first-time setup), `sync` (apply + fix), `apply`, `fix`, `status`, `pkg-drift`, `dotfile-drift`, `undeclared`, `diff`, `merge`, `groups`, `install`, `install-all`, `add`, `remove`, `services`, `services-enable`, `services-drift`, `etc-drift`, `etc-diff`, `etc-upstream-diff`, `etc-add`, `etc-reset`. Run `just` or `just --list` to see them. +- `justfile` provides recipes: `init` (first-time setup), `sync` (apply + fix), `apply`, `fix`, `status`, `pkg-drift`, `dotfile-drift`, `undeclared`, `diff`, `merge`, `groups`, `install`, `install-all`, `add`, `remove`, `services`, `services-enable`, `services-drift`, `etc-drift`, `etc-diff`, `etc-upstream-diff`, `etc-add`, `etc-rm`, `etc-reset`. Run `just` or `just --list` to see them. ## Window manager @@ -334,6 +334,29 @@ etc-add +paths: echo echo "Run 'chezmoi apply' to sync (no-op content-wise, refreshes deploy hash)." +# Remove one or more files from the repo's etc/ tree (leaves live /etc untouched) +etc-rm +paths: + #!/usr/bin/env bash + set -eo pipefail + for raw in {{ paths }}; do + case "$raw" in + *..*|*/./*|./*|../*) echo "error: unsafe path: $raw" >&2; exit 1 ;; + esac + p=${raw#/}; p=${p#etc/} + repo=etc/$p + [ -f "$repo" ] || { echo "error: $repo is not managed in the repo" >&2; exit 1; } + rm -- "$repo" + # Tidy empty parent dirs inside etc/ without walking out of it + parent=$(dirname "$repo") + while [ "$parent" != "etc" ] && [ "$parent" != "." ]; do + rmdir -- "$parent" 2>/dev/null || break + parent=$(dirname "$parent") + done + echo "removed: $repo (/etc/$p left untouched)" + done + echo + echo "Run 'just apply' to refresh the deploy-etc hash." + # Reset repo-managed etc/<path> to pristine pacman contents (run 'just apply' afterward) etc-reset +paths: #!/usr/bin/env bash |
