-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
70 lines (56 loc) · 2.24 KB
/
Makefile.in
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
# Makefile.in
VPATH = @srcdir@
# Directories
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
srcdir = @srcdir@
builddir = $(srcdir)/tmp
sysconfdir = @sysconfdir@
DESTDIR = $(sysconfdir)/duckdns-and-letsencrypt
SYSTEMD_LIBDIR = $(libdir)/systemd/system
# Commands
INSTALL = @INSTALL@
MKDIR_P = @MKDIR_P@
SED = @SED@
DOCKER_COMPOSE = @DOCKER_COMPOSE@
LN_S = @LN_S@
all: build
build: $(builddir) $(builddir)/duckdns-and-letsencrypt.service $(builddir)/.env $(builddir)/docker-compose.yml
$(builddir):
$(MKDIR_P) $(builddir)
$(builddir)/.env: $(srcdir)/.env
cp $(srcdir)/.env $(builddir)/.
$(builddir)/docker-compose.yml: $(srcdir)/docker-compose.yml
cp $(srcdir)/docker-compose.yml $(builddir)/.
$(builddir)/duckdns-and-letsencrypt.service: $(srcdir)/duckdns-and-letsencrypt.service
cp $(srcdir)/duckdns-and-letsencrypt.service $(builddir)/.
$(SED) -i -e "s|DOCKER_COMPOSE|$(DOCKER_COMPOSE)|g" -e "s|DESTDIR|$(DESTDIR)|g" $(builddir)/duckdns-and-letsencrypt.service
install: build installdirs
$(INSTALL) -m 664 $(builddir)/duckdns-and-letsencrypt.service $(DESTDIR)
$(INSTALL) -m 664 $(builddir)/docker-compose.yml $(DESTDIR)
@if test -f "$(DESTDIR)/.env"; then \
if cmp -s "$(builddir)/.env" "$(DESTDIR)/.env" ; then \
$(INSTALL) -m 664 $(builddir)/.env $(DESTDIR) ; \
else \
echo "WARNING! Leaving $(DESTDIR)/.env since it has local changes" ; \
echo " If you want to overwrite it, do:" ; \
echo " sudo $(INSTALL) -m 644 $(builddir)/.env $(DESTDIR)" ; \
fi \
else \
$(INSTALL) -m 664 $(builddir)/.env $(DESTDIR) ; \
fi
$(LN_S) -f $(DESTDIR)/duckdns-and-letsencrypt.service $(SYSTEMD_LIBDIR)/.
systemctl enable duckdns-and-letsencrypt.service
uninstall:
systemctl disable --now duckdns-and-letsencrypt.service || true
rm -f $(SYSTEMD_LIBDIR)/duckdns-and-letsencrypt.service
rm -f $(DESTDIR)/duckdns-and-letsencrypt.service $(DESTDIR)/docker-compose.yml
@printf '%s\n' "NOTE! Leaving $(DESTDIR) since it may have local changes or certificates" " If you want to remove it (and duckdns-and-letsencrypt) completely, do:" " sudo rm -rf $(DESTDIR)"
installdirs: $(DESTDIR) $(SYSTEMD_LIBDIR)
$(DESTDIR):
$(MKDIR_P) $(DESTDIR)
$(SYSTEMD_LIBDIR):
$(MKDIR_P) $(SYSTEMD_LIBDIR)
clean:
rm -rf $(builddir)