keys.archive -> cryptop.archive: Command was in the wrong suite.
[distorted-keys] / cryptop.archive
diff --git a/cryptop.archive b/cryptop.archive
new file mode 100755 (executable)
index 0000000..40bc5a7
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+###
+### Output a publishable archive of the key repository
+###
+### (c) 2011 Mark Wooding
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the distorted.org.uk key management suite.
+###
+### distorted-keys is free software; you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 2 of the License, or
+### (at your option) any later version.
+###
+### distorted-keys is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with distorted-keys; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set -e
+case "${KEYSLIB+t}" in t) ;; *) echo >&2 "$0: KEYSLIB unset"; exit 1 ;; esac
+. "$KEYSLIB"/keyfunc.sh
+
+defhelp <<HELP
+LABEL KEY | tar xf -
+Write a publishable archive of the key-management state.
+
+The archive is written to stdout as a tar archive containing two files:
+LABEL.tar.gz contains the actual archive, and LABEL.KEY.sig contains a
+signature.
+
+The archive doesn't contain any unecrypted secrets.  You'll probably need
+a keeper set to get anything useful out of it.
+HELP
+
+case $# in 2) ;; *) usage_err ;; esac
+arch=$1 key=$2
+checkword "archive label" "$arch"
+
+mktmp
+prepare "$key" archive
+cd $tmp
+mkdir $arch
+ln -s $ETC $arch/config
+mkdir $arch/data
+ln -s $KEYS/* $arch/data/
+rm -f $arch/data/nub
+tar cf - $arch/config/* $arch/data/*/* | gzip -9c >$arch.tar.gz
+c_sign $kdir $knub <$arch.tar.gz >$arch.sig
+tar cf - $arch.tar.gz $arch.sig
+
+###----- That's all, folks --------------------------------------------------