Easily Update Your PPA Keys (update-launchpad)

9 May 2009  •  Comments

This nifty little shell script will automatically install keys for any PPA you have added to your sources lists.  Handy but use with caution.  The keys are there to protect you.  Automating their install, while handy, leaves you blind to a hack.

#! /bin/sh
if [ "`whoami`" != "root" ];
then
echo "Please run with SUDO"
exit 1
fi
RELEASE=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d"=" -f2`
echo Release: $RELEASE
echo Please Wait...
for q in `find /etc/apt/ -name *.list`; do
cat $q >> fullsourceslist
done
for i in `cat fullsourceslist | grep "deb http" | grep ppa.launchpad | grep \
$RELEASE | cut -d/ -f4`; do
    wget -q --no-check-certificate `wget -q --no-check-certificate \
    https://launchpad.net/~$i/+archive -O- | grep \
    "http://keyserver.ubuntu.com:11371/pks/" | cut -d'"' -f2 ` -O- | grep \
    "pub  " | cut -d'"' -f2 >> keyss
done
for j in `cat keyss` ; do
	wget -q --no-check-certificate "http://keyserver.ubuntu.com:11371$j" -O- |\
    grep -B 999999 END |grep -A 999999 BEGIN > keyss2
	sudo apt-key add keyss2
	rm keyss2
done
rm keyss
rm fullsourceslist

launchpad-update.tar.gz

Found this here thanks to the author (blackgr).

Twitter Facebook Stumbleupon Reddit Digg

Copyright © 2004 - 2013 Nomad.Works | Made in Ottawa