aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-02 12:16:38 -0500
committerCraig Jennings <c@cjennings.net>2026-06-02 12:16:38 -0500
commitb10cba594db836c0747066addad48bda4d30cd02 (patch)
tree063119a623fa3f7139feda4ef302896d8f5f934c /Makefile
parent49c2ba9c4510bf6e1acd306687473bc8ba9ad8dd (diff)
downloadarchsetup-b10cba594db836c0747066addad48bda4d30cd02.tar.gz
archsetup-b10cba594db836c0747066addad48bda4d30cd02.zip
refactor: drop in-repo dotfiles/, move stow tooling to the dotfiles repo
Since the installer clones DOTFILES_REPO into ~/.dotfiles and stows from there, the in-repo dotfiles/ tree was dead weight. Nothing reads it at install time. I removed it (831 files) now that both machines are migrated. The Makefile's stow / restow / reset / unstow / import targets and the dotfile-script unit suites moved to the dotfiles repo. They sit alongside the scripts they manage and run standalone (cd ~/.dotfiles && make ...). This Makefile keeps the VM-integration targets and the installer-helper suite (safe-rm-rf). I updated CLAUDE.md and README.md so stow operations run from ~/.dotfiles, and the dotfile-management, theme, and unit-test sections point at the standalone repo. The README was already describing the old in-repo model from before the installer switched to cloning. This brings it in line.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile167
1 files changed, 18 insertions, 149 deletions
diff --git a/Makefile b/Makefile
index 9945126..30a52d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,169 +1,38 @@
-# Makefile for archsetup dotfiles
-# GNU Stow operations for managing dotfiles
+# Makefile for archsetup
+# VM-based integration testing + project dependencies.
+#
+# Dotfile stow operations live in the dotfiles repo's own Makefile
+# (https://git.cjennings.net/dotfiles.git). Run them from there:
+# cd ~/.dotfiles && make stow|restow|reset|unstow|import <de>
-STOW := stow --target=$(HOME) --no-folding
-DOTFILES := $(shell pwd)/dotfiles
-
-# Extract DE from command line (e.g., 'make stow dwm' -> DE=dwm)
-DE := $(filter dwm hyprland,$(MAKECMDGOALS))
-
-# Extract DEST from command line for import (e.g., 'make import common' -> DEST=common)
-DEST := $(filter common dwm hyprland,$(MAKECMDGOALS))
-
-.PHONY: help deps stow restow reset unstow import test-unit test test-keep test-vm-base common dwm hyprland
+.PHONY: help deps test-unit test test-keep test-vm-base
# Default target - show help
help:
- @echo "Dotfiles Management (GNU Stow)"
- @echo ""
- @echo "Usage: make <target> <de|dest>"
- @echo ""
- @echo "Desktop Environments / Destinations:"
- @echo " common Shared configs (all setups)"
- @echo " dwm X11/DWM specific"
- @echo " hyprland Wayland/Hyprland specific"
+ @echo "archsetup - install and test"
@echo ""
@echo "Targets:"
- @echo " deps Install dependencies for this project"
- @echo " stow Create symlinks (fresh install) - requires DE"
- @echo " restow Refresh symlinks (unlink + relink) - requires DE"
- @echo " reset Resolve conflicts, keep repo version - requires DE"
- @echo " unstow Remove all symlinks - requires DE"
- @echo " import Import new app configs into repo (fzf) - requires dest"
- @echo " test-unit Run fast unit tests for scripts (no VM needed)"
- @echo " test Run full VM test suite (creates base VM if needed)"
- @echo " test-keep Run test and keep VM running for manual testing"
+ @echo " deps Install VM-testing dependencies"
+ @echo " test-unit Run fast unit tests for installer helpers (no VM)"
+ @echo " test Run full VM test suite (creates base VM if needed)"
+ @echo " test-keep Run test and keep VM running for manual testing"
@echo " test-vm-base Create base VM only (runs archangel)"
@echo ""
- @echo "Examples:"
- @echo " make stow dwm # Fresh DWM install (common + dwm)"
- @echo " make stow hyprland # Fresh Hyprland install (common + hyprland)"
- @echo " make restow dwm # Refresh DWM links after git pull"
- @echo " make reset hyprland # Resolve conflicts, keep repo version"
- @echo " make import common # Import configs to common/"
- @echo " make import hyprland # Import configs to hyprland/"
- @echo " make test # Run full VM integration test"
+ @echo "Dotfile stow operations now live in the dotfiles repo:"
+ @echo " cd ~/.dotfiles && make stow|restow|reset|unstow|import <de>"
@echo ""
-# Install project dependencies
+# Install project dependencies (VM integration testing)
deps:
- @echo "Installing project dependencies..."
- @echo ""
- @echo "=== Makefile targets (stow, import) ==="
- sudo pacman -S --needed stow fzf
- @echo ""
- @echo "=== VM testing (make test) ==="
+ @echo "Installing VM testing dependencies..."
sudo pacman -S --needed qemu-full virt-manager virt-viewer libguestfs \
bridge-utils dnsmasq archiso sshpass socat
@echo ""
@echo "Done. For VM testing, also ensure libvirtd is running:"
@echo " sudo systemctl enable --now libvirtd"
-# Prevent 'common', 'dwm' and 'hyprland' from being treated as file targets
-common dwm hyprland:
- @:
-
-# Validate DE was provided (for stow/restow/reset/unstow)
-check-de:
-ifeq ($(DE),)
- @echo "Error: Desktop environment required (dwm or hyprland)."
- @echo ""
- @$(MAKE) --no-print-directory help
- @exit 1
-endif
-
-# Validate DEST was provided (for import)
-check-dest:
-ifeq ($(DEST),)
- @echo "Error: Destination required (common, dwm, or hyprland)."
- @echo ""
- @$(MAKE) --no-print-directory help
- @exit 1
-endif
-
-# Stow - create symlinks
-stow: check-de
- @echo "Stowing common + $(DE)..."
- @cd $(DOTFILES) && $(STOW) common
- @cd $(DOTFILES) && $(STOW) $(DE)
- @echo "Done."
-
-# Restow - refresh symlinks (unlink + relink)
-restow: check-de
- @echo "Restowing common + $(DE)..."
- @output=$$(cd $(DOTFILES) && $(STOW) -n --restow common 2>&1; cd $(DOTFILES) && $(STOW) -n --restow $(DE) 2>&1); \
- conflicts=$$(echo "$$output" | grep "existing target" | sed 's/.*existing target //; s/ since.*//'); \
- if [ -n "$$conflicts" ]; then \
- echo ""; \
- echo "Conflicts found (real files blocking symlinks):"; \
- echo "$$conflicts" | while read -r f; do echo " ~/$$f"; done; \
- echo ""; \
- printf "Overwrite with repo versions? [y/N] "; \
- read -r ans; \
- if [ "$$ans" = "y" ] || [ "$$ans" = "Y" ]; then \
- echo "$$conflicts" | while read -r f; do rm -f "$(HOME)/$$f"; done; \
- cd $(DOTFILES) && $(STOW) --restow common && \
- cd $(DOTFILES) && $(STOW) --restow $(DE); \
- echo "Done."; \
- else \
- echo "Aborted. Resolve manually or use 'make reset $(DE)'."; \
- exit 1; \
- fi; \
- else \
- cd $(DOTFILES) && $(STOW) --restow common && \
- cd $(DOTFILES) && $(STOW) --restow $(DE); \
- echo "Done."; \
- fi
-
-# Reset - resolve conflicts by adopting then reverting to repo version
-reset: check-de
- @echo "Resetting common + $(DE)..."
- @cd $(DOTFILES) && $(STOW) --adopt common
- @cd $(DOTFILES) && $(STOW) --adopt $(DE)
- @echo "Reverting adopted files to repo version..."
- @git checkout -- dotfiles/
- @echo "Done. Symlinks created, repo unchanged."
-
-# Unstow - remove symlinks
-unstow: check-de
- @echo "Unstowing common + $(DE)..."
- @cd $(DOTFILES) && $(STOW) --delete common
- @cd $(DOTFILES) && $(STOW) --delete $(DE)
- @echo "Done."
-
-# Import - select and import new app configs into repo
-import: check-dest
- @echo "Select directories to import (Tab to multi-select, Enter to confirm):"
- @echo ""
- @selections=$$({ \
- find $(HOME) -maxdepth 1 -mindepth 1 -name '.*' -type d 2>/dev/null | grep -v '\.cache\|\.local\|\.config' | sed 's|$(HOME)/||'; \
- find $(HOME)/.config -maxdepth 1 -mindepth 1 -type d 2>/dev/null | sed 's|$(HOME)/||'; \
- find $(HOME)/.local -maxdepth 2 -mindepth 1 -type d 2>/dev/null | sed 's|$(HOME)/||'; \
- } | sort -u | fzf --multi --prompt="Import to $(DEST)> " --header="Select configs to import into dotfiles/$(DEST)/"); \
- if [ -z "$$selections" ]; then \
- echo "No selections made."; \
- exit 0; \
- fi; \
- echo ""; \
- for dir in $$selections; do \
- src="$(HOME)/$$dir"; \
- dest="$(DOTFILES)/$(DEST)/$$dir"; \
- if [ -d "$$dest" ]; then \
- echo "Skipping $$dir (already exists in dotfiles/$(DEST))"; \
- else \
- echo "Importing $$dir to $(DEST)..."; \
- mkdir -p "$$(dirname $$dest)"; \
- mv "$$src" "$$dest"; \
- fi; \
- done; \
- echo ""; \
- echo "Restowing $(DEST)..."; \
- cd $(DOTFILES) && $(STOW) --restow $(DEST); \
- echo ""; \
- echo "Done. Don't forget to: git add -A && git commit"
-
-# Run the fast unit-test suites for individual scripts (no VM needed).
-# One suite per tests/<script>/ dir; `unittest discover` can't find them
+# Run the fast unit-test suites for installer helpers (no VM needed).
+# One suite per tests/<name>/ dir; `unittest discover` can't find them
# because the dir names are hyphenated, so each suite is run explicitly.
test-unit:
@fail=0; \