-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (43 loc) · 1.52 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
TERRARIA_USER := terraria
TERRARIA_HOME := /opt/terraria
TERRARIA_CONFIG := /opt/terraria/defaultserverconfig.txt
_TERRARIAD := /usr/local/bin/_terrariad
TERRARIAD := /usr/local/bin/terrariad
TERRARIA_INIT_D := /etc/init.d/terrariad
TERRARIA_SERVICE := /lib/systemd/system/terrariad.service
TERRARIA_COMPLETION := /etc/bash_completion.d/terrariad
install: update
if [ `grep -c '^$(TERRARIA_USER):' /etc/passwd` = "0" ]; then \
useradd --system --user-group --create-home --home $(TERRARIA_HOME) $(TERRARIA_USER); \
fi
install -m 0644 -o $(TERRARIA_USER) -g $(TERRARIA_USER) defaultserverconfig.txt $(TERRARIA_CONFIG)
if which systemctl; then \
systemctl -f enable terrariad.service; \
else \
ln -s $(TERRARIAD) $(TERRARIA_INIT_D); \
update-rc.d terrariad defaults; \
fi
terrariad update
update:
install -m 0755 _terrariad $(_TERRARIAD)
install -m 0755 terrariad $(TERRARIAD)
install -m 0644 terrariad.completion $(TERRARIA_COMPLETION)
if [ -e $(TERRARIA_HOME) ]; then \
install -m 0644 -o $(TERRARIA_USER) -g $(TERRARIA_USER) defaultserverconfig.txt $(TERRARIA_CONFIG); \
fi
if which systemctl; then \
install -m 0644 terrariad.service $(TERRARIA_SERVICE); \
systemctl daemon-reload; \
fi
clean:
terrariad force-stop
if which systemctl; then \
systemctl -f disable terrariad.service; \
rm -f $(TERRARIA_SERVICE); \
else \
update-rc.d terrariad remove; \
rm -f $(TERRARIA_INIT_D); \
fi
rm -f $(_TERRARIAD) $(TERRARIAD) $(TERRARIA_COMPLETION) $(TERRARIA_CONFIG)
superclean: clean
userdel --remove $(TERRARIA_USER);