This repository was archived by the owner on Oct 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathin.mk
More file actions
98 lines (77 loc) · 2.62 KB
/
Copy pathin.mk
File metadata and controls
98 lines (77 loc) · 2.62 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.SUFFIXES: .jsx .mjs .js
.jsx.mjs:
$(ESC) $(ESCFLAGS) $< > $@ || (rm -f $@; exit 1)
.mjs.js:
$(ESL) $(ESLFLAGS) $< > $@ || (rm -f $@; exit 1)
touch $(@D)/index.html
SRC=\
public/addressing/index.js \
public/aim/index.js \
public/containers/index.js \
public/dashboard/index.js \
public/peers/index.js \
public/dns/index.js \
public/firewall/index.js \
public/logs/index.js \
public/security/index.js \
public/services/index.js \
public/settings/index.js \
public/storage/index.js \
public/topology/index.js \
public/version-control/index.js
build: \
$(SRC) \
$(BIN).service \
$(BIN).rules \
$(BIN)
serve: build
./avaron
run: build
./$(BIN)
public/dashboard/index.js: public/map.jsx public/coordinates.jsx public/util.jsx
$(SRC): public/frame.jsx
$(BIN): $(GO_FILES)
go build
$(BIN).service: in.service Makefile
sed 's,@PREFIX,$(PREFIX),g; s,@BIN,$(BIN),g' in.service > $@
node_modules: package.json
$(NPM) i && touch -c node_modules
$(BIN).rules: in.rules Makefile
sed 's,@BIN,$(BIN),g' in.rules > $@
install: build
mkdir -p $(PREFIX)/lib/systemd/system/
cp -f $(BIN) $(PREFIX)/bin/$(BIN)
mkdir -p $(PREFIX)/lib/systemd/system/
cp -f $(BIN).service $(PREFIX)/lib/systemd/system/$(BIN).service
cp -f llama-server.service $(PREFIX)/lib/systemd/system/llama-server.service
cp -f $(BIN).rules /etc/polkit-1/rules.d/$(BIN).rules
systemctl daemon-reload
printf "%s ALL=(ALL) !ALL\n" "$(BIN)" > "/etc/sudoers.d/$(BIN)"
printf "%s ALL=(ALL) NOPASSWD: /usr/sbin/ip, /usr/bin/wg, /usr/sbin/ethtool, /usr/local/sbin/ethtool, /usr/local/bin/named\n" "$(BIN)" >> "/etc/sudoers.d/$(BIN)"
if id $(BIN) >/dev/null 2>&1; then \
printf "user %s already exists - not recreating\n" $(BIN); \
else \
(grep ^ssl: /etc/group >/dev/null || groupadd ssl) && \
useradd -m $(BIN) -s /bin/sh -r -G ssl,video,render && \
su $(BIN) sh -c 'cd && yes "" | ssh-keygen && mkdir -p peers wireguard' && \
su $(BIN) sh -c 'cd ~/wireguard && touch private && chmod 600 private && chown $(BIN) private' && \
su $(BIN) sh -c 'cd ~/wireguard && wg genkey | tee private | wg pubkey > public' && \
su $(BIN) sh -c 'cd ~/wireguard && chmod 400 private'; \
fi
find public | grep -v '.jsx$$' | cpio -o | su $(BIN) sh -c 'cd ~; cpio -i'
uninstall:
rm -f /etc/$(BIN)/key \
$(PREFIX)/lib/systemd/$(BIN).service \
$(PREFIX)/var/lib/$(BIN)/key ||:
rm -rf $(PREFIX)/var/lib/$(BIN)/peers ||:
rmdir /etc/$(BIN) ||:
rmdir $(PREFIX)/var/lib/$(BIN) ||:
userdel -rf $(BIN)
restart:
systemctl daemon-reload
systemctl restart $(BIN)
clean:
go clean
rm -f $(BIN).service public/*.js public/*.mjs public/*/*.js public/*/*.mjs
nuke: clean
rm -f Makefile