-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoundations.mk
More file actions
54 lines (42 loc) · 989 Bytes
/
foundations.mk
File metadata and controls
54 lines (42 loc) · 989 Bytes
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
.PHONY: dirs
RED := $(shell printf '\033[0;31m')
GREEN := $(shell printf '\033[0;32m')
YELLOW := $(shell printf '\033[0;33m')
BLUE := $(shell printf '\033[0;34m')
CYAN := $(shell printf '\033[0;36m')
RESET := $(shell printf '\033[0m')
define sctl
/etc/systemd/system/multi-user.target.wants/$(1).service
endef
define bin
$(foreach arg,$(1),/usr/bin/$(arg))
endef
dirs: $(DIRS)
root_dirs: $(ROOT_DIRS)
$(DIRS):
mkdir -p $@
$(ROOT_DIRS):
sudo mkdir -p $@
/usr/bin/%:
sudo pacman -S $(@F)
$(call sctl,%):
sudo systemctl enable $(basename $*) --now
/etc/%: ./etc/%
if [ -d "$<" ]; then \
sudo mkdir -v -p $@ ;\
sudo touch --reference=$< $@;\
else \
sudo cp -v $< $@ ;\
fi
touch $(call stamp_file,$@)
/usr/%: ./usr/%
if [ -d "$<" ]; then \
sudo mkdir -v -p $@ ;\
sudo touch --reference=$< $@;\
else \
sudo cp -v $< $@ ;\
fi
touch $(call stamp_file,$@)
define stamp_file
$(foreach arg,$(1),/tmp/tower-stamp$(shell echo $(arg) | tr '/' '-'))
endef