-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (49 loc) · 1.57 KB
/
Makefile
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
# ansible
BINDIR ?= $(HOME)/.local/bin
ANSIBLE_PLAYBOOK ?= $(BINDIR)/ansible-playbook
# ansible-playbook
PLAYBOOK_HOSTS ?= localhost
PLAYBOOK_ARGS ?= --inventory=ansible/.ansible/inventory
# GNU Stow
stow_dir ?= $(HOME)/.dotfiles
stow_target ?= $(HOME)
.DEFAULT_GOAL=help
.PHONY: help
help: ## show this help message
@awk -F ':|##' '/^[^\t].+?:.*?##/ {\
printf "\033[36m%-10s\033[0m %s\n", $$1, substr($$0, index($$0,$$3)) \
}' $(MAKEFILE_LIST)
.PHONY: pipx
pipx:
command -v pipx >/dev/null || { \
sudo apt-get update -y && \
sudo apt-get install -y pipx; \
}
.PHONY: ansible
ansible: pipx ## pipx install ansible
command -v ansible >/dev/null || { \
pipx install ansible && \
ln -sf $(HOME)/.local/pipx/venvs/ansible/bin/ansible* $(HOME)/.local/bin/; \
}
.PHONY: jq
jq:
command -v jq >/dev/null || { \
sudo apt-get update -y && \
sudo apt-get install -y jq; \
}
DIFFT_VERSION ?= x86_64-unknown-linux-gnu
.PHONY: difft
difft: jq ## install difft from github releases
command -v difft >/dev/null || { \
curl -s https://api.github.com/repos/Wilfred/difftastic/releases/latest | \
jq -r '.assets[].browser_download_url | select(test("$(DIFFT_VERSION)"))' | \
wget -q -i - && \
tar -xf difft-$(DIFFT_VERSION).tar.gz && \
sudo install -m 755 difft /usr/local/bin/difft && \
rm difft-$(DIFFT_VERSION).tar.gz difft; \
}
.PHONY: install
install: ansible ## install basic stow packages with ansible and stow
$(ANSIBLE_PLAYBOOK) playbook.yaml $(PLAYBOOK_ARGS) \
-e 'playbook_hosts=$(PLAYBOOK_HOSTS)' \
-e 'stow_dir=$(stow_dir)' -e 'stow_target=$(stow_target)'