aboutsummaryrefslogtreecommitdiff
path: root/ca/Makefile.in
blob: 1a18df0b50c61e51ad541979132d2d009e9392f4 (plain) (blame)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# $Id$

PYTHON		= @PYTHON@
TRANG		= @TRANG@

CFLAGS		= @CFLAGS@
LDFLAGS		= @LDFLAGS@ @POW_LDFLAGS@
LIBS		= @LIBS@

INSTALL		= @INSTALL@ -m 555 

prefix		= @prefix@
exec_prefix	= @exec_prefix@
datarootdir	= @datarootdir@
datadir		= @datadir@
localstatedir	= @localstatedir@
sharedstatedir	= @sharedstatedir@
sysconfdir	= @sysconfdir@
bindir		= @bindir@
sbindir		= @sbindir@
libexecdir	= @libexecdir@
sysconfdir	= @sysconfdir@

abs_builddir	= @abs_builddir@
abs_top_srcdir	= @abs_top_srcdir@
abs_top_builddir= @abs_top_builddir@
srcdir          = @srcdir@

WSGI_DAEMON_PROCESS		= @WSGI_DAEMON_PROCESS@
WSGI_PROCESS_GROUP		= @WSGI_PROCESS_GROUP@
RCYNIC_HTML_DIR			= @RCYNIC_HTML_DIR@
APACHE_VERSION			= @APACHE_VERSION@
WSGI_PYTHON_EGG_CACHE_DIR	= @WSGI_PYTHON_EGG_CACHE_DIR@
WSGI_PYTHON_EGG_CACHE_USER	= @WSGI_PYTHON_EGG_CACHE_USER@

CA_INSTALL_TARGETS	= @CA_INSTALL_TARGETS@

# Apache configuration may end up moving to common runtime config, but
# that yak will have to wait for another day to get its shave.

all::
	@true

clean::
	cd tests; $(MAKE) $@

install:: ${CA_INSTALL_TARGETS}

install-always:: all
	${INSTALL} -d ${DESTDIR}${datarootdir}/rpki/publication
	${INSTALL} -d ${DESTDIR}${datarootdir}/rpki/rrdp-publication

uninstall deinstall::
	-${libexecdir}/rpkigui-apache-conf-gen --remove --verbose

distclean::
	rm -f installed

test all-tests relaxng parse-test profile yamltest yamlconf:: all
	cd tests; $(MAKE) $@

distclean:: clean
	cd tests; ${MAKE} $@
	rm -f Makefile

install-postconf: \
	install-egg-cache install-conf install-apache install-bpki install-cron

# This is only necessary on some platforms (currently FreeBSD,
# due to shortcomings in the way that Python eggs are installed
# as system libraries).

install-egg-cache:
	@if test 'X${WSGI_PYTHON_EGG_CACHE_DIR}' != X && test ! -d '${WSGI_PYTHON_EGG_CACHE_DIR}'; then \
		mkdir -v '${WSGI_PYTHON_EGG_CACHE_DIR}'; \
		if test 'X${WSGI_PYTHON_EGG_CACHE_USER}' != X; then \
			chown '${WSGI_PYTHON_EGG_CACHE_USER}' '${WSGI_PYTHON_EGG_CACHE_DIR}'; \
		fi; \
	fi

install-conf:
	${sbindir}/rpki-confgen \
		--read-xml ${DESTDIR}${sysconfdir}/rpki/rpki.rp.xml \
		--set myrpki::run_rpkid=yes \
		--set myrpki::run_pubd=yes \
		--write-xml ${DESTDIR}${sysconfdir}/rpki/rpki.ca.xml \
		--write-conf ${DESTDIR}${sysconfdir}/rpki/rpki.ca.conf.sample
	if test ! -f ${DESTDIR}${sysconfdir}/rpki.conf ||\
		cmp -s ${DESTDIR}${sysconfdir}/rpki.conf ${DESTDIR}${sysconfdir}/rpki/rpki.rp.conf.sample;\
	then \
		cp -p ${DESTDIR}${sysconfdir}/rpki/rpki.ca.conf.sample ${DESTDIR}${sysconfdir}/rpki.conf
	fi

#uninstall deinstall::
#	rm -f ${DESTDIR}${sysconfdir}/rpki/rpki.ca.xml ${DESTDIR}${sysconfdir}/rpki/rpki.ca.conf.sample

install-apache:
	${libexecdir}/rpkigui-apache-conf-gen --install --verbose

install-bpki:
	${sbindir}/rpkic initialize_server_bpki

# This needs to set up crontab entries for rpkigui-check-expired,
# rpkigui-import-routes, and rpkic update_bpki.  They probably don't
# want run under the same user IDs either, so what with having to use
# /usr/bin/crontab on some platforms, this should be entirely too
# entertaining.  Might be ok to run them all as user rpkid eventually.
#
# We really should be running exactly the same cron setup/teardown
# code here as we do in platform-specific post-installation scripts,
# but for now we just use crontab(1) here on all platforms.

install-cron: install-cron-using-crontab

uninstall deinstall:: uninstall-cron-using-crontab

# Code for setting up and tearing down cron jobs using the crontab(1)
# program.  We don't use this on all platforms, but we do use it on
# more than one, so it's broken out here as common code.

CRONTAB_USER = rpki

install-cron-using-crontab:
	@crontab -l -u ${CRONTAB_USER} 2>/dev/null |						\
	 awk -v t=`hexdump -n 2 -e '"%u\n"' /dev/urandom` '					\
	     BEGIN {										\
		 cmd["${libexecdir}/rpkigui-import-routes"] = sprintf("%2u */2 * * *", t % 60);	\
		 cmd["${libexecdir}/rpkigui-check-expired"] =          "@daily      ";		\
		 cmd["${sbindir}/rpkic update_bpki"       ] =          "30 3 * * *  ";		\
	     }											\
	     {											\
		 print;										\
		 for (i in cmd)									\
		     if ($$0 ~ i)								\
			 found[i] = $$0;							\
	     }											\
	     END {										\
		 for (i in cmd)									\
		     if (!found[i])								\
			 print cmd[i] "\texec " i;						\
	     }' |										\
	 crontab -u ${CRONTAB_USER} -

uninstall-cron-using-crontab:
	@crontab -l -u ${CRONTAB_USER} 2>/dev/null |			\
	 awk '								\
	     BEGIN {							\
		empty = 1;						\
	     }								\
	     $$0 !~ "${libexecdir}/rpkigui-import-routes" &&		\
	     $$0 !~ "${libexecdir}/rpkigui-check-expired" &&		\
	     $$0 !~ "${sbindir}/rpkic update_bpki" {			\
		empty = 0;						\
		print | "/usr/bin/crontab -u ${CRONTAB_USER} -";	\
	     }								\
	     END {							\
		if (empty)						\
		    system("/usr/bin/crontab -u ${CRONTAB_USER} -r");	\
	     }'