-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
304 lines (258 loc) · 9.92 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
######################################################################
# @author : hg (https://github.com/hghann)
# @file : Makefile
# @created : Wed 7 Jul 11:14:15 2021
#
# @description : Inspired by Gavin Freeborn's video
# (https://www.youtube.com/watch?v=aP8eggU2CaU)
######################################################################
BASE = $(PWD)
SCRIPTS = $(HOME)/.scripts
MKDIR = mkdir -p
LN = ln -vsf
LNDIR = ln -vs
SUDO = sudo
PKGINSTALL = brew install
PROGINSTALL = brew install --cask
nocupshist: ## Disable CUPS pinter job history on macOS
# purges /var/spool/cups
cancel -a -x
# create /usr/local/sbin director
sudo mkdir -p /usr/local/sbin
sudo chown ${USER}:admin /usr/local/sbin
# create cups.sh script
$(SUDO) cp $(PWD)/usr/local/sbin/cups.sh /usr/local/sbin/cups.sh
/usr/local/sbin/cups.sh
# make cups.sh executable
chmod +x /usr/local/sbin/cups.sh
# create local.cups.plist launch daemon
$(PWD)/.local/bin/nocupshistd
# reboot
scripts:
make -s $(HOME)/.local/bin/scripts
$(HOME)/.local/bin/scripts:
@test -d $(SCRIPTS) || git clone [email protected]:hghann/scripts.git $(SCRIPTS)
updatescripts:
cd $(HOME)/.local/bin/scripts;\
git pull
pass:
git clone [email protected]:hghann/pass.git $(HOME)/.local/share/password-store
bookmarks:
git clone [email protected]:hghann/bookmarks.git $(HOME)/.local/share/buku
startpage:
git clone [email protected]:hghann/startpage.git $(HOME)/.local/share/startpage
vim: ## Init vim
# requires vim
git clone [email protected]:hghann/dotvim $(HOME)/.vim
cd $(HOME)/.vim && make -f $(HOME)/.vim/Makefile
vimpush: ## Updates vim repo
cd $(HOME)/.vim;\
git pull;\
git add .;\
git commit -m "push via Makefile";\
git push -u origin master
vimpull: ## Updates local vim config
cd $(HOME)/.vim;\
git pull
amethyst: ## Deploy window manager configs
$(LN) $(PWD)/.config/amethyst/com.amethyst.Amethyst.plist $(HOME)/Library/Preferences/com.amethyst.Amethyst.plist
init: amethyst ## Inital deploy dotfiles on osx machine
$(LN) $(PWD)/.bash_profile $(HOME)/.bash_profile
$(LN) $(PWD)/.bashrc $(HOME)/.bashrc
$(LN) $(PWD)/.profile $(HOME)/.profile
$(LN) $(PWD)/.zshenv $(HOME)/.zshenv
rm -rf $(HOME)/.config/zsh
$(LNDIR) $(PWD)/.config/zsh $(HOME)/.config/zsh
rm -rf $(HOME)/.config/brew
$(LNDIR) $(PWD)/.config/brew $(HOME)/.config/brew
rm -rf $(HOME)/.config/alacritty
$(LNDIR) $(PWD)/.config/alacritty $(HOME)/.config/alacritty
rm -rf $(HOME)/.config/lf
$(LNDIR) $(PWD)/.config/lf $(HOME)/.config/lf
rm -rf $(HOME)/.config/nvim
$(LNDIR) $(PWD)/.config/nvim $(HOME)/.config/nvim
rm -rf $(HOME)/.config/helix
$(LNDIR) $(PWD)/.config/helix $(HOME)/.config/helix
rm -rf $(HOME)/.config/emacs
$(LNDIR) $(PWD)/.config/emacs $(HOME)/.config/emacs
rm -rf $(HOME)/.config/sc-im
$(LNDIR) $(PWD)/.config/sc-im $(HOME)/.config/sc-im
rm -rf $(HOME)/.config/mpv
$(LNDIR) $(PWD)/.config/mpv $(HOME)/.config/mpv
rm -rf $(HOME)/.config/mpd
$(LNDIR) $(PWD)/.config/mpd $(HOME)/.config/mpd
rm -rf $(HOME)/.config/ncmpcpp
$(LNDIR) $(PWD)/.config/ncmpcpp $(HOME)/.config/ncmpcpp
rm -rf $(HOME)/.config/newsboat
$(LNDIR) $(PWD)/.config/newsboat $(HOME)/.config/newsboat
rm -rf $(HOME)/.config/startpage
$(LNDIR) $(PWD)/.config/startpage $(HOME)/.config/startpage
rm -rf $(HOME)/.config/htop
$(LNDIR) $(PWD)/.config/htop $(HOME)/.config/htop
rm -rf $(HOME)/.config/btop
$(LNDIR) $(PWD)/.config/btop $(HOME)/.config/btop
rm -rf $(HOME)/.config/neofetch
$(LNDIR) $(PWD)/.config/neofetch $(HOME)/.config/neofetch
rm -rf $(HOME)/.config/gtk-3.0
$(LNDIR) $(PWD)/.config/gtk-3.0 $(HOME)/.config/gtk-3.0
rm -rf $(HOME)/.config/wget
$(LNDIR) $(PWD)/.config/wget $(HOME)/.config/wget
rm -rf $(HOME)/.config/zathura
$(LNDIR) $(PWD)/.config/zathura $(HOME)/.config/zathura
$(LN) $(PWD)/.config/starship.toml $(HOME)/.config/starship.toml
rm -rf $(HOME)/.config/bat
$(LNDIR) $(PWD)/.config/bat $(HOME)/.config/bat
rm -rf $(HOME)/.config/amethyst
$(LNDIR) $(PWD)/.config/amethyst $(HOME)/.config/amethyst
rm -rf $(HOME)/.qutebrowser
$(LNDIR) $(PWD)/.config/qutebrowser $(HOME)/.qutebrowser
rm -rf $(HOME)/.local/bin
$(LNDIR) $(PWD)/.local/bin $(HOME)/.local/bin
rm -rf $(HOME)/.local/share/groff
$(LNDIR) $(PWD)/.local/share/groff $(HOME)/.local/share/groff
shell: ## Setup shell and prompt
$(LN) $(PWD)/.bash_profile $(HOME)/.bash_profile
$(LN) $(PWD)/.bashrc $(HOME)/.bashrc
$(LN) $(PWD)/.profile $(HOME)/.profile
$(LN) $(PWD)/.zshenv $(HOME)/.zshenv
rm -rf $(HOME)/.config/zsh
$(LNDIR) $(PWD)/.config/zsh $(HOME)/.config/zsh
alacritty: ## Deploy Alacritty configs
$(MKDIR) $(HOME)/.config/alacritty
$(LN) $(PWD)/.config/alacritty/alacritty.yml $(HOME)/.config/alacritty/alacritty.yml
lf: ## Deploy lf configs
$(MKDIR) $(HOME)/.config/lf
$(LN) $(PWD)/.config/lf/cleaner $(HOME)/.config/lf/cleaner
$(LN) $(PWD)/.config/lf/lfrc $(HOME)/.config/lf/lfrc
$(LN) $(PWD)/.config/lf/preview $(HOME)/.config/lf/preview
mpv: ## Deploy mpv configs
$(MKDIR) $(HOME)/.config/mpv
$(LN) $(PWD)/.config/mpv/input.conf $(HOME)/.config/mpv/input.conf
$(LN) $(PWD)/.config/mpv/mpv.conf $(HOME)/.config/mpv/mpv.conf
mpd: ## Deploy mpd configs
$(MKDIR) $(HOME)/.config/mpd
touch $(HOME)/.config/mpd/{mpd.db,mpd.log,mpd.pid,mpdstate}
$(LN) $(PWD)/.config/mpd/mpd.conf $(HOME)/.config/mpd/mpd.conf
ncmpcpp: mpd ## Deploy ncmpcpp configs
$(MKDIR) $(HOME)/.config/ncmpcpp
$(LN) $(PWD)/.config/ncmpcpp/config $(HOME)/.config/ncmpcpp/config
duti: ## Setup default applications
$(PKGINSTALL) duti; $(PROGINSTALL) skim;\
defaults-xdg.sh
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
TMPDIR = $(PWD)/tmp
DESTDIR = ?
PASSEMAIL = [email protected]
doas: ## Install and configure doas
xcode-select --install
$(MKDIR) $(TMPDIR)
git clone https://github.com/slicer69/doas.git $(TMPDIR)/$<
cd $(TMPDIR)/$<
gmake
gmake install
cp /etc/pam.d/sudo /etc/pam.d/doas
rm -rf $(TMPDIR)
sudo echo "permit persist keepenv $(USER) as root" >> /usr/local/etc/doas.conf
# Please also note that macOS systems have been reported to have their /usr
# and/or /usr/local directories set to be writable to regular user accounts
# when homebrew is installed. If this is the case, fix this before installing
# doas. Having these directories, like /usr/local/bin and /usr/local/etc,
# writable to your user means anyone can remove and replace your doas.conf file
# or the doas binary, allowing anyone or any program to run commands as root on
# your system or harvest your password. This is a large security hole and
# outside the scope of doas.
mutt: ## Init neomutt using mutt-wizard by Luke smith
$(PROGINSTALL) neomutt isync msmtp pass gpg
$(MKDIR) $(TMPDIR)
git clone https://github.com/hghann/mutt-wizard.git $(TMPDIR)/$<
cd $(TMPDIR)/$<
make install
gpg --full-gen-key
pass init $(PASSEMAIL)
rm -rf $(TMPDIR)
jot: ## Install jot - a markdown style preprocessor for groff
$(MKDIR) $(TMPDIR)
git clone https://gitlab.com/rvs314/jot.git $(TMPDIR)/$<
rm -rf $(TMPDIR)
# grap can be found here: https://www.lunabase.org/~faber/Vault/software/grap/
# and here: https://github.com/snorerot13/grap
grap: ## Install grap - a groff preprocessor for drawing graphs
$(MKDIR) $(TMPDIR)
git clone https://github.com/snorerot13/grap.git $(TMPDIR)/$<
rm -rf $(TMPDIR)
walk: ## Installs plan9 find SUDO NEEDED
$(MKDIR) $(TMPDIR)
git clone https://github.com/google/walk.git $(TMPDIR)/walk
cd $(TMPDIR)/walk && make
$(MKDIR) $(DESTDIR)$(PREFIX)/bin
# installing walk
cp -f $(TMPDIR)/walk/walk $(DESTDIR)$PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/walk
cp -f $(TMPDIR)/walk/walk.1 $(DESTDIR)$(MANPREFIX)/man1/walk.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/walk.1
# installing sor
cp -f $(TMPDIR)/walk/sor $(DESTDIR)$PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/sor
cp -f $(TMPDIR)/walk/sor.1 $(DESTDIR)$(MANPREFIX)/man1/sor.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sor.1
pkg_base: ## Install base packages plus doas because sudo is bloat
$(PKGINSTALL) coreutils cmake groff grap bat ffmpeg gcc fzf gnupg exa \
exiftool figlet htop btop imagemagick lf make mas neofetch neovim \
newsboat pandoc pass pfetch sc-im speedtest-cli smartmontools \
trash-cli wifi-password wget xpdf yt-dlp zsh-autosuggestions \
zsh-syntax-highlighting m4 make duti
prog_base: ## Install base programs
$(PROGINSTALL) keepassxc lulu alacritty amethyst librewolf cryptomator \
mactex hiddenbar keepingyouawake macfuse mpv qutebrowser rectangle \
skim signal veracrypt vmware-horizon-client monitorcontrol
base: ## Install base system
xcode-select --install
pkg_base prog_base
macos: ## Apply macOS system defaults
$(PWD)/.local/bin/macOS.sh
dock: ## Apply macOS dock settings
$(PWD)/.local/bin/dock.sh
install: ## Install macOS packages using brew
xargs $(PKGINSTALL) < $(PWD)/pkg/brewlist
backup: ## Backup macOS packages using brew
$(MKDIR) $(PWD)/pkg
brew list -1 --full-name > $(PWD)/pkg/brewlist
update: ## Update system and packages, and save packages cache
sudo softwareupdate -i -a;\
brew update -v;\
brew upgrade -v --display-times;\
cd $(HOME)/.config/brew;\
brew bundle -v;\
brew cu -afyv;\
cd; brew doctor -v
syncdots: ## Push changes to git repo
git pull;\
git add .;\
git commit -m "minor edits";\
git push -u origin master
#pip: ## Install python packages
# pip install --user --upgrade pip
# pip install --user 'python-language-server[all]'
pipbackup: ## Backup python packages
$(MKDIR) $(PWD)/pkg
pip freeze > $(PWD)/pkg/piplist
pipupdate: ## Update python packages
pip list --user | cut -d" " -f 1 | tail -n +3 | xargs pip install -U --user
testpath: ## echo $PATH
PATH=$$PATH
@echo $$PATH
echo $(PWD)
PWD=$(PWD)
echo $(HOME)
HOME=$(HOME)
osxinstall: base init doas sudo suspend scripts vim vm duti
allinstall: base init
allupdate: update vimupdate scriptsupdate
allbackup: backup
.DEFAULT_GOAL := help
.PHONY: allinstall allupdate allbackup
help: ## Prints out Make help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'