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
31 dist_pkgdata_SCRIPTS =
44 ###--------------------------------------------------------------------------
45 ### Substitution of configuration data.
47 confsubst = $(top_srcdir)/config/confsubst
48 EXTRA_DIST += config/confsubst
51 PACKAGE="$(PACKAGE)" VERSION="$(VERSION)" \
53 bindir="$(bindir)" sbindir="$(sbindir)" \
54 sysconfdir="$(sysconfdir)" pkgconfdir="$(pkgconfdir)" \
55 pkgstatedir="$(localstatedir)/lib/$(PACKAGE)" \
56 pkgdatadir="$(pkgdatadir)" \
59 V_SUBST = $(V_SUBST_$V)
60 V_SUBST_= $(V_SUBST_$(AM_DEFAULT_VERBOSITY))
61 V_SUBST_0 = @printf " SUBST %s\n" $@;
63 SUBST = $(V_SUBST)$(confsubst)
65 ###--------------------------------------------------------------------------
68 ## Shamir secret-sharing.
70 EXTRA_DIST += shamir.in
72 shamir: shamir.in Makefile
73 $(SUBST) $(srcdir)/shamir.in $(SUBSTVARS) >shamir.new && \
74 chmod +x shamir.new && mv shamir.new shamir
76 ## Property expansion.
77 bin_SCRIPTS += extract-profile
78 EXTRA_DIST += extract-profile.in
79 CLEANFILES += extract-profile
80 extract-profile: extract-profile.in Makefile
81 $(SUBST) $(srcdir)/extract-profile.in $(SUBSTVARS) \
82 >extract-profile.new && \
83 chmod +x extract-profile.new && \
84 mv extract-profile.new extract-profile
86 ###--------------------------------------------------------------------------
87 ### Main driver program and commands.
93 keys: keys.in Makefile
94 $(SUBST) $(srcdir)/keys.in $(SUBSTVARS) >keys.new && \
95 chmod +x keys.new && mv keys.new keys
98 pkgdata_DATA += keyfunc.sh
99 EXTRA_DIST += keyfunc.sh.in
100 CLEANFILES += keyfunc.sh
101 keyfunc.sh: keyfunc.sh.in Makefile
102 $(SUBST) $(srcdir)/keyfunc.sh.in $(SUBSTVARS) >keyfunc.sh.new && \
103 mv keyfunc.sh.new keyfunc.sh
106 dist_pkgdata_SCRIPTS += keys.conceal
107 dist_pkgdata_SCRIPTS += keys.delete-keeper
108 dist_pkgdata_SCRIPTS += keys.keeper-cards
109 dist_pkgdata_SCRIPTS += keys.keeper-nub
110 dist_pkgdata_SCRIPTS += keys.list-keepers
111 dist_pkgdata_SCRIPTS += keys.list-recov
112 dist_pkgdata_SCRIPTS += keys.new-keeper
113 dist_pkgdata_SCRIPTS += keys.new-recov
114 dist_pkgdata_SCRIPTS += keys.recover
115 dist_pkgdata_SCRIPTS += keys.reveal
116 dist_pkgdata_SCRIPTS += keys.stash
119 dist_profile_DATA += profile.d/00base
120 dist_profile_DATA += profile.d/02infra
122 ## Other configuration.
123 KEYS_CONFIG += keys.conf
124 EXTRA_DIST += keys.conf
126 KEYS_CONFIG += admin.users admin.groups
127 EXTRA_DIST += admin.users admin.groups
129 KEYS_CONFIG += keeper-cards.tex
130 EXTRA_DIST += keeper-cards.tex
132 ###--------------------------------------------------------------------------
133 ### Crypto operations.
135 ## Main driver program.
136 bin_SCRIPTS += cryptop
137 EXTRA_DIST += cryptop.in
138 CLEANFILES += cryptop
139 cryptop: cryptop.in Makefile
140 $(SUBST) $(srcdir)/cryptop.in $(SUBSTVARS) >cryptop.new && \
141 chmod +x cryptop.new && mv cryptop.new cryptop
143 ## Key type libraries.
144 dist_pkgdata_DATA += ktype.gnupg
145 dist_profile_DATA += profile.d/01gnupg
147 dist_pkgdata_DATA += ktype.seccure
148 dist_profile_DATA += profile.d/01seccure
150 dist_pkgdata_DATA += ktype.reop
151 dist_profile_DATA += profile.d/01reop
154 dist_pkgdata_SCRIPTS += cryptop.archive
155 dist_pkgdata_SCRIPTS += cryptop.genkey
156 dist_pkgdata_SCRIPTS += cryptop.list
157 dist_pkgdata_SCRIPTS += cryptop.delkey
158 dist_pkgdata_SCRIPTS += cryptop.recover
159 dist_pkgdata_SCRIPTS += cryptop.info
160 dist_pkgdata_SCRIPTS += cryptop.public
161 dist_pkgdata_SCRIPTS += cryptop.encrypt
162 dist_pkgdata_SCRIPTS += cryptop.decrypt
163 dist_pkgdata_SCRIPTS += cryptop.sign
164 dist_pkgdata_SCRIPTS += cryptop.verify
166 ## Userv services configuration.
167 USERV_CONFIG += userv/distorted-keys
168 EXTRA_DIST += userv/distorted-keys.in
169 CLEANFILES += userv/distorted-keys
170 userv/distorted-keys: userv/distorted-keys.in Makefile
171 $(AM_V_at)mkdir -p userv/
172 $(SUBST) $(srcdir)/userv/distorted-keys.in $(SUBSTVARS) \
173 >userv/distorted-keys.new && \
174 mv userv/distorted-keys.new userv/distorted-keys
176 ###--------------------------------------------------------------------------
177 ### Standalone operations on public keys.
179 bin_SCRIPTS += pubkeyop
180 EXTRA_DIST += pubkeyop.in
181 CLEANFILES += pubkeyop
182 pubkeyop: pubkeyop.in Makefile
183 $(SUBST) $(srcdir)/pubkeyop.in $(SUBSTVARS) >pubkeyop.new && \
184 chmod +x pubkeyop.new && mv pubkeyop.new pubkeyop
186 ###--------------------------------------------------------------------------
187 ### Secure storage management.
189 ## Ephemeral filesystem construction.
190 sbin_SCRIPTS += mount-ephemeral
191 EXTRA_DIST += mount-ephemeral
193 ## Directory claiming service.
194 USERV_CONFIG += userv/claim-dir
195 EXTRA_DIST += userv/claim-dir.in
196 CLEANFILES += userv/claim-dir
197 userv/claim-dir: userv/claim-dir.in Makefile
198 $(AM_V_at)mkdir -p userv/
199 $(SUBST) $(srcdir)/userv/claim-dir.in $(SUBSTVARS) \
200 >userv/claim-dir.new && \
201 mv userv/claim-dir.new userv/claim-dir
203 ## Configuration file.
204 TOPLEVEL_CONFIG += claim-dir.tab
205 EXTRA_DIST += claim-dir.tab
207 ###--------------------------------------------------------------------------
208 ### Installing configuration.
210 ## Install userv configuration.
211 noinst_DATA += $(USERV_CONFIG)
213 $(MKDIR_P) $(DESTDIR)$(uservconfdir)
214 @for i in $(USERV_CONFIG); do \
215 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
216 if [ -f $(DESTDIR)$(uservconfdir)/$$b ]; then continue; fi; \
217 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
218 echo $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir); \
219 $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir) || exit 1; \
222 @for i in $(USERV_CONFIG); do \
223 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
224 echo rm -f $(DESTDIR)$(uservconfdir)/$$b; \
225 rm -f $(DESTDIR)$(uservconfdir)/$$b; \
228 ## Install keys configuration.
229 noinst_DATA += $(KEYS_CONFIG)
231 $(MKDIR_P) $(DESTDIR)$(pkgconfdir)
232 @for i in $(KEYS_CONFIG); do \
233 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
234 if [ -f $(DESTDIR)$(pkgconfdir)/$$b ]; then continue; fi; \
235 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
236 echo $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir); \
237 $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir) || exit 1; \
240 @for i in $(KEYS_CONFIG); do \
241 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
242 echo rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
243 rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
246 ## Install toplevel configuration.
247 noinst_DATA += $(TOPLEVEL_CONFIG)
249 $(MKDIR_P) $(DESTDIR)$(sysconfdir)
250 @for i in $(TOPLEVEL_CONFIG); do \
251 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
252 if [ -f $(DESTDIR)$(sysconfdir)/$$b ]; then continue; fi; \
253 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
254 echo $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir); \
255 $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir) || exit 1; \
258 @for i in $(TOPLEVEL_CONFIG); do \
259 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
260 echo rm -f $(DESTDIR)$(sysconfdir)/$$b; \
261 rm -f $(DESTDIR)$(sysconfdir)/$$b; \
264 ###--------------------------------------------------------------------------
268 echo $(VERSION) >$(distdir)/RELEASE
270 EXTRA_DIST += config/auto-version
272 ###--------------------------------------------------------------------------
273 ### Debian packaging.
275 EXTRA_DIST += debian/changelog debian/control debian/copyright
276 EXTRA_DIST += debian/rules debian/compat
278 EXTRA_DIST += debian/distorted-keys-base.install
280 EXTRA_DIST += debian/distorted-keys.install
281 EXTRA_DIST += debian/distorted-keys.postinst
283 EXTRA_DIST += debian/claim-dir.install
285 ###----- That's all, folks --------------------------------------------------