summaryrefslogtreecommitdiff
path: root/Makefile
blob: 43b72aac2e2f96c6eeb817de44a41c7973c4244a (plain)
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
.DEFAULT_GOAL = all

prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
bin_PROGRAMS := $(wildcard bin/*)
export prefix exec_prefix bindir bin_PROGRAMS

include src/control.mk

DD_USER = dyndns
DD_GROUP = dyndns




.PHONY: all install clean

all: control

clean: clean-equivs

install: equivs-stamp $(bin_PROGRAMS)
ifneq ($(shell id -u),0)
	@sudo $(MAKE) MAKEFLAGS=$(MAKEFLAGS) $@
else
	install $(bin_PROGRAMS) $(bindir)/
	getent passwd $(DD_USER) || useradd --system --create-home $(DD_USER)
	@chown -v root:$(DD_GROUP) /etc/powerdns
	@chown -v pdns:$(DD_GROUP) /etc/powerdns/powerdns.sqlite3
	@chmod -v g+rwx /etc/powerdns
	@chmod -v g+rw /etc/powerdns/powerdns.sqlite3
	$(MAKE) ~$(DD_USER)/.ssh/authorized_keys
endif

define dyndns_authorized_keys_contents
command="$(bindir)/samizdat-ssh-command $(bindir)/cryptonomic-dyndns-command",no-port-forwarding * Samizdat - YES WE CAN
endef

~$(DD_USER)/.ssh/authorized_keys:
	: writing file $@  $(file >$@,$(dyndns_authorized_keys_contents))