Skip to content

Instantly share code, notes, and snippets.

@r2p2
Created May 13, 2012 14:35
Show Gist options
  • Select an option

  • Save r2p2/2688713 to your computer and use it in GitHub Desktop.

Select an option

Save r2p2/2688713 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ "x$#" != "x1" ]
then
echo "usage: $0 depth"
echo "depth: "
exit 0
fi
depth=$1
loop=1
while [ $loop ]
do
if [ "$depth" -lt "1" ]
then
echo "level of depth reached"
exit
fi
current_unknown_keys=$(gpg --list-sigs | grep "User ID not found" | sed 's/.*\s\([0-9A-F]*\)\s....-..-...*/\1/' | sort | uniq)
if [ $(echo "$current_unknown_keys" | wc -l) -ne "0" ]
then
for key in $current_unknown_keys
do
echo "fetching key $key"
gpg --keyserver "hkp://pool.sks-keyservers.net" --recv-key $key 1> /dev/null 2>/dev/null
done
else
loop=0
fi
depth=$(expr $depth - 1)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment