Hola, gente
Ando liada con un script que coge todas las claves p�blicas de
nuestro pubrig.gpg, las tira a un fichero y se pone a bajarse las
�ltimas versiones de dichas claves. No pregunt�is por qu�. Puro
aburrimiento, supongo.
Si consigo hacerlo, me vendr�a muy bien para esas veces que mutt se
queda "pensando" cada vez que no puede obtener una clave. El segundo pas
ser�a madar un mail a cada propietario de esas claves para que la suba,
pero me parece un poco fuerte :-)
Cuando se pone a bajarse las claves, algunas no est�n en el servidor, y
se queda parado para siempre. Me gustar�a meterle un timeout a gpg, pero
no veo c�mo hacerlo, o intentar controlarlo yo, pero no lo consigo.
El script es este [casi me da verg�enza ense�arlo ;-)] y acepto todo
tipo de mejoras o sugerencias:
#!/bin/bash
# Amaya Rodrigo <[EMAIL PROTECTED]> November 2001
# This is free software, under the terms of the GPL v2 or later
# This script outputs all of your public ring GPG ids and asks servers for
# updates on the keys.
# Define files to use as temporary files
# Temp files will not be needed in a later stage
file=/tmp/gpg_raw
file2=/tmp/gpg_ids
file3=/tmp/gpg_nokey
# Set GPG timeout while connecting to server
timeout=5
# Output everything to one file
echo "Getting keys from our public ring. This may take a while..."
gpg --list-public-keys | grep pub | cut -b 12- | sort > $file
echo "Finished getting keys from our public ring"
# Find out how many keys
max=`cat $file | wc -l `
real=`echo $[$max-1]`
echo "We have $real keys in our public ring"
# Get rid of lines we do not want, first line and names:
tail -$real $file | cut -b -8 > $file2
# I know have all the keys
# Get each key and update it.
# If we get no response from server in 5 seconds,
# get next one.
for i in `cat $file2` ;
do
# If key is not an empty string:
if [ $i != "" ]; then
gpg --recv-key $i &
sleep $timeout
read input
# If nothing happens, press q and go to next
# key
if [ $input == q ]; then
# Keep record of what failed
echo $i > $file3 ;
killall -9 gpg ;
fi
fi
done
echo "Removing temporal data $file"
rm -i $file $file2 $file3
gpg --update-trustdb
# Here comes the part, not yet implemented, on mailing people asking for
# their keys.
Muchas gracias :-)
--
I stole all those good days, that's why they were taken away from me,
.''`. and they were replaced by the ones I deserve.
: :' : Speaker for the dead - Orson Scott Card
`. `' Proudly running Debian GNU/Linux Sid (Kernel 2.4.9)
`- www.amayita.com www.malapecora.com www.chicasduras.com