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
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 pkglibdir="$(pkglibdir)" \
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 pkglib_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_pkglib_SCRIPTS += keys.conceal
107 dist_pkglib_SCRIPTS += keys.keeper-cards
108 dist_pkglib_SCRIPTS += keys.keeper-nub
109 dist_pkglib_SCRIPTS += keys.list-keepers
110 dist_pkglib_SCRIPTS += keys.list-recov
111 dist_pkglib_SCRIPTS += keys.new-keeper
112 dist_pkglib_SCRIPTS += keys.new-recov
113 dist_pkglib_SCRIPTS += keys.recover
114 dist_pkglib_SCRIPTS += keys.reveal
115 dist_pkglib_SCRIPTS += keys.stash
118 dist_profile_DATA += profile.d/00base
119 dist_profile_DATA += profile.d/02infra
121 ## Other configuration.
122 KEYS_CONFIG += keys.conf
123 EXTRA_DIST += keys.conf
125 KEYS_CONFIG += admin.users admin.groups
126 EXTRA_DIST += admin.users admin.groups
128 KEYS_CONFIG += keeper-cards.tex
129 EXTRA_DIST += keeper-cards.tex
131 ###--------------------------------------------------------------------------
132 ### Crypto operations.
134 ## Main driver program.
135 bin_SCRIPTS += cryptop
136 EXTRA_DIST += cryptop.in
137 CLEANFILES += cryptop
138 cryptop: cryptop.in Makefile
139 $(SUBST) $(srcdir)/cryptop.in $(SUBSTVARS) >cryptop.new && \
140 chmod +x cryptop.new && mv cryptop.new cryptop
142 ## Key type libraries.
143 dist_pkglib_DATA += ktype.gnupg
144 dist_profile_DATA += profile.d/01gnupg
146 dist_pkglib_DATA += ktype.seccure
147 dist_profile_DATA += profile.d/01seccure
150 dist_pkglib_SCRIPTS += cryptop.archive
151 dist_pkglib_SCRIPTS += cryptop.genkey
152 dist_pkglib_SCRIPTS += cryptop.list
153 dist_pkglib_SCRIPTS += cryptop.delkey
154 dist_pkglib_SCRIPTS += cryptop.recover
155 dist_pkglib_SCRIPTS += cryptop.info
156 dist_pkglib_SCRIPTS += cryptop.public
157 dist_pkglib_SCRIPTS += cryptop.encrypt
158 dist_pkglib_SCRIPTS += cryptop.decrypt
159 dist_pkglib_SCRIPTS += cryptop.sign
160 dist_pkglib_SCRIPTS += cryptop.verify
162 ## Userv services configuration.
163 USERV_CONFIG += userv/distorted-keys
164 EXTRA_DIST += userv/distorted-keys.in
165 CLEANFILES += userv/distorted-keys
166 userv/distorted-keys: userv/distorted-keys.in Makefile
167 $(AM_V_at)mkdir -p userv/
168 $(SUBST) $(srcdir)/userv/distorted-keys.in $(SUBSTVARS) \
169 >userv/distorted-keys.new && \
170 mv userv/distorted-keys.new userv/distorted-keys
172 ###--------------------------------------------------------------------------
173 ### Standalone operations on public keys.
175 bin_SCRIPTS += pubkeyop
176 EXTRA_DIST += pubkeyop.in
177 CLEANFILES += pubkeyop
178 pubkeyop: pubkeyop.in Makefile
179 $(SUBST) $(srcdir)/pubkeyop.in $(SUBSTVARS) >pubkeyop.new && \
180 chmod +x pubkeyop.new && mv pubkeyop.new pubkeyop
182 ###--------------------------------------------------------------------------
183 ### Secure storage management.
185 ## Ephemeral filesystem construction.
186 sbin_SCRIPTS += mount-ephemeral
187 EXTRA_DIST += mount-ephemeral
189 ## Directory claiming service.
190 USERV_CONFIG += userv/claim-dir
191 EXTRA_DIST += userv/claim-dir.in
192 CLEANFILES += userv/claim-dir
193 userv/claim-dir: userv/claim-dir.in Makefile
194 $(AM_V_at)mkdir -p userv/
195 $(SUBST) $(srcdir)/userv/claim-dir.in $(SUBSTVARS) \
196 >userv/claim-dir.new && \
197 mv userv/claim-dir.new userv/claim-dir
199 ## Configuration file.
200 TOPLEVEL_CONFIG += claim-dir.tab
201 EXTRA_DIST += claim-dir.tab
203 ###--------------------------------------------------------------------------
204 ### Installing configuration.
206 ## Install userv configuration.
207 noinst_DATA += $(USERV_CONFIG)
209 $(MKDIR_P) $(DESTDIR)$(uservconfdir)
210 @for i in $(USERV_CONFIG); do \
211 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
212 if [ -f $(DESTDIR)$(uservconfdir)/$$b ]; then continue; fi; \
213 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
214 echo $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir); \
215 $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir) || exit 1; \
218 @for i in $(USERV_CONFIG); do \
219 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
220 echo rm -f $(DESTDIR)$(uservconfdir)/$$b; \
221 rm -f $(DESTDIR)$(uservconfdir)/$$b; \
224 ## Install keys configuration.
225 noinst_DATA += $(KEYS_CONFIG)
227 $(MKDIR_P) $(DESTDIR)$(pkgconfdir)
228 @for i in $(KEYS_CONFIG); do \
229 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
230 if [ -f $(DESTDIR)$(pkgconfdir)/$$b ]; then continue; fi; \
231 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
232 echo $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir); \
233 $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir) || exit 1; \
236 @for i in $(KEYS_CONFIG); do \
237 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
238 echo rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
239 rm -f $(DESTDIR)$(pkgconfdir)/$$b; \
242 ## Install toplevel configuration.
243 noinst_DATA += $(TOPLEVEL_CONFIG)
245 $(MKDIR_P) $(DESTDIR)$(sysconfdir)
246 @for i in $(TOPLEVEL_CONFIG); do \
247 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
248 if [ -f $(DESTDIR)$(sysconfdir)/$$b ]; then continue; fi; \
249 if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \
250 echo $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir); \
251 $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir) || exit 1; \
254 @for i in $(TOPLEVEL_CONFIG); do \
255 b=$$(expr /$$i : '.*/\([^/]*\)$$'); \
256 echo rm -f $(DESTDIR)$(sysconfdir)/$$b; \
257 rm -f $(DESTDIR)$(sysconfdir)/$$b; \
260 ###--------------------------------------------------------------------------
264 echo $(VERSION) >$(distdir)/RELEASE
266 EXTRA_DIST += config/auto-version
268 ###--------------------------------------------------------------------------
269 ### Debian packaging.
271 EXTRA_DIST += debian/changelog debian/control debian/copyright
272 EXTRA_DIST += debian/rules debian/compat
274 EXTRA_DIST += debian/distorted-keys-base.install
276 EXTRA_DIST += debian/distorted-keys.install
277 EXTRA_DIST += debian/distorted-keys.postinst
279 EXTRA_DIST += debian/claim-dir.install
281 ###----- That's all, folks --------------------------------------------------