blob: 7fd6ca2dbe43f417d65024f199c5f05002f0924d (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
.DEFAULT_GOAL = all
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
sbindir ?= $(exec_prefix)/sbin
libexecdir ?= $(exec_prefix)/libexec
export prefix exec_prefix bindir sbindir libexecdir
bin_PROGRAMS := $(wildcard bin/*)
sbin_PROGRAMS := $(wildcard sbin/*)
libexec_PROGRAMS := $(wildcard libexec/*)
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) $(libexec_PROGRAMS)
export PROGRAMS bin_PROGRAMS sbin_PROGRAMS libexec_PROGRAMS
include src/control.mk
DD_USER = dyndns
DD_GROUP = dyndns
define install_programs
$(if $($(1)_PROGRAMS),install -t $($(1)dir) $($(1)_PROGRAMS),@: "skip install $1 (no files)")
endef
all_programs = bin sbin libexec
define install_all_programs
$(foreach x,$(all_programs),$(call install_programs,$(x)))
endef
.PHONY: all install clean
all: control
clean: clean-equivs
install: equivs-stamp $(PROGRAMS)
ifneq ($(shell id -u),0)
@sudo $(MAKE) MAKEFLAGS=$(MAKEFLAGS) $@
else
$(call install_all_programs)
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))
|