#!/bin/sh

if [ "$#" -eq "0" ]; then
	gpg --keyring /usr/share/keyrings/debian-keyring.gpg \
		--no-default-keyring --list-keys --with-colons \
		--no-expensive-trust-checks 2>&1 | \
		grep ^pub | cut -d ':' -f 5 | xargs -n 1 "$0"
fi

if [ "$#" -gt "1" ]; then
	echo "This only works with 0 or 1 args." >2
	exit 1
fi

gpg -a --export --keyring /usr/share/keyrings/debian-keyring.gpg \
	"$1" > "./key.$1"
gpg --keyring "./keyring.$1" --no-default-keyring --import "./key.$1"

rm "./key.$1"
exit 0;

#gpg --keyring /usr/share/keyrings/debian-keyring.gpg --no-default-keyring --list-keys --with-colons --no-expensive-trust-checks 2>&1 | grep ^pub | cut -d ':' -f 5 | xargs -n 1
