#!/bin/sh # Copyright 2016 g10 Code GmbH # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. This file is # distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY, to the extent permitted by law; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. if [ -z "$srcdir" ]; then echo "not called from make" >&2 exit 1 fi set -e # (We may not use a relative name for gpg-agent.) GPG_AGENT="$(cd ../../agent && /bin/pwd)/gpg-agent" GPG="../../g10/gpg --no-permission-warning --no-greeting --no-secmem-warning --batch --agent-program=${GPG_AGENT}|--debug-quick-random" export GNUPGHOME="from-classic.gpghome" setup_home() { rm -rf -- "$GNUPGHOME" mkdir "$GNUPGHOME" for F in $srcdir/$GNUPGHOME/*.asc do $GPG --dearmor <"$F" >"$GNUPGHOME/`echo $F | sed -e 's/....$//'`" done chmod go-rwx $GNUPGHOME/* } trigger_migration() { $GPG --list-secret-keys >/dev/null } assert_migrated() { test -f $GNUPGHOME/.gpg-v21-migrated for KEY in D74C5F22 C40FDECF ECABF51D; do $GPG --list-secret-keys $KEY >/dev/null done } setup_home trigger_migration assert_migrated