-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (78 loc) · 3.27 KB
/
Copy pathMakefile
File metadata and controls
84 lines (78 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.PHONY: help install uninstall brew test
DOTFILES := $(shell pwd)
HOME_FILES := .zshrc .vimrc .gitconfig .gitignore
help:
@echo "Available targets:"
@echo " install Symlink dotfiles into \$$HOME, then brew bundle (packages + apps)"
@echo " uninstall Remove dotfile symlinks from \$$HOME"
@echo " brew Install dependencies from Brewfile"
@echo " test Lint shell files with shellcheck"
install:
@for f in $(HOME_FILES); do \
if [ -e "$$HOME/$$f" ] && [ ! -L "$$HOME/$$f" ]; then \
echo "skip $$f (exists, not a symlink) — back it up and rerun"; \
else \
ln -sfn "$(DOTFILES)/$$f" "$$HOME/$$f" && echo "link $$f"; \
fi; \
done
@mkdir -p "$$HOME/.config/coc"
@ln -sfn "$(DOTFILES)/coc-settings.json" "$$HOME/.config/coc/coc-settings.json" && echo "link coc-settings.json"
@mkdir -p "$$HOME/.config/zed"
@if [ -e "$$HOME/.config/zed/settings.json" ] && [ ! -L "$$HOME/.config/zed/settings.json" ]; then \
echo "skip zed/settings.json (exists, not a symlink) — move it into $(DOTFILES)/zed/, then rerun"; \
else \
ln -sfn "$(DOTFILES)/zed/settings.json" "$$HOME/.config/zed/settings.json" && echo "link zed/settings.json"; \
fi
@mkdir -p "$$HOME/.ssh" && chmod 700 "$$HOME/.ssh"
@if [ -e "$$HOME/.ssh/config" ] && [ ! -L "$$HOME/.ssh/config" ]; then \
echo "skip .ssh/config (exists, not a symlink) — fold hosts into ~/.ssh/config.local, then rerun"; \
else \
ln -sfn "$(DOTFILES)/.ssh/config" "$$HOME/.ssh/config" && echo "link .ssh/config"; \
fi
@mkdir -p "$$HOME/.claude"
@for f in CLAUDE.md settings.json; do \
if [ -e "$$HOME/.claude/$$f" ] && [ ! -L "$$HOME/.claude/$$f" ]; then \
echo "skip .claude/$$f (exists, not a symlink) — back it up and rerun"; \
else \
ln -sfn "$(DOTFILES)/.claude/$$f" "$$HOME/.claude/$$f" && echo "link .claude/$$f"; \
fi; \
done
@if [ -e "$$HOME/.claude/skills" ] && [ ! -L "$$HOME/.claude/skills" ]; then \
echo "skip .claude/skills (exists, not a symlink) — move contents into $(DOTFILES)/.claude/skills, then rerun"; \
else \
ln -sfn "$(DOTFILES)/.claude/skills" "$$HOME/.claude/skills" && echo "link .claude/skills"; \
fi
@defaults write -g InitialKeyRepeat -int 15 && echo "set InitialKeyRepeat=15 (log out + back in to apply)"
@if command -v brew >/dev/null 2>&1; then \
echo "brew bundle (check + install packages and apps)"; \
brew bundle --file="$(DOTFILES)/Brewfile"; \
else \
echo "skip brew bundle (Homebrew not installed — see https://brew.sh)"; \
fi
uninstall:
@for f in $(HOME_FILES); do \
if [ -L "$$HOME/$$f" ]; then \
rm "$$HOME/$$f" && echo "unlink $$f"; \
fi; \
done
@if [ -L "$$HOME/.config/coc/coc-settings.json" ]; then \
rm "$$HOME/.config/coc/coc-settings.json" && echo "unlink coc-settings.json"; \
fi
@if [ -L "$$HOME/.config/zed/settings.json" ]; then \
rm "$$HOME/.config/zed/settings.json" && echo "unlink zed/settings.json"; \
fi
@if [ -L "$$HOME/.ssh/config" ]; then \
rm "$$HOME/.ssh/config" && echo "unlink .ssh/config"; \
fi
@for f in CLAUDE.md settings.json; do \
if [ -L "$$HOME/.claude/$$f" ]; then \
rm "$$HOME/.claude/$$f" && echo "unlink .claude/$$f"; \
fi; \
done
@if [ -L "$$HOME/.claude/skills" ]; then \
rm "$$HOME/.claude/skills" && echo "unlink .claude/skills"; \
fi
brew:
brew bundle --file=Brewfile
test:
shellcheck scripts/*.sh