forked from webpro/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (63 loc) · 2.26 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
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
85
SHELL=/bin/bash
BASH=/opt/homebrew/bin/bash
SHELLS=/etc/shells
#SHELL = /bin/zsh
#ZSH=/usr/local/bin/zsh
#SHELLS=/private/etc/shells
DOTFILES_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
OS := $(shell bin/is-supported bin/is-macos macos) #if you want linux support add linux here
PATH := $(DOTFILES_DIR)/bin:$(PATH)
export XDG_CONFIG_HOME := $(HOME)/.config
export STOW_DIR := $(DOTFILES_DIR)
.PHONY: test
all: $(OS)
macos: sudo core-macos packages link #mackup
core-macos: brew-macos change-shell
packages: brew-packages code-packages mas-packages-$(OS)
macos-system: macos-dock macos-system-defaults macos-system-extras
macos-dock:
/bin/bash macos/dock.sh
macos-system-defaults:
/bin/bash macos/defaults.sh
macos-system-extras:
/bin/bash macos/rectangle.sh
stow-macos: brew-macos
is-executable stow || brew install stow
sudo:
ifndef CI
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
endif
link: stow-$(OS)
for FILE in $$(\ls -A runcom); do if [ -f $(HOME)/$$FILE -a ! -h $(HOME)/$$FILE ]; then mv -v $(HOME)/$$FILE{,.bak}; fi; done
mkdir -p $(XDG_CONFIG_HOME)
stow --adopt -t $(HOME) runcom
stow --adopt -t $(XDG_CONFIG_HOME) config
unlink: stow-$(OS)
stow --delete -t $(HOME) runcom
stow --delete -t $(XDG_CONFIG_HOME) config
for FILE in $$(\ls -A runcom); do if [ -f $(HOME)/$$FILE.bak ]; then mv -v $(HOME)/$$FILE.bak $(HOME)/$${FILE%%.bak}; fi; done
brew-macos:
/bin/bash $(DOTFILES_DIR)/install/base.sh
is-executable brew || curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash
change-shell:
echo "BASH $(BASH) $(SHELLS)"
sudo chsh -s $(BASH)
rbenv: brew-$(OS)
is-executable rbenv || brew install rbenv
ruby: LATEST_RUBY=$(shell rbenv install -l | grep -v - | tail -1)
ruby: brew-$(OS) rbenv
rbenv install -s $(LATEST_RUBY)
rbenv global $(LATEST_RUBY)
mas-packages-macos:
/bin/bash $(DOTFILES_DIR)/install/Mas.sh
brew-packages: brew-$(OS)
brew bundle --file=$(DOTFILES_DIR)/install/Brewfile
code-packages: brew-macos
for EXT in $$(cat install/Codefile); do code --install-extension $$EXT; done
mackup: link
# Necessary until [#632](https://github.com/lra/mackup/pull/632) is fixed
ln -s ~/.config/mackup/.mackup.cfg ~
ln -s ~/.config/mackup/.mackup ~
test:
bats test/*.bats