| 1 | ### -*-makefile-*- |
| 2 | ### |
| 3 | ### Build script for distorted.org.uk key management |
| 4 | ### |
| 5 | ### (c) 2011 Mark Wooding |
| 6 | ### |
| 7 | |
| 8 | ###----- Licensing notice --------------------------------------------------- |
| 9 | ### |
| 10 | ### This file is part of the distorted.org.uk key management suite. |
| 11 | ### |
| 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. |
| 16 | ### |
| 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. |
| 21 | ### |
| 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. |
| 25 | |
| 26 | pkgconfdir = $(sysconfdir)/$(PACKAGE) |
| 27 | profiledir = $(pkgconfdir)/profile.d |
| 28 | |
| 29 | bin_SCRIPTS = |
| 30 | sbin_SCRIPTS = |
| 31 | dist_pkglib_SCRIPTS = |
| 32 | dist_pkglib_DATA = |
| 33 | pkglib_DATA = |
| 34 | dist_profile_DATA = |
| 35 | noinst_DATA = |
| 36 | USERV_CONFIG = |
| 37 | KEYS_CONFIG = |
| 38 | TOPLEVEL_CONFIG = |
| 39 | |
| 40 | EXTRA_DIST = |
| 41 | CLEANFILES = |
| 42 | DISTCLEANFILES = |
| 43 | |
| 44 | ###-------------------------------------------------------------------------- |
| 45 | ### Substitution of configuration data. |
| 46 | |
| 47 | confsubst = $(top_srcdir)/config/confsubst |
| 48 | EXTRA_DIST += config/confsubst |
| 49 | |
| 50 | SUBSTVARS = \ |
| 51 | PACKAGE="$(PACKAGE)" VERSION="$(VERSION)" \ |
| 52 | PYTHON="$(PYTHON)" \ |
| 53 | bindir="$(bindir)" sbindir="$(sbindir)" \ |
| 54 | sysconfdir="$(sysconfdir)" pkgconfdir="$(pkgconfdir)" \ |
| 55 | pkgstatedir="$(localstatedir)/lib/$(PACKAGE)" \ |
| 56 | pkglibdir="$(pkglibdir)" \ |
| 57 | user="$(user)" |
| 58 | |
| 59 | V_SUBST = $(V_SUBST_$V) |
| 60 | V_SUBST_= $(V_SUBST_$(AM_DEFAULT_VERBOSITY)) |
| 61 | V_SUBST_0 = @printf " SUBST %s\n" $@; |
| 62 | |
| 63 | SUBST = $(V_SUBST)$(confsubst) |
| 64 | |
| 65 | ###-------------------------------------------------------------------------- |
| 66 | ### Utility programs. |
| 67 | |
| 68 | ## Shamir secret-sharing. |
| 69 | bin_SCRIPTS += shamir |
| 70 | EXTRA_DIST += shamir.in |
| 71 | CLEANFILES += shamir |
| 72 | shamir: shamir.in Makefile |
| 73 | $(SUBST) $(srcdir)/shamir.in $(SUBSTVARS) >shamir.new && \ |
| 74 | chmod +x shamir.new && mv shamir.new shamir |
| 75 | |
| 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 |
| 85 | |
| 86 | ###-------------------------------------------------------------------------- |
| 87 | ### Main driver program and commands. |
| 88 | |
| 89 | ## Main driver. |
| 90 | sbin_SCRIPTS += keys |
| 91 | EXTRA_DIST += keys.in |
| 92 | CLEANFILES += keys |
| 93 | keys: keys.in Makefile |
| 94 | $(SUBST) $(srcdir)/keys.in $(SUBSTVARS) >keys.new && \ |
| 95 | chmod +x keys.new && mv keys.new keys |
| 96 | |
| 97 | ## Utilities library. |
| 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 |
| 104 | |
| 105 | ## Commands. |
| 106 | dist_pkglib_SCRIPTS += keys.conceal |
| 107 | dist_pkglib_SCRIPTS += keys.delete-keeper |
| 108 | dist_pkglib_SCRIPTS += keys.keeper-cards |
| 109 | dist_pkglib_SCRIPTS += keys.keeper-nub |
| 110 | dist_pkglib_SCRIPTS += keys.list-keepers |
| 111 | dist_pkglib_SCRIPTS += keys.list-recov |
| 112 | dist_pkglib_SCRIPTS += keys.new-keeper |
| 113 | dist_pkglib_SCRIPTS += keys.new-recov |
| 114 | dist_pkglib_SCRIPTS += keys.recover |
| 115 | dist_pkglib_SCRIPTS += keys.reveal |
| 116 | dist_pkglib_SCRIPTS += keys.stash |
| 117 | |
| 118 | ## Common profiles. |
| 119 | dist_profile_DATA += profile.d/00base |
| 120 | dist_profile_DATA += profile.d/02infra |
| 121 | |
| 122 | ## Other configuration. |
| 123 | KEYS_CONFIG += keys.conf |
| 124 | EXTRA_DIST += keys.conf |
| 125 | |
| 126 | KEYS_CONFIG += admin.users admin.groups |
| 127 | EXTRA_DIST += admin.users admin.groups |
| 128 | |
| 129 | KEYS_CONFIG += keeper-cards.tex |
| 130 | EXTRA_DIST += keeper-cards.tex |
| 131 | |
| 132 | ###-------------------------------------------------------------------------- |
| 133 | ### Crypto operations. |
| 134 | |
| 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 |
| 142 | |
| 143 | ## Key type libraries. |
| 144 | dist_pkglib_DATA += ktype.gnupg |
| 145 | dist_profile_DATA += profile.d/01gnupg |
| 146 | |
| 147 | dist_pkglib_DATA += ktype.seccure |
| 148 | dist_profile_DATA += profile.d/01seccure |
| 149 | |
| 150 | ## Commands. |
| 151 | dist_pkglib_SCRIPTS += cryptop.archive |
| 152 | dist_pkglib_SCRIPTS += cryptop.genkey |
| 153 | dist_pkglib_SCRIPTS += cryptop.list |
| 154 | dist_pkglib_SCRIPTS += cryptop.delkey |
| 155 | dist_pkglib_SCRIPTS += cryptop.recover |
| 156 | dist_pkglib_SCRIPTS += cryptop.info |
| 157 | dist_pkglib_SCRIPTS += cryptop.public |
| 158 | dist_pkglib_SCRIPTS += cryptop.encrypt |
| 159 | dist_pkglib_SCRIPTS += cryptop.decrypt |
| 160 | dist_pkglib_SCRIPTS += cryptop.sign |
| 161 | dist_pkglib_SCRIPTS += cryptop.verify |
| 162 | |
| 163 | ## Userv services configuration. |
| 164 | USERV_CONFIG += userv/distorted-keys |
| 165 | EXTRA_DIST += userv/distorted-keys.in |
| 166 | CLEANFILES += userv/distorted-keys |
| 167 | userv/distorted-keys: userv/distorted-keys.in Makefile |
| 168 | $(AM_V_at)mkdir -p userv/ |
| 169 | $(SUBST) $(srcdir)/userv/distorted-keys.in $(SUBSTVARS) \ |
| 170 | >userv/distorted-keys.new && \ |
| 171 | mv userv/distorted-keys.new userv/distorted-keys |
| 172 | |
| 173 | ###-------------------------------------------------------------------------- |
| 174 | ### Standalone operations on public keys. |
| 175 | |
| 176 | bin_SCRIPTS += pubkeyop |
| 177 | EXTRA_DIST += pubkeyop.in |
| 178 | CLEANFILES += pubkeyop |
| 179 | pubkeyop: pubkeyop.in Makefile |
| 180 | $(SUBST) $(srcdir)/pubkeyop.in $(SUBSTVARS) >pubkeyop.new && \ |
| 181 | chmod +x pubkeyop.new && mv pubkeyop.new pubkeyop |
| 182 | |
| 183 | ###-------------------------------------------------------------------------- |
| 184 | ### Secure storage management. |
| 185 | |
| 186 | ## Ephemeral filesystem construction. |
| 187 | sbin_SCRIPTS += mount-ephemeral |
| 188 | EXTRA_DIST += mount-ephemeral |
| 189 | |
| 190 | ## Directory claiming service. |
| 191 | USERV_CONFIG += userv/claim-dir |
| 192 | EXTRA_DIST += userv/claim-dir.in |
| 193 | CLEANFILES += userv/claim-dir |
| 194 | userv/claim-dir: userv/claim-dir.in Makefile |
| 195 | $(AM_V_at)mkdir -p userv/ |
| 196 | $(SUBST) $(srcdir)/userv/claim-dir.in $(SUBSTVARS) \ |
| 197 | >userv/claim-dir.new && \ |
| 198 | mv userv/claim-dir.new userv/claim-dir |
| 199 | |
| 200 | ## Configuration file. |
| 201 | TOPLEVEL_CONFIG += claim-dir.tab |
| 202 | EXTRA_DIST += claim-dir.tab |
| 203 | |
| 204 | ###-------------------------------------------------------------------------- |
| 205 | ### Installing configuration. |
| 206 | |
| 207 | ## Install userv configuration. |
| 208 | noinst_DATA += $(USERV_CONFIG) |
| 209 | install-data-local:: |
| 210 | $(MKDIR_P) $(DESTDIR)$(uservconfdir) |
| 211 | @for i in $(USERV_CONFIG); do \ |
| 212 | b=$$(expr /$$i : '.*/\([^/]*\)$$'); \ |
| 213 | if [ -f $(DESTDIR)$(uservconfdir)/$$b ]; then continue; fi; \ |
| 214 | if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \ |
| 215 | echo $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir); \ |
| 216 | $(INSTALL_DATA) $$s $(DESTDIR)$(uservconfdir) || exit 1; \ |
| 217 | done |
| 218 | uninstall-local:: |
| 219 | @for i in $(USERV_CONFIG); do \ |
| 220 | b=$$(expr /$$i : '.*/\([^/]*\)$$'); \ |
| 221 | echo rm -f $(DESTDIR)$(uservconfdir)/$$b; \ |
| 222 | rm -f $(DESTDIR)$(uservconfdir)/$$b; \ |
| 223 | done |
| 224 | |
| 225 | ## Install keys configuration. |
| 226 | noinst_DATA += $(KEYS_CONFIG) |
| 227 | install-data-local:: |
| 228 | $(MKDIR_P) $(DESTDIR)$(pkgconfdir) |
| 229 | @for i in $(KEYS_CONFIG); do \ |
| 230 | b=$$(expr /$$i : '.*/\([^/]*\)$$'); \ |
| 231 | if [ -f $(DESTDIR)$(pkgconfdir)/$$b ]; then continue; fi; \ |
| 232 | if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \ |
| 233 | echo $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir); \ |
| 234 | $(INSTALL_DATA) $$s $(DESTDIR)$(pkgconfdir) || exit 1; \ |
| 235 | done |
| 236 | uninstall-local:: |
| 237 | @for i in $(KEYS_CONFIG); do \ |
| 238 | b=$$(expr /$$i : '.*/\([^/]*\)$$'); \ |
| 239 | echo rm -f $(DESTDIR)$(pkgconfdir)/$$b; \ |
| 240 | rm -f $(DESTDIR)$(pkgconfdir)/$$b; \ |
| 241 | done |
| 242 | |
| 243 | ## Install toplevel configuration. |
| 244 | noinst_DATA += $(TOPLEVEL_CONFIG) |
| 245 | install-data-local:: |
| 246 | $(MKDIR_P) $(DESTDIR)$(sysconfdir) |
| 247 | @for i in $(TOPLEVEL_CONFIG); do \ |
| 248 | b=$$(expr /$$i : '.*/\([^/]*\)$$'); \ |
| 249 | if [ -f $(DESTDIR)$(sysconfdir)/$$b ]; then continue; fi; \ |
| 250 | if [ -f $$i ]; then s=$$i; else s=$(srcdir)/$$i; fi; \ |
| 251 | echo $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir); \ |
| 252 | $(INSTALL_DATA) $$s $(DESTDIR)$(sysconfdir) || exit 1; \ |
| 253 | done |
| 254 | uninstall-local:: |
| 255 | @for i in $(TOPLEVEL_CONFIG); do \ |
| 256 | b=$$(expr /$$i : '.*/\([^/]*\)$$'); \ |
| 257 | echo rm -f $(DESTDIR)$(sysconfdir)/$$b; \ |
| 258 | rm -f $(DESTDIR)$(sysconfdir)/$$b; \ |
| 259 | done |
| 260 | |
| 261 | ###-------------------------------------------------------------------------- |
| 262 | ### Release setup. |
| 263 | |
| 264 | dist-hook:: |
| 265 | echo $(VERSION) >$(distdir)/RELEASE |
| 266 | |
| 267 | EXTRA_DIST += config/auto-version |
| 268 | |
| 269 | ###-------------------------------------------------------------------------- |
| 270 | ### Debian packaging. |
| 271 | |
| 272 | EXTRA_DIST += debian/changelog debian/control debian/copyright |
| 273 | EXTRA_DIST += debian/rules debian/compat |
| 274 | |
| 275 | EXTRA_DIST += debian/distorted-keys-base.install |
| 276 | |
| 277 | EXTRA_DIST += debian/distorted-keys.install |
| 278 | EXTRA_DIST += debian/distorted-keys.postinst |
| 279 | |
| 280 | EXTRA_DIST += debian/claim-dir.install |
| 281 | |
| 282 | ###----- That's all, folks -------------------------------------------------- |