3 ### Build script for distorted.org.uk key management
5 ### (c) 2011 Mark Wooding
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the distorted.org.uk key management suite.
12 ### distorted-keys is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU General Public License as published by
14 ### the Free Software Foundation; either version 2 of the License, or
15 ### (at your option) any later version.
17 ### distorted-keys is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU General Public License for more details.
22 ### You should have received a copy of the GNU General Public License
23 ### along with distorted-keys; if not, write to the Free Software Foundation,
24 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 pkgconfdir = $(sysconfdir)/$(PACKAGE)
27 profiledir = $(pkgconfdir)/profile.d
33 dist_pkgdata_SCRIPTS =
46 ###--------------------------------------------------------------------------
47 ### Substitution of configuration data.
49 confsubst = $(top_srcdir)/config/confsubst
50 EXTRA_DIST += config/confsubst
53 PACKAGE="$(PACKAGE)" VERSION="$(VERSION)" \
55 bindir="$(bindir)" sbindir="$(sbindir)" \
56 sysconfdir="$(sysconfdir)" pkgconfdir="$(pkgconfdir)" \
57 pkgstatedir="$(localstatedir)/lib/$(PACKAGE)" \
58 pkgdatadir="$(pkgdatadir)" \
61 V_SUBST = $(V_SUBST_$V)
62 V_SUBST_= $(V_SUBST_$(AM_DEFAULT_VERBOSITY))
63 V_SUBST_0 = @printf " SUBST %s\n" $@;
65 SUBST = $(V_SUBST)$(confsubst)
67 ###--------------------------------------------------------------------------
70 ## Shamir secret-sharing.
72 EXTRA_DIST += shamir.in
73 dist_man_MANS += shamir.1
75 shamir: shamir.in Makefile
76 $(SUBST) $(srcdir)/shamir.in $(SUBSTVARS) >shamir.new && \
77 chmod +x shamir.new && mv shamir.new shamir
79 ## Property expansion.
80 bin_SCRIPTS += extract-profile
81 EXTRA_DIST += extract-profile.in
82 dist_man_MANS += extract-profile.1
83 CLEANFILES += extract-profile
84 extract-profile: extract-profile.in Makefile
85 $(SUBST) $(srcdir)/extract-profile.in $(SUBSTVARS) \
86 >extract-profile.new && \
87 chmod +x extract-profile.new && \
88 mv extract-profile.new extract-profile
90 ###--------------------------------------------------------------------------
91 ### Main driver program and commands.
97 keys: keys.in Makefile
98 $(SUBST) $(srcdir)/keys.in $(SUBSTVARS) >keys.new && \
99 chmod +x keys.new && mv keys.new keys
101 ## Utilities library.
102 pkgdata_DATA += keyfunc.sh
103 EXTRA_DIST += keyfunc.sh.in
104 CLEANFILES += keyfunc.sh
105 keyfunc.sh: keyfunc.sh.in Makefile
106 $(SUBST) $(srcdir)/keyfunc.sh.in $(SUBSTVARS) >keyfunc.sh.new && \
107 mv keyfunc.sh.new keyfunc.sh
110 dist_pkgdata_SCRIPTS += keys.conceal
111 dist_pkgdata_SCRIPTS += keys.delete-keeper
112 dist_pkgdata_SCRIPTS += keys.forget-keeper
113 dist_pkgdata_SCRIPTS += keys.keeper-cards
114 dist_pkgdata_SCRIPTS += keys.keeper-nub
115 dist_pkgdata_SCRIPTS += keys.list-keepers
116 dist_pkgdata_SCRIPTS += keys.list-recov
117 dist_pkgdata_SCRIPTS += keys.new-keeper
118 dist_pkgdata_SCRIPTS += keys.new-recov
119 dist_pkgdata_SCRIPTS += keys.recover
120 dist_pkgdata_SCRIPTS += keys.reveal
121 dist_pkgdata_SCRIPTS += keys.stash
124 dist_profile_DATA += profile.d/00base
125 dist_profile_DATA += profile.d/02infra
127 ## Other configuration.
128 KEYS_CONFIG += keys.conf
129 EXTRA_DIST += keys.conf
131 KEYS_CONFIG += admin.users admin.groups
132 EXTRA_DIST += admin.users admin.groups
134 KEYS_CONFIG += keeper-cards.tex
135 EXTRA_DIST += keeper-cards.tex
137 ###--------------------------------------------------------------------------
138 ### Crypto operations.
140 ## Main driver program.
141 bin_SCRIPTS += cryptop
142 EXTRA_DIST += cryptop.in
143 CLEANFILES += cryptop
144 cryptop: cryptop.in Makefile
145 $(SUBST) $(srcdir)/cryptop.in $(SUBSTVARS) >cryptop.new && \
146 chmod +x cryptop.new && mv cryptop.new cryptop
148 ## Key type libraries.
149 dist_pkgdata_DATA += ktype.gnupg
150 dist_profile_DATA += profile.d/01gnupg
152 dist_pkgdata_DATA += ktype.seccure
153 dist_profile_DATA += profile.d/01seccure
155 dist_pkgdata_DATA += ktype.reop
156 dist_profile_DATA += profile.d/01reop
159 dist_pkgdata_SCRIPTS += cryptop.archive
160 dist_pkgdata_SCRIPTS += cryptop.genkey
161 dist_pkgdata_SCRIPTS += cryptop.list
162 dist_pkgdata_SCRIPTS += cryptop.delkey
163 dist_pkgdata_SCRIPTS += cryptop.recover
164 dist_pkgdata_SCRIPTS += cryptop.info
165 dist_pkgdata_SCRIPTS += cryptop.public
166 dist_pkgdata_SCRIPTS += cryptop.encrypt
167 dist_pkgdata_SCRIPTS += cryptop.decrypt
168 dist_pkgdata_SCRIPTS += cryptop.sign
169 dist_pkgdata_SCRIPTS += cryptop.verify
171 ## Userv services configuration.
172 USERV_CONFIG += userv/distorted-keys
173 EXTRA_DIST += userv/distorted-keys.in
174 CLEANFILES += userv/distorted-keys
175 userv/distorted-keys: userv/distorted-keys.in Makefile
176 $(AM_V_at)mkdir -p userv/
177 $(SUBST) $(srcdir)/userv/distorted-keys.in $(SUBSTVARS) \
178 >userv/distorted-keys.new && \
179 mv userv/distorted-keys.new userv/distorted-keys
181 ###--------------------------------------------------------------------------
182 ### Standalone operations on public keys.
184 bin_SCRIPTS += pubkeyop
185 EXTRA_DIST += pubkeyop.in
186 CLEANFILES += pubkeyop
187 pubkeyop: pubkeyop.in Makefile
188 $(SUBST) $(srcdir)/pubkeyop.in $(SUBSTVARS) >pubkeyop.new && \
189 chmod +x pubkeyop.new && mv pubkeyop.new pubkeyop
191 ###--------------------------------------------------------------------------
192 ### Secure storage management.
194 ## Ephemeral filesystem construction.
195 sbin_SCRIPTS += mount-ephemeral
196 EXTRA_DIST += mount-ephemeral
198 ## Directory claiming service.
199 USERV_CONFIG += userv/claim-dir
200 EXTRA_DIST += userv/claim-dir.in
201 CLEANFILES += userv/claim-dir
202 userv/claim-dir: userv/claim-dir.in Makefile
203 $(AM_V_at)mkdir -p userv/
204 $(SUBST) $(srcdir)/userv/claim-dir.in $(SUBSTVARS) \
205 >userv/claim-dir.new && \
206 mv userv/claim-dir.new userv/claim-dir
208 ## Configuration file.
209 TOPLEVEL_CONFIG += claim-dir.tab
210 EXTRA_DIST += claim-dir.tab
212 ###--------------------------------------------------------------------------
213 ### Installing configuration.
215 ## Install userv configuration.
216 noinst_DATA += $(USERV_CONFIG)
218 $(MKDIR_P) $(DESTDIR)$(uservconfdir)
219 @for i in $(USERV_CONFIG); do \
220 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
221 if [ -f $(DESTDIR)$(uservconfdir)/$$b ]; then continue; fi; \
222 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
223 echo $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir); \
224 $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir) || exit 1; \
227 @for i in $(USERV_CONFIG); do \
228 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
229 echo rm -f $(DESTDIR)$(uservconfdir)/$$b; \
230 rm -f $(DESTDIR)$(uservconfdir)/$$b; \
233 ## Install keys configuration.
234 noinst_DATA += $(KEYS_CONFIG)
236 $(MKDIR_P) $(DESTDIR)$(pkgconfdir)
237 @for i in $(KEYS_CONFIG); do \
238 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
239 if [ -f $(DESTDIR)$(pkgconfdir)/$$b ]; then continue; fi; \
240 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
241 echo $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir); \
242 $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir) || exit 1; \
245 @for i in $(KEYS_CONFIG); do \
246 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
247 echo rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
248 rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
251 ## Install toplevel configuration.
252 noinst_DATA += $(TOPLEVEL_CONFIG)
254 $(MKDIR_P) $(DESTDIR)$(sysconfdir)
255 @for i in $(TOPLEVEL_CONFIG); do \
256 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
257 if [ -f $(DESTDIR)$(sysconfdir)/$$b ]; then continue; fi; \
258 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
259 echo $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir); \
260 $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir) || exit 1; \
263 @for i in $(TOPLEVEL_CONFIG); do \
264 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
265 echo rm -f $(DESTDIR)$(sysconfdir)/$$b; \
266 rm -f $(DESTDIR)$(sysconfdir)/$$b; \
269 ###--------------------------------------------------------------------------
273 echo $(VERSION) >$(distdir)/RELEASE
275 EXTRA_DIST += config/auto-version
277 ###--------------------------------------------------------------------------
278 ### Debian packaging.
280 EXTRA_DIST += debian/changelog debian/control debian/copyright
281 EXTRA_DIST += debian/rules debian/compat
283 EXTRA_DIST += debian/distorted-keys-base.install
285 EXTRA_DIST += debian/distorted-keys.install
286 EXTRA_DIST += debian/distorted-keys.postinst
288 EXTRA_DIST += debian/claim-dir.install
290 ###----- That's all, folks --------------------------------------------------