Skip to content

Commit

Permalink
Install examples in @DocDir@, create systemd files from templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Jan 20, 2017
1 parent b24f732 commit 6ecc82b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ confdefs.h
config.*
configure
depcomp
dnscrypt-proxy.service
dnscrypt-update-resolvers.sh
install-sh
libltdl
Expand Down
41 changes: 34 additions & 7 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ EXTRA_DIST = \
apparmor.profile.dnscrypt-proxy \
autogen.sh \
dnscrypt-proxy.conf \
dnscrypt-proxy.service \
dnscrypt-proxy.service.in \
dnscrypt-proxy.socket \
dnscrypt-update-resolvers.sh.in \
org.dnscrypt.osx.DNSCryptProxy.plist \
resolvers-check.sh

Expand All @@ -33,21 +34,47 @@ dist_pkgdata_DATA = \
dnscrypt-resolvers.csv \
minisign.pub

doc_DATA = \
README.markdown \
COPYING \
DNSCRYPT-V2-PROTOCOL.txt \
dnscrypt-proxy.conf

if PLUGINS
doc_DATA += \
README-PLUGINS.markdown
endif

if HAVE_SYSTEMD
doc_DATA += \
dnscrypt-proxy.service \
dnscrypt-proxy.socket
endif

dnscrypt-proxy.service: dnscrypt-proxy.service.in
$(SED) \
-e 's|[@]sbindir@|$(sbindir)|g' \
-e 's|[@]sysconfdir@|$(sysconfdir)|g' \
< dnscrypt-proxy.service.in > dnscrypt-proxy.service

CLEANFILES = \
dnscrypt-proxy.service

install-data-local:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir); \
if [ -f $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf ]; then \
if cmp -s $(srcdir)/dnscrypt-proxy.conf $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf; then \
echo "Configuration file unchanged"; \
if cmp -s $(srcdir)/dnscrypt-proxy.conf $(docdir)/dnscrypt-proxy.conf; then \
echo "Configuration file unchanged"; \
else \
$(INSTALL_DATA) $(srcdir)/dnscrypt-proxy.conf $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf.example; \
echo "The example configuration file [$(docdir)/dnscrypt-proxy.conf] has been updated, you may want to compare it with the one at [$(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf]"; \
fi; \
else \
$(INSTALL_DATA) $(srcdir)/dnscrypt-proxy.conf $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf; \
fi

uninstall-local:
if cmp -s $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf $(srcdir)/dnscrypt-proxy.conf; then \
if cmp -s $(srcdir)/dnscrypt-proxy.conf $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf; then \
echo "$(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf has not changed and will be removed."; \
rm -f $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf; \
fi; \
rm -f $(DESTDIR)$(sysconfdir)/dnscrypt-proxy.conf.example
rmdir $(DESTDIR)$(sysconfdir) 2> /dev/null; \
fi
2 changes: 1 addition & 1 deletion dnscrypt-proxy.service → dnscrypt-proxy.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ NonBlocking=true

# Edit the configuration file appropriately, or the service will not start.
# See https://dnscrypt.org for more information.
ExecStart=/usr/sbin/dnscrypt-proxy /etc/dnscrypt-proxy.conf
ExecStart=@sbindir@/dnscrypt-proxy @sysconfdir@/dnscrypt-proxy.conf

0 comments on commit 6ecc82b

Please sign in to comment.